diff --git a/README.md b/README.md index 820739b1..d508630a 100644 --- a/README.md +++ b/README.md @@ -156,29 +156,47 @@ See https://github.com/i18next/i18next/issues/1691#issuecomment-968063348 for an explanation why this plural form is needed in French and Italian. But not in German and English. -## Deployment to CapRover +## Deployment and Environments -### CapRover Dev (vbv-lernwelt.control.iterativ.ch) +### Prod Environment on Azure -``` -# run deploy script -./caprover_deploy.sh vbv-lernwelt +Bitbucket Pipelines name: prod-azure +https://my.vbv-afa.ch/ -# of vbv-lernwelt is default value -./caprover_deploy.sh -``` +Deployment step on Bitbucket Pipelines will build the Docker container for Azure. +It seems that right now, you have to make a manual step on Azure to use this new +Docker container and update it on Azure. +Please ask Lorenz for more information. -### CapRover Stage (myvbv-stage.iterativ.ch) +### CapRover vbv-develop -``` -./caprover_deploy.sh myvbv-stage -``` +Bitbucket Pipelines name: develop +https://vbv-develop.control.iterativ.ch/ -### CapRover Prod (myvbv.iterativ.ch) +Deployment happens automatically on every push to develop branch. + +### CapRover vbv-master + +Bitbucket Pipelines name: master +https://vbv-master.control.iterativ.ch/ +Deployment happens automatically on every push to master branch. + +### CapRover myvbv-stage + +Bitbucket Pipelines name: stage +https://myvbv-stage.control.iterativ.ch/ +https://myvbv-stage.iterativ.ch/ + +Deployment happens manually via Bitbucket Pipelines + +### CapRover myvbv (old prod) + +Bitbucket Pipelines name: myvbv +https://myvbv.control.iterativ.ch/ +https://myvbv.iterativ.ch/ + +Deployment happens manually via Bitbucket Pipelines -``` -./caprover_deploy.sh myvbv -``` ### CapRover feature branch deployment diff --git a/caprover_deploy.sh b/caprover_deploy.sh index e6bda1e6..efb90f50 100755 --- a/caprover_deploy.sh +++ b/caprover_deploy.sh @@ -40,6 +40,8 @@ echo "Deploy to $APP_NAME" # create client for django npm run build + +# "collectstatic" should run with "local" env even in other environments IT_APP_ENVIRONMENT=local python server/manage.py collectstatic --no-input if [[ "$APP_NAME" == "prod-azure" ]]; then diff --git a/compose/django/docker_entrypoint.sh b/compose/django/docker_entrypoint.sh index 524f6902..a8237301 100644 --- a/compose/django/docker_entrypoint.sh +++ b/compose/django/docker_entrypoint.sh @@ -4,8 +4,6 @@ set -o errexit set -o pipefail set -o nounset - - # N.B. If only .env files supported variable expansion... # export CELERY_BROKER_URL="${REDIS_URL}" diff --git a/compose/django/docker_start.sh b/compose/django/docker_start.sh index b7a592d8..ce278dcf 100644 --- a/compose/django/docker_start.sh +++ b/compose/django/docker_start.sh @@ -2,11 +2,17 @@ set -o errexit set -o pipefail -set -o nounset -# python /app/manage.py collectstatic --no-input --no-post-process +echo $IT_APP_ENVIRONMENT -# TODO remove after stabilisation -python /app/manage.py reset_schema +if [[ $IT_APP_ENVIRONMENT == dev* ]] || [[ $IT_FORCE_RESET_SCHEMA == "true" ]]; then + echo "IT_APP_ENVIRONMENT=$IT_APP_ENVIRONMENT; IT_FORCE_RESET_SCHEMA=$IT_FORCE_RESET_SCHEMA" + echo "Resetting the database schema." + python /app/manage.py reset_schema +else + echo "IT_APP_ENVIRONMENT=$IT_APP_ENVIRONMENT" + echo "Migrating the database schema. (no reset)" + python /app/manage.py migrate +fi /usr/local/bin/gunicorn config.asgi --bind 0.0.0.0:7555 --chdir=/app -k uvicorn.workers.UvicornWorker diff --git a/env_secrets/caprover_dev.env b/env_secrets/caprover_dev.env deleted file mode 100644 index c0dd90f9..00000000 Binary files a/env_secrets/caprover_dev.env and /dev/null differ diff --git a/env_secrets/caprover_myvbv-prod.env b/env_secrets/caprover_myvbv-prod.env new file mode 100644 index 00000000..6c858195 Binary files /dev/null and b/env_secrets/caprover_myvbv-prod.env differ diff --git a/env_secrets/caprover_myvbv-stage.env b/env_secrets/caprover_myvbv-stage.env new file mode 100644 index 00000000..c70851f3 Binary files /dev/null and b/env_secrets/caprover_myvbv-stage.env differ diff --git a/env_secrets/caprover_prod.env b/env_secrets/caprover_prod.env deleted file mode 100644 index cbf2d43f..00000000 Binary files a/env_secrets/caprover_prod.env and /dev/null differ diff --git a/env_secrets/caprover_stage.env b/env_secrets/caprover_stage.env deleted file mode 100644 index 0fee939d..00000000 Binary files a/env_secrets/caprover_stage.env and /dev/null differ diff --git a/env_secrets/prod-azure.json b/env_secrets/prod-azure.json index 660fb8f8..914ac99a 100644 Binary files a/env_secrets/prod-azure.json and b/env_secrets/prod-azure.json differ diff --git a/git-crypt-encrypted-files.txt b/git-crypt-encrypted-files.txt index 565a8b73..a2b50083 100644 --- a/git-crypt-encrypted-files.txt +++ b/git-crypt-encrypted-files.txt @@ -1,6 +1,5 @@ - encrypted: env_secrets/caprover_dev.env - encrypted: env_secrets/caprover_prod.env - encrypted: env_secrets/caprover_stage.env + encrypted: env_secrets/caprover_myvbv-prod.env + encrypted: env_secrets/caprover_myvbv-stage.env encrypted: env_secrets/local_chrigu.env encrypted: env_secrets/local_daniel.env encrypted: env_secrets/local_elia.env