From ef06f1a67d2654aaeb55d0434d3324a3ac37a380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 23 Oct 2022 18:30:53 +0200 Subject: [PATCH] Add database migration to auto-deployment on publish --- .github/workflows/publish.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4eb976289..2a2e73dc6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -305,16 +305,19 @@ jobs: # because this step 'kubectl -n default rollout status deployment/* --timeout=600s' does not work as expected # and we need the pods to be up again for cleaning and seeding the Neo4j database and the backend. # !!! this is not a perfect solution !!! - # deployments are regularely up again after 3 minutes and 10 seconds + # deployments are regularly up again after 3 minutes and 10 seconds - name: Sleep for 4 minutes, means 240 seconds run: sleep 240s shell: bash - - name: Verify deployment and wait for the pods of each deplyment to get ready for cleaning and seeding of the database + - name: Verify deployment and wait for the pods of each deployment to get ready for cleaning and seeding of the database run: | kubectl -n default rollout status deployment/ocelot-backend --timeout=600s kubectl -n default rollout status deployment/ocelot-neo4j --timeout=600s kubectl -n default rollout status deployment/ocelot-maintenance --timeout=600s kubectl -n default rollout status deployment/ocelot-webapp --timeout=600s + - name: Run migrations for Neo4j database via backend for staging + run: | + kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "yarn prod:migrate up" - name: Reset and seed Neo4j database via backend for staging # db cleaning and seeding is only possible in production if env 'PRODUCTION_DB_CLEAN_ALLOW=true' is set in deployment run: |