APP_HOST=0.0.0.0 APP_PORT=8080 APP_PUBLIC_PORT=8080 APP_ENV=lab SESSION_TTL_SECONDS=3600 # Credentials for the local synthetic stand. Never commit a real .env. # Rationale and tradeoffs: REPORT.md, section "Конфигурация и секреты". # POSTGRES_PASSWORD initializes the database volume; DATABASE_URL must use the # same password, otherwise the API cannot connect to an existing volume. POSTGRES_DB=messenger POSTGRES_USER=messenger POSTGRES_PASSWORD=change-me DATABASE_URL=postgresql://messenger:change-me@postgres:5432/messenger REDIS_URL=redis://redis:6379 # Application tuning DATABASE_POOL_MAX=10 DATABASE_CONNECTION_TIMEOUT_MS=5000 DATABASE_STATEMENT_TIMEOUT_MS=5000 CACHE_TTL_SECONDS=30 CACHE_MODE=protected CACHE_LOCK_TTL_MS=1000 CACHE_MISS_DELAY_MS=0 METRICS_TOKEN=change-me # Clean clone (run once, then `docker compose --env-file .env up -d --build`): # cp .env.example .env # password=$(openssl rand -hex 32) # sed -i "s/^POSTGRES_PASSWORD=.*/POSTGRES_PASSWORD=$password/" .env # sed -i "s|^DATABASE_URL=.*|DATABASE_URL=postgresql://messenger:$password@postgres:5432/messenger|" .env # sed -i "s/^METRICS_TOKEN=.*/METRICS_TOKEN=$(openssl rand -hex 16)/" .env # unset password # # Existing postgres-data keeps its original password: changing POSTGRES_PASSWORD # alone does not rotate it. Update DATABASE_URL to the volume's password, or # rotate the password inside PostgreSQL explicitly. # # Alternative for docker-secrets or Swarm deployments: point DATABASE_URL_FILE / # REDIS_URL_FILE at mounted secret files instead of inline URLs. The application # reads the file, trims it, and validates it exactly like an inline value. # Optional file-based secret override (uncomment to use): # DATABASE_URL_FILE=/run/secrets/database_url # REDIS_URL_FILE=/run/secrets/redis_url