helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[Bug] schema job fails

Open till opened this issue 5 months ago • 9 comments

What are you really trying to do?

Trying to setup temporal using this helm chart.

Describe the bug

The schema job fails to complete — it says it cannot connect to the database.

Minimal Reproduction

You can follow the instructions in the README in this repository for deploying Temporal with your own PostgreSQL database. Walk through the steps with the sql tool (all successful) and then helm install the latest version of the chart with the postgresql values (adjusted).

Environment/Versions

  • OS and processor: helm
  • Temporal Chart Version: 0.65.0
  • Are you using Docker or Kubernetes or building Temporal from source? k8s / AKS

Additional context

If I disable the tool, I can access the UI:

schema:
  createDatabase:
    enabled: false
  setup:
    enabled: false
  update:
    enabled: false

till avatar Aug 15 '25 21:08 till

Hello @till

Please have a look on https://github.com/temporalio/helm-charts/pull/686. I'm using postgresql helm chart as a dependency and the schema job completes without any issue. If you are using an external database, please provide your values.yaml with the database connection variables and the error returned by the job pod.

luiscosta18 avatar Aug 21 '25 16:08 luiscosta18

@luiscosta18 hey, thanks for responding.

Can you explain how the PR addresses my issue?

I probably didn't explain it right:

My issue is not setting up PostgreSQL. My issue is that the current documentation contains all these steps to build a schema tool etc. to setup the database and run initial migrations when apparently the helm chart already comes with a container/setup job?

I followed the steps in the readme which led me here.

As I stated, if I disable the schema job, the UI seems to work? Before the UI was unavailable (error 500) and the Job setup by the helm chart failed.

till avatar Aug 21 '25 17:08 till

Oh, there may also be additional problems that the schema job is unable to tell that the system was initialized?

till avatar Aug 21 '25 17:08 till

Btw, I am personally fine with the manual setup steps. I just think then there should be something in the readme to tell people to disable the settings I did.

till avatar Aug 21 '25 17:08 till

Hello @till,

The purpose of schema job is to bootstrap temporal and temporal visibility databases schemas automatically. There is no need to set setup.enabled: false + update. enabled: false and run the migrations manually. If you are getting the error "cannot connect to the database", something may be wrong with your values.yaml. Can you please provide the error returned by the job pod and your values.yaml?

luiscosta18 avatar Aug 21 '25 21:08 luiscosta18

image

From your readme on this repository, the instructions. This is what I followed.

My database works, I suspect from the pr you linked the automated postgres setup is not implemented. 😂

till avatar Aug 21 '25 21:08 till

When the helm chart was created there was no schema job to run the migrations automatically, server-job.yaml was only created later. That's why that information to use temporal-sql-tool was kept in the README I guess.

Nowadays, those commands are executed automatically by the job: https://github.com/temporalio/helm-charts/blob/main/charts/temporal/templates/server-job.yaml#L92 https://github.com/temporalio/helm-charts/blob/main/charts/temporal/templates/server-job.yaml#L132

You don't need to follow those instructions mentioned in the README to run schemas migrations anymore.

luiscosta18 avatar Aug 21 '25 21:08 luiscosta18

Yes, that's fine, and I get it, but then update the readme. That's why I created this issue.

The problem that remains is, why is your schema job not working when someone performed the manual steps.

till avatar Aug 21 '25 21:08 till

@robholland @tomwheeler

Taking into account that database migrations are nowadays executed automatically by schema job, should the sections "Install with your own MySQL" and "Install with your own PostgreSQL" removed from README.md?

luiscosta18 avatar Aug 21 '25 22:08 luiscosta18

We no longer suggest people perform manual schema steps.

robholland avatar Dec 18 '25 15:12 robholland