3.2 KiB
3.2 KiB
Environment Configuration Guide
Development Environment
For development, use the default docker-compose.yml:
cd docker
docker-compose up -d
Default Credentials (Development)
- Admin Username:
admin - Admin Password:
admin123 - Database:
tournament - Database User:
tournament_user - Database Password:
tournament_password
Production Environment
For production deployment, use docker-compose.prod.yml:
cd docker
./deploy.sh
Environment Variables (Production)
Create a .env file in the docker directory with the following variables:
# Database Configuration
POSTGRES_PASSWORD=your_secure_postgres_password_here
# Application Configuration
JWT_SECRET=your_super_secure_jwt_secret_here_make_it_long_and_random
ADMIN_USERNAME=admin
ADMIN_PASSWORD=your_secure_admin_password_here
ADMIN_EMAIL=admin@yourdomain.com
# Optional: Custom domain for SSL
DOMAIN=yourdomain.com
Security Checklist for Production
- Change
POSTGRES_PASSWORDto a strong password - Change
JWT_SECRETto a long, random string - Change
ADMIN_PASSWORDto a secure password - Update
ADMIN_EMAILto a valid email address - Configure SSL certificates (optional)
- Set up proper firewall rules
- Configure backup strategy
- Set up monitoring and logging
SSL Configuration
To enable HTTPS:
- Create an
ssldirectory in the docker folder - Add your SSL certificates:
ssl/cert.pem- SSL certificatessl/key.pem- Private key
- Uncomment the HTTPS section in
nginx.conf - Update the domain name in
nginx.conf
Backup and Restore
Database Backup
docker-compose exec postgres pg_dump -U tournament_user tournament > backup.sql
Database Restore
docker-compose exec -T postgres psql -U tournament_user tournament < backup.sql
Full Application Backup
# Backup volumes
docker run --rm -v tournament_postgres_data:/data -v $(pwd):/backup alpine tar czf /backup/postgres_backup.tar.gz -C /data .
Monitoring
Health Checks
- Application:
http://localhost/health - Database: Built into docker-compose
- Nginx: Built into docker-compose
Logs
# View all logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f tournament-app
docker-compose logs -f postgres
docker-compose logs -f nginx
Scaling
The application can be scaled horizontally:
docker-compose up -d --scale tournament-app=3
Note: You'll need to configure a load balancer (like nginx) to distribute traffic across multiple instances.
Troubleshooting
Common Issues
- Port conflicts: Change ports in docker-compose.yml
- Database connection issues: Check if PostgreSQL is running and healthy
- Build failures: Ensure all dependencies are properly installed
- Permission issues: Check file permissions and ownership
Debug Commands
# Check container status
docker-compose ps
# Access application shell
docker-compose exec tournament-app sh
# Check database connection
docker-compose exec postgres psql -U tournament_user -d tournament
# View nginx configuration
docker-compose exec nginx nginx -t