Skip to content

Scales up or down services bases on CPU usage.

License

Notifications You must be signed in to change notification settings

Romainlg29/docker-auto-scaling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker auto scaling

An automatic python script that scales up or down services based on CPU usage.

Thresholds: < 30% on average service will scale down and 70% > will scale up

Installation

To run this script, you must install the following packages.

  apt install python3
  pip install docker

Usage/Examples

# Using once

python3 auto-scaling.py
# Using every X seconds

python3 auto-scaling.py -t 30
# Using CRON
# It'll run every minutes

*     *     *     *     *         python3 auto-scaling.py
# Using TIMER
# It'll run every minutes

#scaling.service
[Unit]
Description=Docker scaling script

[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /.../auto-scaling.py

#scaling.timer
[Unit]
Description=Docker scaling script

[Timer]
OnCalendar=*-*-* *:*:00

[Install]
WantedBy=timers.target

# CLI
systemctl enable /.../scaling.timer

About

Scales up or down services bases on CPU usage.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages