Schema setup and update jobs for MySQL

Hi,
I’m trying to deploy Temporal on a Kubernetes cluster using the helm chart. I’m using MySQL as the DB and would like to enable the schema setup and update jobs to setup the required schema.

I ran into an issue with the schema and update jobs and logged https://github.com/temporalio/helm-charts/issues/310 with more details. TL;DR : the jobs failed to connect to the DB because the SQL configuration parameters (eg. SQL_USER, SQL_PASSWORD) are not passed as environment variables.

I managed to get this issue addressed in my copy of the helm chart and submitted this PR to address. I then realized that there’s already been a few PRs submitted for this issue.

A couple of open PRs with no responses:
https://github.com/temporalio/helm-charts/pull/275
https://github.com/temporalio/helm-charts/pull/281

There is also https://github.com/temporalio/helm-charts/pull/167, which is closed and indicating this feature won’t be included, as auto database setup is not considered a production feature.

Can you please clarify if it is desirable to fix these SQL jobs and if not, what is the recommended way for setting up MySQL schemas for production? Doing this in an automated way is a must in my opinion. It’s common to have such automated schema updates with tools like Flyway or Liquibase and the temporal-sql tools seems to be doing something similar.

Thanks for the info and the PR! Agree that we haven’t been doing a great job regarding PRs in the helm charts repo. I’m going through all PRs currently and it will get much better as there is clear ownership of the repo now, so stay tuned for updates :slight_smile:

what is the recommended way for setting up MySQL schemas for production

its to use the sql tool (see readme for create and update commands) so your approach of using temporal-sql-tool via command is a good way imo.

@tihomir have a question regarding using the sql tool + deploying a Temporal cluster through a helm chart. If I already ran the sql tool on my MySQL cluster, the values provided here are correct, right? Namely, I’m running into a lot of slowness installing the helm chart when the update job is set to true, so wondering if it’s even needed if the SQL tool is ran prior to helm installation.

Separately, should I be specifying a specific version for my schema on the SQL tool (similar to whatever version of temporalio/server I’m running)?