fix(docker): align database config between docker-compose and .env
- Move POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB to .env - Update docker-compose.yml to reference env vars instead of hardcoding - Fix db healthcheck to use correct credentials from .env - Update .env.example with matching placeholder values - Update DATABASE_URL to use variable interpolation
This commit is contained in:
+3
-3
@@ -7,9 +7,9 @@ FLASK_DEBUG=1
|
|||||||
# ═════════════════════════════════════════════════════════════════════════════
|
# ═════════════════════════════════════════════════════════════════════════════
|
||||||
COMPOSE_PROJECT_NAME=authy2
|
COMPOSE_PROJECT_NAME=authy2
|
||||||
FLASK_ENV=production
|
FLASK_ENV=production
|
||||||
POSTGRES_USER=authy2
|
POSTGRES_USER=appuser
|
||||||
POSTGRES_PASSWORD=changeme-in-production
|
POSTGRES_PASSWORD=change-me-in-production
|
||||||
POSTGRES_DB=authy2
|
POSTGRES_DB=secuird
|
||||||
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||||
SQLALCHEMY_DATABASE_URI=${DATABASE_URL}
|
SQLALCHEMY_DATABASE_URI=${DATABASE_URL}
|
||||||
REDIS_URL=redis://redis:6379/0
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
|||||||
+4
-12
@@ -7,14 +7,6 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
|
||||||
- FLASK_ENV=production
|
|
||||||
- CORS_ORIGINS=http://192.168.50.124:8080,http://localhost:8080,http://localhost:5173
|
|
||||||
- DATABASE_URL=postgresql://${POSTGRES_USER:-gatehouse}:${POSTGRES_PASSWORD:-gatehouse}@db:5432/${POSTGRES_DB:-gatehouse}
|
|
||||||
- SQLALCHEMY_DATABASE_URI=postgresql://${POSTGRES_USER:-gatehouse}:${POSTGRES_PASSWORD:-gatehouse}@db:5432/${POSTGRES_DB:-gatehouse}
|
|
||||||
- REDIS_URL=redis://redis:6379/0
|
|
||||||
- SESSION_REDIS_URL=redis://redis:6379/0
|
|
||||||
- RATELIMIT_STORAGE_URL=redis://redis:6379/1
|
|
||||||
ports:
|
ports:
|
||||||
- "${API_PORT:-5000}:5000"
|
- "${API_PORT:-5000}:5000"
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -35,16 +27,16 @@ services:
|
|||||||
db:
|
db:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=${POSTGRES_USER:-gatehouse}
|
- POSTGRES_USER=${POSTGRES_USER}
|
||||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-gatehouse}
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
- POSTGRES_DB=${POSTGRES_DB:-gatehouse}
|
- POSTGRES_DB=${POSTGRES_DB}
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
networks:
|
networks:
|
||||||
- authy2-network
|
- authy2-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gatehouse} -d ${POSTGRES_DB:-gatehouse}"]
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user