This directory contains Docker configurations for deploying RepoRadar in different modes.
File: docker-compose.performance.yml
Single instance deployment optimized for performance with monitoring capabilities.
Features:
- Single application instance
- PostgreSQL database
- Redis for caching and sessions
- Optional Grafana for monitoring
- Performance optimizations enabled
Usage:
docker-compose -f docker/docker-compose.performance.yml up -dFile: docker-compose.multi-instance.yml
Production-ready deployment with multiple instances behind a load balancer.
Features:
- 3 application instances (configurable)
- Nginx load balancer with health checks
- Redis for shared session storage
- PostgreSQL with connection pooling
- Optional Redis replication for HA
- Automatic failover support
Usage:
# Standard deployment
npm run deploy:multi
# High availability mode
npm run deploy:multi:ha
# Windows
npm run deploy:multi:windowsSee: Multi-Instance Deployment Guide
docker/
├── docker-compose.performance.yml # Single instance configuration
├── docker-compose.multi-instance.yml # Multi-instance configuration
├── Dockerfile.performance # Optimized production Dockerfile
├── .env.multi-instance.example # Environment template for multi-instance
├── nginx/ # Nginx load balancer configuration
│ ├── nginx.conf # Main Nginx configuration
│ └── conf.d/
│ └── sticky-sessions.conf.example # Optional sticky sessions config
├── redis/ # Redis configuration
│ └── sentinel.conf # Redis Sentinel for HA
└── postgres/ # PostgreSQL configuration
└── postgresql.conf # PostgreSQL tuning
.env.multi-instance.example: Template for multi-instance deployment- Copy to
.env.multi-instanceand configure - Set secure passwords and secrets
- Configure GitHub token
- Copy to
-
nginx/nginx.conf: Main load balancer configuration- Load balancing strategy: least connections
- Health check integration
- WebSocket support
- Gzip compression
-
nginx/conf.d/sticky-sessions.conf.example: Optional sticky sessions- Use if Redis sessions are not available
- IP-based session affinity
redis/sentinel.conf: Redis Sentinel for automatic failover- Monitors Redis master
- Automatic promotion of replicas
- Used in HA mode only
# Copy environment file
cp .env.example .env
# Configure environment
# Edit .env and set required variables
# Deploy
docker-compose -f docker/docker-compose.performance.yml up -d# Copy environment file
cp docker/.env.multi-instance.example docker/.env.multi-instance
# Configure environment
# Edit docker/.env.multi-instance and set:
# - POSTGRES_PASSWORD
# - SESSION_SECRET
# - SESSION_ENCRYPTION_KEY
# - GITHUB_TOKEN
# Deploy
npm run deploy:multi
# Or manually
docker-compose -f docker/docker-compose.multi-instance.yml \
--env-file docker/.env.multi-instance up -d# List running services
docker-compose -f docker/docker-compose.multi-instance.yml ps
# View logs
docker-compose -f docker/docker-compose.multi-instance.yml logs -f
# Check health
curl http://localhost/healthnpm run verify:multiThis script tests:
- Instance health checks
- Load distribution
- Session persistence
- Health endpoints
Add more instances:
docker-compose -f docker/docker-compose.multi-instance.yml \
up -d --scale reporadar-1=5Note: Update nginx/nginx.conf to include new instances in the upstream block.
Edit resource limits in docker-compose.multi-instance.yml:
deploy:
resources:
limits:
memory: 4G
cpus: '2.0'- Load Balancer:
http://localhost/health - Backend:
http://localhost/health/backend - Readiness:
http://localhost/health/ready - Liveness:
http://localhost/health/live
# All services
docker-compose -f docker/docker-compose.multi-instance.yml logs -f
# Specific service
docker-compose -f docker/docker-compose.multi-instance.yml logs -f nginx
docker-compose -f docker/docker-compose.multi-instance.yml logs -f reporadar-1# Nginx status
curl http://localhost/nginx_status
# Redis info
docker-compose -f docker/docker-compose.multi-instance.yml \
exec redis-master redis-cli info- Check logs:
docker-compose -f docker/docker-compose.multi-instance.yml logs- Verify environment variables:
docker-compose -f docker/docker-compose.multi-instance.yml config- Check port conflicts:
netstat -an | grep -E ':(80|443|5432|6379)'- Test instance directly:
docker-compose -f docker/docker-compose.multi-instance.yml \
exec reporadar-1 curl http://localhost:3000/health- Check database connection:
docker-compose -f docker/docker-compose.multi-instance.yml \
exec postgres psql -U reporadar -c "SELECT 1"- Check Redis connection:
docker-compose -f docker/docker-compose.multi-instance.yml \
exec redis-master redis-cli pingWARNING: This deletes all data!
docker-compose -f docker/docker-compose.multi-instance.yml down -v
docker-compose -f docker/docker-compose.multi-instance.yml up -dBefore deploying to production:
- Set strong passwords and secrets
- Configure SSL/TLS certificates
- Enable Redis replication (HA mode)
- Set up automated backups
- Configure monitoring and alerting
- Test failover scenarios
- Document disaster recovery
- Set up log aggregation
- Configure firewall rules
- Enable rate limiting
For issues or questions:
- Check the troubleshooting section
- Review logs for error messages
- Consult the documentation guides
- Open an issue on GitHub