DigitalOcean Autoscale is a tool to automatic scale your infrastructure on Digital Ocean.
DigitalOcean Autoscale runs in a master server that can be used as LoaBalance too. The service will check in every 5 minutes the server's health, if the CPU usage average is more than 80%, DG AutoScale will create a new droplet and register in the LoadBalance. If the CPU usage average is lower than 20%, the service will down one droplet.
Just clone this repository:
git clone git@github.com:sergiovilar/digitalocean-autoscale.git
- Vagrant
- Git
- Php 5.3+
-
To start using DigitalOcean Autoscale you need to create a VM using Puphpet and select Digital Ocean in the first page. Configure your machine and download the .zip containing all the machine configuration.
-
You'll need to do some changes in the
puphpet/config.yaml
file like this example, add the ${token} and ${hostname} variables to your file and save. -
Assuming that the previous code generated by puphpet and modified by you are in a git repository, you'll need to create a
boxes.json
file following the example onboxes.json.sample
. This file specifies the repository to clone and to start the machine, you need to fill your DigitalOcean token too. -
To your master server connect to the slaves, you need to create a SSH key in your master server and register in DigitalOcean with "Vagrant" name, run this command to :
ssh-keygen -t rsa
To get the generated key, run this command and copy the output.
cat ~/.ssh/id_rsa.pub
Go to your Account on Digital Ocean > SSH Keys and add a new with the content that you copied and the Vagrant as name.
Before run the service is recommended to disable your know_hosts checking.
Just run:
php src/initialize.php
If you like to run in a server over ssh, run:
./run.sh
Please, if you have any questions, open a issue.