Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix postgresql schema #384

Closed

Conversation

medamineamara
Copy link

What was changed

Add kubernetes job to support database schema migration and updates on PostgreSQL.

Why?

Current workplace uses a Bring Your Own PostgreSQL and having this change upstream would be simple for more people.

Checklist

  1. Closes [Feature Request] Add Kubernetes job to migrate postgresql schema #349

  2. How was this tested:

Deployed Postgresql helm chart then deployed Temporal helm
Complete logs :

amine@amine-Latitude-5420:~/Work/Temporal-helm-charts$ helm -n temporal ls
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/amine/.kube/config
NAME      	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART            	APP VERSION
postgresql	temporal 	1       	2023-04-06 10:40:28.211826433 +0000 UTC	deployed	postgresql-12.1.6	15.1.0     


amine@amine-Latitude-5420:~/Work/Temporal-helm-charts$ helm -n temporal install -f temporal-values.yml temporal .
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/amine/.kube/config
NAME: temporal
LAST DEPLOYED: Tue May 16 21:50:23 2023
NAMESPACE: temporal
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
To verify that Temporal has started, run:

  kubectl --namespace=temporal get pods -l "app.kubernetes.io/instance=temporal"



amine@amine-Latitude-5420:~/Work/Temporal-helm-charts$ k -n temporal get pods
NAME                                   READY   STATUS      RESTARTS   AGE
postgresql-0                           1/1     Running     0          40d
temporal-admintools-6ff979d5fb-z5dwr   1/1     Running     0          98s
temporal-frontend-79fc54b7db-mknsd     1/1     Running     0          98s
temporal-history-dd6467bb7-jpt62       1/1     Running     0          98s
temporal-matching-5689b4b4f9-j4bsm     1/1     Running     0          98s
temporal-schema-setup-lzh9n            0/2     Completed   0          2m14s
temporal-schema-update-rlcrm           0/2     Completed   0          108s
temporal-web-fcbfff8c6-cvktl           1/1     Running     0          98s
temporal-worker-7b47ff8568-2xtdk       1/1     Running     0          98s


amine@amine-Latitude-5420:~/Work/Temporal-helm-charts$ helm -n temporal get values temporal
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/amine/.kube/config
USER-SUPPLIED VALUES:
cassandra:
  enabled: false
debug: true
elasticsearch:
  enabled: false
grafana:
  enabled: false
postgresql:
  enabled: false
  image:
    pullPolicy: IfNotPresent
    repo: postgres
    tag: 15.1
prometheus:
  enabled: false
server:
  config:
    persistence:
      default:
        driver: sql
        sql:
          database: temporal
          driver: postgres
          host: postgresql.temporal.svc.cluster.local
          maxConnLifetime: 1h
          maxConns: 20
          password: ********** # Masked password
          port: 5432
          user: postgres
      visibility:
        driver: sql
        sql:
          database: temporal_visibility
          driver: postgres
          host: postgresql.temporal.svc.cluster.local
          maxConnLifetime: 1h
          maxConns: 20
          password: ********** # Masked password
          port: 5432
          user: postgres
  replicaCount: 1
web:
  image:
    tag: 2.12.0


amine@amine-Latitude-5420:~/Work/Temporal-helm-charts$ k logs temporal-schema-update-rlcrm -n temporal
Defaulted container "default-schema-update" out of: default-schema-update, visibility-schema-update, check-postgresql-service (init), check-postgresql (init)
2023-05-16T19:50:58.561Z	INFO	UpdateSchemeTask started	{"config": {"DBName":"","TargetVersion":"","SchemaDir":"./schema/postgresql/v96/temporal/versioned","IsDryRun":false}, "logging-call-at": "updatetask.go:98"}
2023-05-16T19:50:58.566Z	DEBUG	Schema Dirs: []	{"logging-call-at": "updatetask.go:187"}
2023-05-16T19:50:58.567Z	DEBUG	found zero updates from current version 1.9	{"logging-call-at": "updatetask.go:128"}
2023-05-16T19:50:58.567Z	INFO	UpdateSchemeTask done	{"logging-call-at": "updatetask.go:121"}

  1. Any docs updates needed?

I think that in the readme the part where schema setup and update for postgresql should be removed
https://github.com/temporalio/helm-charts#install-with-your-own-postgresql

It's an extension of this PL #350

@medamineamara medamineamara requested review from a team as code owners May 16, 2023 20:17
@CLAassistant
Copy link

CLAassistant commented May 16, 2023

CLA assistant check
All committers have signed the CLA.

@medamineamara
Copy link
Author

I found a far more better approach
#281

@brandonros
Copy link

similar to #350 and #281 i'm pretty sure, probably #275 too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Add Kubernetes job to migrate postgresql schema
4 participants