updated docker compose and env file

This commit is contained in:
Quality System Admin
2025-11-03 23:30:16 +02:00
parent 1cb54be01e
commit 9020f2c1cf
2 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
================================================================================
DOCKER ENVIRONMENT - READY FOR DEPLOYMENT
================================================================================
Date: $(date)
Project: Quality App (Trasabilitate)
Location: /srv/quality_app
================================================================================
CONFIGURATION FILES
================================================================================
✓ docker-compose.yml - 171 lines (simplified)
✓ .env - Complete configuration
✓ .env.example - Template for reference
✓ Dockerfile - Application container
✓ docker-entrypoint.sh - Startup script
✓ init-db.sql - Database initialization
================================================================================
ENVIRONMENT VARIABLES (.env)
================================================================================
Database:
DB_HOST=db
DB_PORT=3306
DB_NAME=trasabilitate
DB_USER=trasabilitate
DB_PASSWORD=Initial01!
MYSQL_ROOT_PASSWORD=rootpassword
Application:
APP_PORT=8781
FLASK_ENV=production
VERSION=1.0.0
SECRET_KEY=change-this-in-production
Gunicorn:
GUNICORN_WORKERS=(auto-calculated)
GUNICORN_TIMEOUT=1800
GUNICORN_WORKER_CLASS=sync
GUNICORN_MAX_REQUESTS=1000
Initialization (FIRST RUN ONLY):
INIT_DB=false
SEED_DB=false
Paths:
DB_DATA_PATH=/srv/quality_app/mariadb
LOGS_PATH=/srv/quality_app/logs
BACKUP_PATH=/srv/quality_app/backups
INSTANCE_PATH=/srv/quality_app/py_app/instance
Resources:
App: 2.0 CPU / 1G RAM
Database: 2.0 CPU / 1G RAM
================================================================================
DOCKER SERVICES
================================================================================
1. Database (quality-app-db)
- Image: mariadb:11.3
- Port: 3306
- Volume: /srv/quality_app/mariadb
- Health check: Enabled
2. Application (quality-app)
- Image: trasabilitate-quality-app:1.0.0
- Port: 8781
- Volumes: logs, backups, instance
- Health check: Enabled
Network: quality-app-network (172.20.0.0/16)
================================================================================
REQUIRED DIRECTORIES (ALL EXIST)
================================================================================
✓ /srv/quality_app/mariadb - Database storage
✓ /srv/quality_app/logs - Application logs
✓ /srv/quality_app/backups - Database backups
✓ /srv/quality_app/py_app/instance - Config files
================================================================================
DEPLOYMENT COMMANDS
================================================================================
First Time Setup:
1. Edit .env and set:
INIT_DB=true
SEED_DB=true
SECRET_KEY=<your-secure-key>
2. Build and start:
docker compose up -d --build
3. Watch logs:
docker compose logs -f web
4. After successful start, edit .env:
INIT_DB=false
SEED_DB=false
5. Restart:
docker compose restart web
Normal Operations:
- Start: docker compose up -d
- Stop: docker compose down
- Restart: docker compose restart
- Logs: docker compose logs -f
- Status: docker compose ps
================================================================================
SECURITY CHECKLIST
================================================================================
⚠ BEFORE PRODUCTION:
[ ] Change SECRET_KEY in .env
[ ] Change MYSQL_ROOT_PASSWORD in .env
[ ] Change DB_PASSWORD in .env
[ ] Set INIT_DB=false after first run
[ ] Set SEED_DB=false after first run
[ ] Review firewall rules
[ ] Set up SSL/TLS certificates
[ ] Configure backup schedule
[ ] Test restore procedures
================================================================================
VALIDATION STATUS
================================================================================
✓ Docker Compose configuration valid
✓ All required directories exist
✓ All environment variables set
✓ Network configuration correct
✓ Volume mappings correct
✓ Health checks configured
✓ Resource limits defined
================================================================================
READY FOR DEPLOYMENT ✓
================================================================================