run migrations in dev deployment

This commit is contained in:
Valerio Lomanto 2025-02-17 13:09:37 +01:00
parent a66fadaed9
commit 74038781d4
Signed by: verglasz
GPG key ID: 33263D8CFCFEC285

View file

@ -1,13 +1,14 @@
---
services:
# copy that's run locally in docker,
# app files are mounted for quick-reload and fast iterations
dev:
container_name: <%= @sso_service_name %>
hostname: <%= @sso_service_name %>
depends_on:
- postgres
postgres:
condition: service_started
run-migrations:
condition: service_completed_successfully
image: <%= @docker_image %>:<%= @docker_tag %>
environment:
DB_NAME: <%= @db_name %>
@ -29,6 +30,32 @@ services:
- default
- sso-proxy
run-migrations:
container_name: <%= @sso_service_name %>-migrations
command: [ 'python3', 'manage.py', 'migrate' ]
depends_on:
- postgres
image: <%= @docker_image %>:<%= @docker_tag %>
environment:
DB_NAME: <%= @db_name %>
DB_USER: <%= @db_user %>
DB_PW: <%= @db_pass %>
DB_HOST: <%= @db_host %>
DB_PORT: <%= @db_port %>
CENSYS_API_ID: <%= @censys_api_id %>
CENSYS_API_SECRET: <%= @censys_api_secret %>
DJANGO_ALLOWED_HOSTS: <%= @allowed_hosts %>
DJANGO_ALLOWED_ORIGINS: <%= @allowed_origins %>
STATIC_ROOT: /app/static
DASHBOARD_CONFIG_FILE: /app/config.yaml
init: true
volumes:
- pocs-data:/app/stored_pocs
- "<%= @app_config_file %>:/app/config.yaml:ro"
networks:
- sso-proxy
postgres:
container_name: postgres
image: postgres:latest