run migrations automatically on backend startup (AUTO_MIGRATIONS)
Add a migrate.sh config (ported from lasuite-docs) that the backend entrypoint runs when AUTO_MIGRATIONS=true (default). It loads secrets, waits for the DB, and idempotently applies pending migrations via 'migrate --check' then 'migrate --noinput'. The manual 'abra app cmd backend migrate' now delegates to the same script.
This commit is contained in:
10
compose.yml
10
compose.yml
@ -118,9 +118,11 @@ services:
|
||||
user: ${DOCKER_USER:-1000}
|
||||
image: lasuite/drive-backend:v0.19.0
|
||||
command: [ "gunicorn", "-c", "/usr/local/etc/gunicorn/drive.py", "drive.wsgi:application" ]
|
||||
entrypoint: [ "/abra-entrypoint.sh", "/usr/local/bin/entrypoint" ]
|
||||
entrypoint: >
|
||||
sh -c "if [ \"$$AUTO_MIGRATIONS\" = \"true\" ]; then /migrate.sh; fi && exec /abra-entrypoint.sh /usr/local/bin/entrypoint \"$$@\"" --
|
||||
environment:
|
||||
<<: [ *common-env, *postgres-env ]
|
||||
AUTO_MIGRATIONS: "${AUTO_MIGRATIONS:-true}"
|
||||
networks:
|
||||
- backend
|
||||
depends_on:
|
||||
@ -129,6 +131,9 @@ services:
|
||||
- source: abra_entrypoint
|
||||
target: /abra-entrypoint.sh
|
||||
mode: 0555
|
||||
- source: migrate
|
||||
target: /migrate.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- django_sk
|
||||
- django_sp
|
||||
@ -405,6 +410,9 @@ configs:
|
||||
abra_entrypoint:
|
||||
name: ${STACK_NAME}_entrypoint_${ABRA_ENTRYPOINT_VERSION}
|
||||
file: abra-entrypoint.sh
|
||||
migrate:
|
||||
name: ${STACK_NAME}_migrate_${MIGRATE_VERSION}
|
||||
file: migrate.sh
|
||||
onlyoffice_conf:
|
||||
name: ${STACK_NAME}_onlyoffice_conf_${ONLYOFFICE_CONF_VERSION}
|
||||
file: onlyoffice-config.json.tmpl
|
||||
|
||||
Reference in New Issue
Block a user