https://github.com/Integral-Systems/swarm-pilot
https://github.com/Integral-Systems/swarm-pilot
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/Integral-Systems/swarm-pilot
- Owner: Integral-Systems
- License: gpl-3.0
- Created: 2025-04-23T10:34:11.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2025-04-24T08:09:23.000Z (about 1 month ago)
- Last Synced: 2025-05-02T09:32:30.744Z (23 days ago)
- Language: TypeScript
- Size: 319 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-swarm - Swarm pilot - Scale Serices up/down by CPU & Memory Usage (Community Tools / Extra Functionality)
README

# Swarm Pilot
Swarm Pilot is a Docker Swarm cluster management tool designed to simplify and automate the scaling of services based on resource usage. It monitors CPU and memory usage across your services and dynamically adjusts the number of replicas to ensure optimal performance and resource utilization.
## **Features**
- **Autoscaling**: Automatically scales services up or down based on CPU and memory usage.
- **Service-Level Configuration**: Customize scaling behavior using service-specific labels.
- **Lightweight and Efficient**: Runs as a Docker container within your Swarm cluster.## Getting Started
### Prerequisites
- A running Docker Swarm cluster.
- Docker version 20.10 or later.
- Prometheus with cadvisor needed for service metrics.
### Example DeploymentBelow is an example deployment configuration for Swarm Pilot using a `docker-compose.yml` file:
```yaml
services:
swarm-pilot:
image: gradlon/swarm-pilot:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- DEBUG=false
- PROM_HOST=prometheus.int.integral-systems.ch
- PROM_USER=${PROM_USER}
- PROM_PASS=${PROM_PASS}
- PROM_PORT=443
- PROM_SCHEMA=https
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
- BATCH_SIZE=5
- AUTOSCALER_INTERVAL=${AUTOSCALER_INTERVAL:-5}
- ENABLE_AUTOSCALER_LABEL=swarm.autoscaler
- AUTOSCALER_MINIMUM_CPU_LABEL=swarm.autoscaler.minimum_cpu
- AUTOSCALER_CPU_MINIMUM_DEFAULT=${AUTOSCALER_CPU_MINIMUM:-25}
- AUTOSCALER_MAXIMUM_CPU_LABEL=swarm.autoscaler.maximum_cpu
- AUTOSCALER_MAXIMUM_CPU_DEFAULT=${AUTOSCALER_CPU_MAXIMUM:-85}
- AUTOSCALER_MINIMUM_MEM_LABEL=swarm.autoscaler.minimum_mem
- AUTOSCALER_MEM_MINIMUM_DEFAULT=${AUTOSCALER_MEM_MINIMUM:-25}
- AUTOSCALER_MAXIMUM_MEM_LABEL=swarm.autoscaler.maximum_mem
- AUTOSCALER_MAXIMUM_MEM_DEFAULT=${AUTOSCALER_MEM_MAXIMUM:-85}
- AUTOSCALER_MIN_REPLICAS_LABEL=swarm.autoscaler.min_replicas
- AUTOSCALER_MIN_REPLICAS_DEFAULT=1
- AUTOSCALER_MAX_REPLICAS_LABEL=swarm.autoscaler.max_replicas
- AUTOSCALER_MAX_REPLICAS_DEFAULT=10
networks:
- default
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
resources:
limits:
cpus: '0.10'
memory: 128M
reservations:
cpus: '0.10'
memory: 64M
```To deploy this configuration, save it to a file named `docker-compose.yml` and run:
```bash
docker stack deploy -c docker-compose.yml swarm-manager
```
### Planned Features
- **Node Rebalancing**: Automatically redistribute services across nodes to ensure even resource utilization and reduce bottlenecks.
- **Node Scaling/Provisioning/Decommissioning (Hetzner)**: Dynamically add or remove nodes in the cluster based on workload demands, leveraging Hetzner's infrastructure.