VBV-468: Remove DB drop on production environments

This commit is contained in:
Daniel Egger 2023-07-28 16:46:46 +02:00
parent 8cee1346c5
commit af905090cc
11 changed files with 48 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -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}"

View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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