version: '3.8' services: # Production Application Service scriptsmanager: build: . container_name: scriptsmanager_app networks: - scriptsmanager_network ports: - "5002:5002" - "5200-5400:5200-5400" environment: # Database Configuration - DATABASE_URL=postgresql://scriptsmanager:scriptsmanager_dev_password@postgres:5432/scriptsmanager # Application Configuration - DEBUG=false - SECRET_KEY=sidel-scriptsmanager-production-key-change-this - BASE_DATA_PATH=/app/data - BACKUP_ENABLED=true # Port and Resource Configuration - PORT_RANGE_START=5200 - PORT_RANGE_END=5400 - MAX_PROJECTS_PER_USER=50 # Internationalization - DEFAULT_LANGUAGE=en - SUPPORTED_LANGUAGES=en,es,it,fr - DEFAULT_THEME=light # Conda Environment Configuration - CONDA_DEFAULT_ENV=scriptsmanager - TSNET_ENV=tsnet - PYTHONPATH=/app # SIDEL Branding - SIDEL_LOGO_PATH=/app/app/static/images/SIDEL.png - CORPORATE_BRANDING=true volumes: # Data persistence for debugging - ./data:/app/data - ./backup:/app/backup - ./logs:/app/logs # Workspaces for proxy scripts - ./workspaces:/app/workspaces # Backend scripts volume (only for production) - ./app/backend/script_groups:/app/app/backend/script_groups depends_on: postgres: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:5002/health"] interval: 30s timeout: 10s retries: 3 start_period: 60s profiles: - production # PostgreSQL Database Service postgres: image: postgres:15-alpine container_name: scriptsmanager_postgres networks: - scriptsmanager_network environment: POSTGRES_DB: scriptsmanager POSTGRES_USER: scriptsmanager POSTGRES_PASSWORD: scriptsmanager_dev_password POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" volumes: - ./data/postgres:/var/lib/postgresql/data - ./sql:/docker-entrypoint-initdb.d:ro ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U scriptsmanager -d scriptsmanager"] interval: 10s timeout: 5s retries: 5 start_period: 30s restart: unless-stopped # Development Application Service with Hot Reload scriptsmanager-dev: build: . container_name: scriptsmanager_dev networks: - scriptsmanager_network ports: - "5003:5003" - "5678:5678" # Debug port environment: # Database Configuration (same as production for parity) - DATABASE_URL=postgresql://scriptsmanager:scriptsmanager_dev_password@postgres:5432/scriptsmanager # Development Configuration - DEBUG=true - PORT=5003 - SECRET_KEY=sidel-dev-secret-key - FLASK_ENV=development - BASE_DATA_PATH=/app/data - BACKUP_ENABLED=false # Port and Resource Configuration (higher limits for development) - PORT_RANGE_START=5200 - PORT_RANGE_END=5400 - MAX_PROJECTS_PER_USER=100 # Internationalization - DEFAULT_LANGUAGE=en - SUPPORTED_LANGUAGES=en,es,it,fr - DEFAULT_THEME=light # Conda Environment Configuration - CONDA_DEFAULT_ENV=scriptsmanager - TSNET_ENV=tsnet - PYTHONPATH=/app # SIDEL Branding - SIDEL_LOGO_PATH=/app/app/static/images/SIDEL.png - CORPORATE_BRANDING=true volumes: # Hot reload: mount entire codebase excluding workspaces - .:/app - ./data:/app/data - ./backup:/app/backup - ./logs:/app/logs # Workspaces for proxy scripts (mounted separately to avoid hot-reload) - ./workspaces:/app/workspaces:delegated depends_on: postgres: condition: service_healthy restart: unless-stopped command: > bash -c "source activate scriptsmanager && echo '=== SIDEL ScriptsManager Development Environment ===' && echo 'Development mode with stable container (hot reload disabled for stability)' && echo 'Application will be available at: http://localhost:5003' && echo 'Debug port available at: 5678' && python scripts/init_db.py && python scripts/run_app.py" profiles: - dev # Backup Service backup: build: . container_name: scriptsmanager_backup networks: - scriptsmanager_network environment: - DATABASE_URL=postgresql://scriptsmanager:scriptsmanager_dev_password@postgres:5432/scriptsmanager - BACKUP_ENABLED=true - BACKUP_RETENTION_DAYS=30 - PYTHONPATH=/app volumes: - ./data:/app/data - ./backup:/app/backup - ./logs:/app/logs depends_on: postgres: condition: service_healthy command: > bash -c "source activate scriptsmanager && echo '=== Starting SIDEL ScriptsManager Backup Service ===' && while true; do echo '[BACKUP] Starting daily backup process...' python -c 'from app.services.backup_service import BackupService; BackupService().create_backup()' echo '[BACKUP] Backup completed successfully' sleep 86400 # Daily backup (24 hours) done" profiles: - backup # Log Monitor Service log-monitor: build: . container_name: scriptsmanager_monitor networks: - scriptsmanager_network environment: - DATABASE_URL=postgresql://scriptsmanager:scriptsmanager_dev_password@postgres:5432/scriptsmanager - PYTHONPATH=/app volumes: - ./logs:/app/logs - ./data:/app/data # Workspaces for proxy scripts - ./workspaces:/app/workspaces depends_on: postgres: condition: service_healthy command: > bash -c "source activate scriptsmanager && echo '=== Starting SIDEL ScriptsManager Log Monitor ===' && python -c ' import time from app.services.data_manager import DataManager print(\"Log monitor service started - cleanup every hour\") while True: try: # Log cleanup according to retention policies # TODO: Implement log cleanup service print(f\"[MONITOR] Log cleanup check at {time.strftime(\"%Y-%m-%d %H:%M:%S\")}\") time.sleep(3600) # Cleanup every hour except Exception as e: print(f\"[MONITOR] Error: {e}\") time.sleep(60) '" profiles: - monitoring # Custom network for container communication networks: scriptsmanager_network: driver: bridge ipam: config: - subnet: 172.20.0.0/16 name: scriptsmanager_postgres_data