Add persistent PostgreSQL stack and SQLite migration

This commit is contained in:
2026-09-23 10:17:18 +02:00
parent 919df2220e
commit 52bd2a0607
8 changed files with 214 additions and 70 deletions
+34 -4
View File
@@ -1,15 +1,45 @@
services:
db:
image: postgres:16-alpine
container_name: telco-db
restart: unless-stopped
environment:
POSTGRES_DB: telco
POSTGRES_USER: telco
POSTGRES_PASSWORD: ${TELCO_DB_PASSWORD:-telco}
volumes:
- telco-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U telco -d telco"]
interval: 5s
timeout: 5s
retries: 10
telcoportal:
build:
context: ./TelcoPortal-source
dockerfile: Dockerfile
container_name: telcoportal
restart: unless-stopped
depends_on:
db:
condition: service_healthy
ports:
- "8092:8000"
volumes:
# Host-side folder - keeps the SQLite database across rebuilds/updates, and makes it
# easy to back up (just copy/zip this folder).
- ./TelcoPortal-data:/app/data
- telco-app-data:/app/data
# Read-only source for the automatic first-run SQLite import.
- ./data:/app/legacy-data:ro
environment:
- TELCO_DATA_DIR=/app/data
TELCO_DATA_DIR: /app/data
TELCO_DB_HOST: db
TELCO_DB_PORT: 5432
TELCO_DB_NAME: telco
TELCO_DB_USER: telco
TELCO_DB_PASSWORD: ${TELCO_DB_PASSWORD:-telco}
TELCO_LEGACY_SQLITE_PATH: /app/legacy-data/telco.db
command: ["sh", "-c", "python migrate_sqlite.py && exec gunicorn --bind 0.0.0.0:8000 --workers 2 app:app"]
volumes:
telco-db-data:
telco-app-data: