-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run migrations in job instead of API pod
- Loading branch information
1 parent
a1e1bf3
commit 9cde50a
Showing
3 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
|
||
set -ex | ||
|
||
./m.sh migrate | ||
gunicorn beta_spray.wsgi -b :8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
# We have to version this because existing jobs can't be overwritten | ||
name: "migrations-{{ .Release.Revision }}" | ||
namespace: "{{ .Release.Namespace }}" | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: migrations | ||
image: "ghcr.io/lucaspickering/beta-spray-api:{{ .Values.versionSha }}" | ||
command: ["./m.sh", "migrate"] | ||
resources: | ||
requests: | ||
cpu: 50m | ||
memory: 150Mi | ||
env: | ||
- name: BETA_SPRAY_DB_HOST | ||
value: db | ||
- name: BETA_SPRAY_DB_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: database-creds | ||
key: database | ||
- name: BETA_SPRAY_DB_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: database-creds | ||
key: username | ||
- name: BETA_SPRAY_DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: database-creds | ||
key: password | ||
restartPolicy: Never | ||
backoffLimit: 2 |