From 093a8b97d01ecaa2705d4c3c56cf40f92bb7a4f7 Mon Sep 17 00:00:00 2001 From: Richard Larocque Date: Thu, 15 Oct 2020 17:28:11 -0700 Subject: [PATCH] feat(cadence): Preliminary PostgreSQL support Updates the chart to better support a PostgreSQL backend. This commit does not provide feature parity with existing Cassandra or MySQL support. The chart has options to spin up a MySQL or Cassandra instance and configure it for you. This commit offers nothing equivalent for Postgres; if you want to use a Postgres backend you must provision and configure it yourself. More specifically, we assume that: - The Postgres service is up and running. - The `cadence` user and its password are configured. - The databases `cadence` and `cadence_visibility` exist and are accessible by the `cadence` user. (This assumes default names are used. Adjust accordingly if you're using different names.) As long as those requirements are met, the jobs for "schema setup" and "schema update" should work just as they would for the MySQL backend. The option to disable either job through the "schema.setup.enabled" and "schema.update.enabled" values remains as before. The changes to support this new behavior are very minor. We simply remove an overly strict "if mysql" check in the setup job and add an postgres implementation for the update job. --- cadence/templates/server-job.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cadence/templates/server-job.yaml b/cadence/templates/server-job.yaml index 1726d1f9..9de39e08 100644 --- a/cadence/templates/server-job.yaml +++ b/cadence/templates/server-job.yaml @@ -76,11 +76,9 @@ spec: args: ['sh', '-c', 'cadence-cassandra-tool create -k {{ $storeConfig.cassandra.keyspace }}'] {{- end }} {{- if eq (include "cadence.persistence.driver" (list $ $store)) "sql" }} - {{- if eq (include "cadence.persistence.sql.pluginName" (list $ $store)) "mysql" }} # args: ["cadence-sql-tool", "create", "--db", "{{ $storeConfig.sql.database }}"] args: ['sh', '-c', 'cadence-sql-tool create --db {{ $storeConfig.sql.database }}'] {{- end }} - {{- end }} env: {{- if eq (include "cadence.persistence.driver" (list $ $store)) "cassandra" }} - name: CASSANDRA_HOST @@ -251,6 +249,8 @@ spec: {{- if eq (include "cadence.persistence.sql.pluginName" (list $ $store)) "mysql" }} # args: ["cadence-sql-tool", "update-schema", "-d", "/etc/cadence/schema/mysql/v57/{{ include "cadence.persistence.schema" $store }}/versioned"] args: ['sh', '-c', 'cadence-sql-tool update-schema -d /etc/cadence/schema/mysql/v57/{{ include "cadence.persistence.schema" $store }}/versioned'] + {{- else if eq (include "cadence.persistence.sql.pluginName" (list $ $store)) "postgres" }} + args: ['sh', '-c', 'cadence-sql-tool update-schema -d /etc/cadence/schema/postgres/{{ include "cadence.persistence.schema" $store }}/versioned'] {{- end }} {{- end }} env: