Fix migration issues

This commit is contained in:
2025-08-25 14:28:30 +09:00
parent 961c577ec8
commit 6886ba15c8
7 changed files with 403 additions and 28 deletions

View File

@ -1,5 +1,3 @@
version: "3.9"
services:
postgres-db:
image: kartoza/postgis:12.0
@ -9,11 +7,25 @@ services:
- postgres_data:/var/lib/postgresql
- ./custom-postgresql.conf:/etc/postgresql/12/main/postgresql.conf
- ./rogaining.sql:/sql/rogaining.sql
- ./sqls:/sqls
- ./create_location2025_table.sql:/sql/create_location2025_table.sql
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASS}
- POSTGRES_DBNAME=${POSTGRES_DBNAME}
- POSTGRES_MAX_CONNECTIONS=600
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 1G
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
restart: "on-failure"
networks:
- rog-api
@ -22,16 +34,23 @@ services:
build:
context: .
dockerfile: Dockerfile.gdal
command: bash -c "./wait-for-postgres.sh postgres-db && python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:8000"
command: bash -c "./wait-for-postgres.sh postgres-db && gunicorn config.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/app
- static_volume:/app/static
- media_volume:/app/media
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000')\" || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: "on-failure"
depends_on:
- postgres-db
postgres-db:
condition: service_healthy
networks:
- rog-api