Skip to content

Commit

Permalink
fix: add db connection details to celery deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
Salaton committed Apr 17, 2024
1 parent 8225ca6 commit 3d23c46
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ env:
DB_PORT: ${{ secrets.DB_PORT }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB: ${{ secrets.DB }}
ES_HOST: ${{ secrets.ES_HOST }}
ES_HOSTS: ${{ secrets.ES_HOSTS }}
ES_USER: ${{ secrets.ES_USER }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_PORT: ${{ secrets.ES_PORT }}
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
DEBUG: ${{ secrets.DEBUG }}
Expand All @@ -44,7 +46,7 @@ env:
jobs:
deploy_to_testing:
name: Deploy testing server to google kubernetes engine
if: ${{ github.ref == 'refs/heads/develop'}}
if: ${{ github.ref == 'refs/heads/celery-fixes'}}
runs-on: ubuntu-latest
environment:
name: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,43 @@ spec:
value: {{ .Values.app.container.env.redisPort | quote }}

- name: DEBUG
value: {{ .Values.app.container.env.debug | quote }}
value: {{ .Values.app.container.env.debug | quote }}

- name: DB_HOST
value: {{ .Values.app.container.env.dbHost | quote }}

- name: DB_PORT
value: {{ .Values.app.container.env.dbPort | quote }}

- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: DB_PASSWORD
value: {{ .Values.app.container.env.dbPassword | quote }}

- name: API_HOST
value: {{ .Values.app.container.env.redisHost | quote }}

- name: API_PORT
value: {{ .Values.app.container.env.redisPort | quote }}

- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.33.2
command: [
"/cloud_sql_proxy",
"-instances={{ .Values.app.container.env.databaseInstanceConnectionName }}=tcp:5432",
"-credential_file={{ .Values.app.container.env.googleApplicationCredentialsSecret.filePath }}"]

securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false

volumeMounts:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
mountPath: {{ .Values.app.container.env.googleApplicationCredentialsSecret.mountPath }}
readOnly: true

volumes:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
secret:
secretName: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,43 @@ spec:
value: {{ .Values.app.container.env.redisPort | quote }}

- name: DEBUG
value: {{ .Values.app.container.env.debug | quote }}
value: {{ .Values.app.container.env.debug | quote }}

- name: DB_HOST
value: {{ .Values.app.container.env.dbHost | quote }}

- name: DB_PORT
value: {{ .Values.app.container.env.dbPort | quote }}

- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: DB_PASSWORD
value: {{ .Values.app.container.env.dbPassword | quote }}

- name: API_HOST
value: {{ .Values.app.container.env.redisHost | quote }}

- name: API_PORT
value: {{ .Values.app.container.env.redisPort | quote }}

- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.33.2
command: [
"/cloud_sql_proxy",
"-instances={{ .Values.app.container.env.databaseInstanceConnectionName }}=tcp:5432",
"-credential_file={{ .Values.app.container.env.googleApplicationCredentialsSecret.filePath }}"]

securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false

volumeMounts:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
mountPath: {{ .Values.app.container.env.googleApplicationCredentialsSecret.mountPath }}
readOnly: true

volumes:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
secret:
secretName: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,44 @@ spec:
value: {{ .Values.app.container.env.redisPort | quote }}

- name: DEBUG
value: {{ .Values.app.container.env.debug | quote }}
value: {{ .Values.app.container.env.debug | quote }}

- name: DB_HOST
value: {{ .Values.app.container.env.dbHost | quote }}

- name: DB_PORT
value: {{ .Values.app.container.env.dbPort | quote }}

- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: DB_PASSWORD
value: {{ .Values.app.container.env.dbPassword | quote }}

- name: API_HOST
value: {{ .Values.app.container.env.redisHost | quote }}

- name: API_PORT
value: {{ .Values.app.container.env.redisPort | quote }}


- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.33.2
command: [
"/cloud_sql_proxy",
"-instances={{ .Values.app.container.env.databaseInstanceConnectionName }}=tcp:5432",
"-credential_file={{ .Values.app.container.env.googleApplicationCredentialsSecret.filePath }}"]

securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false

volumeMounts:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
mountPath: {{ .Values.app.container.env.googleApplicationCredentialsSecret.mountPath }}
readOnly: true

volumes:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
secret:
secretName: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,43 @@ spec:
value: {{ .Values.app.container.env.redisPort | quote }}

- name: DEBUG
value: {{ .Values.app.container.env.debug | quote }}
value: {{ .Values.app.container.env.debug | quote }}

- name: DB_HOST
value: {{ .Values.app.container.env.dbHost | quote }}

- name: DB_PORT
value: {{ .Values.app.container.env.dbPort | quote }}

- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: DB_PASSWORD
value: {{ .Values.app.container.env.dbPassword | quote }}

- name: API_HOST
value: {{ .Values.app.container.env.redisHost | quote }}

- name: API_PORT
value: {{ .Values.app.container.env.redisPort | quote }}

- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.33.2
command: [
"/cloud_sql_proxy",
"-instances={{ .Values.app.container.env.databaseInstanceConnectionName }}=tcp:5432",
"-credential_file={{ .Values.app.container.env.googleApplicationCredentialsSecret.filePath }}"]

securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false

volumeMounts:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
mountPath: {{ .Values.app.container.env.googleApplicationCredentialsSecret.mountPath }}
readOnly: true

volumes:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
secret:
secretName: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,43 @@ spec:
value: {{ .Values.app.container.env.redisPort | quote }}

- name: DEBUG
value: {{ .Values.app.container.env.debug | quote }}
value: {{ .Values.app.container.env.debug | quote }}

- name: DB_HOST
value: {{ .Values.app.container.env.dbHost | quote }}

- name: DB_PORT
value: {{ .Values.app.container.env.dbPort | quote }}

- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: DB_PASSWORD
value: {{ .Values.app.container.env.dbPassword | quote }}

- name: API_HOST
value: {{ .Values.app.container.env.redisHost | quote }}

- name: API_PORT
value: {{ .Values.app.container.env.redisPort | quote }}

- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.33.2
command: [
"/cloud_sql_proxy",
"-instances={{ .Values.app.container.env.databaseInstanceConnectionName }}=tcp:5432",
"-credential_file={{ .Values.app.container.env.googleApplicationCredentialsSecret.filePath }}"]

securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false

volumeMounts:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
mountPath: {{ .Values.app.container.env.googleApplicationCredentialsSecret.mountPath }}
readOnly: true

volumes:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
secret:
secretName: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,55 @@ spec:
value: {{ .Values.app.container.env.redisPort | quote }}

- name: DEBUG
value: {{ .Values.app.container.env.debug | quote }}
value: {{ .Values.app.container.env.debug | quote }}

- name: DB_HOST
value: {{ .Values.app.container.env.dbHost | quote }}

- name: DB_PORT
value: {{ .Values.app.container.env.dbPort | quote }}

- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: DB_PASSWORD
value: {{ .Values.app.container.env.dbPassword | quote }}

- name: API_HOST
value: {{ .Values.app.container.env.redisHost | quote }}

- name: API_PORT
value: {{ .Values.app.container.env.redisPort | quote }}

- name: ES_HOSTS
value: {{ .Values.app.container.env.elasticSearchHost | quote }}

- name: ES_USER
value: {{ .Values.app.container.env.elasticSearchUser | quote }}

- name: ES_PASSWORD
value: {{ .Values.app.container.env.elasticSearchPassword | quote }}

- name: ES_SCHEME
value: "https"

- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.33.2
command: [
"/cloud_sql_proxy",
"-instances={{ .Values.app.container.env.databaseInstanceConnectionName }}=tcp:5432",
"-credential_file={{ .Values.app.container.env.googleApplicationCredentialsSecret.filePath }}"]

securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false

volumeMounts:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
mountPath: {{ .Values.app.container.env.googleApplicationCredentialsSecret.mountPath }}
readOnly: true

volumes:
- name: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
secret:
secretName: {{ .Values.app.container.env.googleApplicationCredentialsSecret.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ spec:
- name: DB
value: {{ .Values.app.container.env.db | quote }}

- name: ES_HOST
- name: ES_HOSTS
value: {{ .Values.app.container.env.elasticSearchHost | quote }}

- name: ES_PORT
value: {{ .Values.app.container.env.elasticSearchPort | quote }}
- name: ES_USER
value: {{ .Values.app.container.env.elasticSearchUser | quote }}

- name: ES_PASSWORD
value: {{ .Values.app.container.env.elasticSearchPassword | quote }}

- name: ES_SCHEME
value: "https"
Expand Down
4 changes: 2 additions & 2 deletions deploy/charts/openconceptlab/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ image:
repository: openconceptlab/oclapi2
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "production"
tag: "qa"

oclweb:
port: 4000
Expand All @@ -28,7 +28,7 @@ oclweb:
repository: openconceptlab/oclweb2
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "production"
tag: "qa"

service:
type: NodePort
Expand Down
5 changes: 3 additions & 2 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ helm upgrade \
--set app.container.env.dbPort="${DB_PORT}"\
--set app.container.env.db="${DB}"\
--set app.container.env.dbPassword="${DB_PASSWORD}"\
--set app.container.env.elasticSearchHost="${ES_HOST}"\
--set app.container.env.elasticSearchPort="${ES_PORT}"\
--set app.container.env.elasticSearchHost="${ES_HOSTS}"\
--set app.container.env.elasticSearchUser="${ES_USER}"\
--set app.container.env.elasticSearchPassword="${ES_PASSWORD}"\
--set app.container.env.flowerPassword="${FLOWER_PASSWORD}"\
--set app.container.env.flowerUser="${FLOWER_USER}"\
--set app.container.env.flowerHost="${FLOWER_HOST}"\
Expand Down

0 comments on commit 3d23c46

Please sign in to comment.