Database Hardening: - Add docker-compose.db.yml with persistent PostgreSQL volume - Add automatic DB backups every 12h (7 days, 4 weeks, 6 months retention) - Add MinIO S3-compatible storage for assets Assets Migration: - Add MinIO client (lib/assets_client.py) for upload/delete - Update upload endpoint to use MinIO (with local fallback) - Add migration 043_asset_urls_to_text.sql for full HTTPS URLs - Simplify normalizeAssetUrl for S3 URLs Recovery: - Add seed_full_city_reset.py for emergency city recovery - Add DB_RESTORE.md with backup restore instructions - Add SEED_RECOVERY.md with recovery procedures - Add INFRA_ASSETS_MINIO.md with MinIO setup guide Task: TASK_PHASE_DATABASE_HARDENING_AND_ASSETS_MIGRATION_v1
84 lines
2.0 KiB
YAML
84 lines
2.0 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
# PostgreSQL Database with persistent storage
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: daarion-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: daarion
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./migrations:/docker-entrypoint-initdb.d:ro
|
|
networks:
|
|
- dagi-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d daarion"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# Automatic database backups
|
|
db-backup:
|
|
image: prodrigestivill/postgres-backup-local:latest
|
|
container_name: daarion-db-backup
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_HOST: db
|
|
POSTGRES_DB: daarion
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
SCHEDULE: "@every 12h"
|
|
BACKUP_KEEP_DAYS: 7
|
|
BACKUP_KEEP_WEEKS: 4
|
|
BACKUP_KEEP_MONTHS: 6
|
|
volumes:
|
|
- ./db_backups:/backups
|
|
depends_on:
|
|
- db
|
|
networks:
|
|
- dagi-network
|
|
|
|
# MinIO S3-compatible object storage for assets
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: daarion-minio
|
|
restart: unless-stopped
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-assets-admin}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-change-me-strong-password}
|
|
ports:
|
|
- "9000:9000" # S3 API
|
|
- "9001:9001" # Web console
|
|
volumes:
|
|
- minio_data:/data
|
|
networks:
|
|
- dagi-network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
volumes:
|
|
pgdata:
|
|
driver: local
|
|
name: daarion_pgdata
|
|
minio_data:
|
|
driver: local
|
|
name: daarion_minio_data
|
|
|
|
networks:
|
|
dagi-network:
|
|
external: true
|
|
name: dagi-network
|
|
|