5.3 KiB
5.3 KiB
SerpentRace Production Deployment Guide
Overview
This package contains everything needed to deploy SerpentRace in a production environment using pre-built Docker images.
Package Contents
serpentRaceDocker.tar- All Docker images packed for deploymentdocker-compose.deploy.yml- Production Docker Compose configuration.env.server- Environment variables template for productionload-images.bat- Automated deployment script for Windows serversREADME.md- This deployment guide
System Requirements
- Windows Server 2016+ or Windows 10/11
- Docker Desktop or Docker Engine
- Docker Compose
- Minimum 4GB RAM, 20GB free disk space
- Network ports: 80, 443, 3000, 5432, 6379, 9000, 9001
Pre-Deployment Configuration
1. Environment Variables
Edit .env.server and update the following REQUIRED settings:
# Database - Use a strong password
POSTGRES_PASSWORD=your_strong_database_password
# JWT Security - Use a random 32+ character string
JWT_SECRET=your_super_secret_jwt_key_32_chars_minimum
# Redis Security
REDIS_PASSWORD=your_redis_password
# MinIO Storage
MINIO_ACCESS_KEY=your_minio_admin_user
MINIO_SECRET_KEY=your_minio_secret_key
# Email Configuration (for notifications)
EMAIL_HOST=smtp.yourmailprovider.com
EMAIL_USER=your_email@yourdomain.com
EMAIL_PASS=your_email_password
EMAIL_FROM="SerpentRace <noreply@yourdomain.com>"
# Application URL
APP_BASE_URL=http://your-domain.com
2. Security Checklist
- Changed all default passwords
- Generated strong JWT secret (32+ characters)
- Configured email settings
- Updated domain name in APP_BASE_URL
- Configured firewall rules
- Planned SSL certificate setup
Deployment Steps
Automatic Deployment (Recommended)
- Extract all files to your server directory
- Edit
.env.serverwith your configuration - Run
load-images.bat - Follow the prompts
Manual Deployment
-
Load Docker images:
docker load -i serpentRaceDocker.tar -
Start services:
docker-compose -f docker-compose.deploy.yml --env-file .env.server up -d
Post-Deployment
Verify Services
Check that all services are running:
docker-compose -f docker-compose.deploy.yml ps
Access Points
- Frontend Application: http://localhost (or your domain)
- Backend API: http://localhost:3000
- MinIO Console: http://localhost:9001
- Database: localhost:5432 (internal access only)
Initial Setup
- Access the frontend and verify it loads
- Test user registration and login
- Check backend API health: http://localhost:3000/health
- Access MinIO console to verify storage
Security Hardening
Firewall Configuration
Open only necessary ports:
- Port 80 (HTTP) - Public
- Port 443 (HTTPS) - Public (when SSL configured)
- Ports 3000, 5432, 6379, 9000, 9001 - Internal/VPN only
SSL/TLS Setup
- Obtain SSL certificates (Let's Encrypt, commercial CA)
- Configure nginx for HTTPS in the frontend container
- Update APP_BASE_URL to use https://
Regular Maintenance
- Monitor logs:
docker-compose -f docker-compose.deploy.yml logs -f - Update images periodically
- Backup database and MinIO data
- Monitor disk space and performance
Management Commands
View Logs
# All services
docker-compose -f docker-compose.deploy.yml logs -f
# Specific service
docker-compose -f docker-compose.deploy.yml logs -f backend
Restart Services
# Restart all
docker-compose -f docker-compose.deploy.yml restart
# Restart specific service
docker-compose -f docker-compose.deploy.yml restart backend
Stop Services
docker-compose -f docker-compose.deploy.yml down
Update Deployment
- Stop current services
- Load new images
- Start services with new configuration
Backup Strategy
Database Backup
docker exec serpentrace-postgres pg_dump -U postgres serpentrace > backup_$(date +%Y%m%d).sql
Complete Backup
# Stop services
docker-compose -f docker-compose.deploy.yml down
# Backup volumes
docker run --rm -v postgres_data:/data -v %cd%:/backup ubuntu tar czf /backup/postgres_backup.tar.gz -C /data .
docker run --rm -v minio_data:/data -v %cd%:/backup ubuntu tar czf /backup/minio_backup.tar.gz -C /data .
# Restart services
docker-compose -f docker-compose.deploy.yml up -d
Troubleshooting
Common Issues
Services Not Starting
- Check Docker is running
- Verify port availability
- Check environment variables
- Review logs for specific errors
Database Connection Issues
- Verify POSTGRES_PASSWORD matches in .env.server
- Check database container is healthy
- Ensure network connectivity
Frontend Not Loading
- Check nginx container status
- Verify backend API is responding
- Check browser console for errors
Performance Issues
- Monitor resource usage:
docker stats - Check available disk space
- Review application logs
- Consider scaling if needed
Getting Help
- Check application logs for specific error messages
- Verify all environment variables are set correctly
- Ensure all required ports are available
- Contact support with log files and configuration details
Version Information
- SerpentRace Backend: Latest
- Frontend: Latest
- PostgreSQL: 15-alpine
- Redis: 7-alpine
- MinIO: Latest
- Nginx: Alpine