Replica Configuration
Current Replica Distribution:
# High availability services
tracker-prod_tracker-app: 3 replicas (worker nodes)
portainer_agent: global (all nodes)
# Single instance services
traefik_traefik: 1 replica (manager)
postgresql17_postgres: 1 replica (manager)
authentik_server: 1 replica (manager)
nextcloud_nextcloud: 1 replica (manager)
paperless_webserver: 1 replica (manager)
Scaling Commands:
# Scale service up
docker service scale service-name=5
# Scale multiple services
docker service scale service1=3 service2=2
# Scale to zero (maintenance)
docker service scale service-name=0
# Auto-scaling based on load (manual implementation)
# Monitor CPU/memory and scale accordingly
Scaling Considerations:
- Stateful services: Cannot be scaled (databases, authentication)
- Stateless services: Can be horizontally scaled
- Storage dependencies: Services with bind mounts limited to storage node
Resource Limits and Reservations
Adding Resource Constraints:
# Example resource configuration
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
Current Resource Usage(No explicit limits set):
- Services rely on Docker’s default resource sharing
- Manager node handles resource-intensive workloads
- Worker nodes balanced for application processing
Resource Monitoring:
# Check node resource usage
docker node ls
docker node inspect node-name
# Service resource consumption
docker stats
# System resource overview
docker system df
docker system events
Performance Monitoring
Built-in Monitoring Tools:
- Uptime Kuma: Service availability monitoring
- Portainer: Resource usage visualization
- Docker stats: Real-time container metrics
Manual Monitoring Commands:
# Service performance
docker service ps service-name
# Container resource usage
docker stats --no-stream
# Network statistics
docker network ls
docker network inspect network-name
# Volume usage
docker system df -v