Refine 'publish.yml'

This commit is contained in:
Wolfgang Huß 2022-07-20 07:57:45 +02:00
parent 16812e0966
commit 089c4ee1bb
3 changed files with 7 additions and 5 deletions

View File

@ -300,14 +300,14 @@ jobs:
kubectl -n default rollout restart deployment/ocelot-maintenance
kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:$BUILD_VERSION
kubectl -n default rollout restart deployment/ocelot-neo4j
- name: Verify deployment
- name: Verify deployment and wait for the pods of each deplyment to get ready for cleaning and seeding of the database
run: |
kubectl -n default rollout status deployment/ocelot-backend --timeout=240s
kubectl -n default rollout status deployment/ocelot-neo4j --timeout=240s
kubectl -n default rollout status deployment/ocelot-webapp --timeout=240s
kubectl -n default rollout status deployment/ocelot-maintenance --timeout=240s
kubectl -n default rollout status deployment/ocelot-backend --timeout=240s
kubectl -n default rollout status deployment/ocelot-neo4j --timeout=240s
- name: Reset and seed Neo4j database via backend for staging
# db cleaning is only possible if env 'PRODUCTION_DB_CLEAN_ALLOW=true' is set in deployment
# db cleaning and seeding is only possible in production if env 'PRODUCTION_DB_CLEAN_ALLOW=true' is set in deployment
run: |
kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "node dist/db/clean.js"
kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "node dist/db/seed.js"

View File

@ -22,6 +22,8 @@ const environment = {
DEBUG: env.NODE_ENV !== 'production' && env.DEBUG,
TEST: env.NODE_ENV === 'test',
PRODUCTION: env.NODE_ENV === 'production',
// used for staging enviroments if 'PRODUCTION=true' and 'PRODUCTION_DB_CLEAN_ALLOW=true'
PRODUCTION_DB_CLEAN_ALLOW: env.PRODUCTION_DB_CLEAN_ALLOW === 'true' || false, // default = false
DISABLED_MIDDLEWARES: (env.NODE_ENV !== 'production' && env.DISABLED_MIDDLEWARES) || false,
}

View File

@ -2,7 +2,7 @@ import { cleanDatabase } from '../db/factories'
import CONFIG from '../config'
if (CONFIG.PRODUCTION && !CONFIG.PRODUCTION_DB_CLEAN_ALLOW) {
throw new Error(`You cannot clean the database in production environment!`)
throw new Error(`You cannot clean the database in a non-staging and real production environment!`)
}
;(async function () {