Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sergiopvilar/digitalocean-autoscale

A project to autoscale DigitalOcean cloud servers using Puphpet and Vagrant
https://github.com/sergiopvilar/digitalocean-autoscale

Last synced: about 1 month ago
JSON representation

A project to autoscale DigitalOcean cloud servers using Puphpet and Vagrant

Awesome Lists containing this project

README

        

# DigitalOcean Autoscale

DigitalOcean Autoscale is a tool to automatic scale your infrastructure on Digital Ocean.

# How it works

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.

# Installation

Just clone this repository:

git clone [email protected]:sergiovilar/digitalocean-autoscale.git

## Requirements

* Vagrant
* Git
* Php 5.3+

# Usage

## Machine configuration

1. To start using DigitalOcean Autoscale you need to create a VM using [Puphpet](https://puphpet.com/) and select *Digital Ocean* in the first page. Configure your machine and download the .zip containing all the machine configuration.

2. You'll need to do some changes in the `puphpet/config.yaml` file like [this example](https://github.com/sergiovilar/dg-application-server/blob/master/puphpet/config.yaml), add the ${token} and ${hostname} variables to your file and save.

3. 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 on `boxes.json.sample`. This file specifies the repository to clone and to start the machine, you need to fill your DigitalOcean token too.

4. 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.

## Running the service

Before run the service is recommended to disable your [know_hosts checking](http://www.joedog.org/2012/07/ssh-disable-known_hosts-prompt/).

Just run:

php src/initialize.php

If you like to run in a server over ssh, run:

./run.sh

# Support

Please, if you have any questions, [open a issue](https://github.com/sergiovilar/digitalocean-autoscale/issues).