migrate db
This commit is contained in:
parent
e165ec3108
commit
4d0983380d
2 changed files with 29 additions and 34 deletions
34
.github/workflows/atlas-migratie-dev.yml
vendored
34
.github/workflows/atlas-migratie-dev.yml
vendored
|
|
@ -1,34 +0,0 @@
|
|||
name: Atlas Migrate (dev)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
migrate:
|
||||
runs-on: mealcraft-runners
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Install Atlas
|
||||
- name: Install Atlas CLI
|
||||
run: |
|
||||
curl -sSf https://atlasgo.sh | sh
|
||||
|
||||
# Load DB creds from Kubernetes secret
|
||||
- name: Load Postgres credentials
|
||||
run: |
|
||||
export POSTGRES_USER=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_USER}' | base64 -d)
|
||||
export POSTGRES_PASSWORD=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d)
|
||||
|
||||
echo "POSTGRES_USER=$POSTGRES_USER" >> $GITHUB_ENV
|
||||
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $GITHUB_ENV
|
||||
|
||||
# Run Atlas migrations (DEV only)
|
||||
- name: Run Atlas migrations (dev)
|
||||
run: |
|
||||
atlas migrate apply \
|
||||
--env stripe_invoice_dev
|
||||
29
.github/workflows/deploy-postgres.yml
vendored
29
.github/workflows/deploy-postgres.yml
vendored
|
|
@ -57,3 +57,32 @@ jobs:
|
|||
- name: Deploy Postgres backups
|
||||
run: |
|
||||
kubectl apply -f db/k8s/backups/
|
||||
|
||||
migrate:
|
||||
runs-on: mealcraft-runners
|
||||
needs: deploy
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Install Atlas
|
||||
- name: Install Atlas CLI
|
||||
run: |
|
||||
curl -sSf https://atlasgo.sh | sh
|
||||
|
||||
# Load DB creds from Kubernetes secret
|
||||
- name: Load Postgres credentials
|
||||
run: |
|
||||
export POSTGRES_USER=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_USER}' | base64 -d)
|
||||
export POSTGRES_PASSWORD=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d)
|
||||
|
||||
echo "POSTGRES_USER=$POSTGRES_USER" >> $GITHUB_ENV
|
||||
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $GITHUB_ENV
|
||||
|
||||
# Run Atlas migrations (DEV only)
|
||||
- name: Run Atlas migrations (dev)
|
||||
run: |
|
||||
atlas migrate apply \
|
||||
--env stripe_invoice_dev
|
||||
|
||||
Loading…
Add table
Reference in a new issue