<commit_before># armada
Multi-server deployment automation for the DigitalOcean API<commit_msg>Add example usage to README<commit_after># armada
Multi-server deployment automation for the DigitalOcean API

Armada is a tool to quickly create and boot multiple servers matching a
common criteria on DigitalOcean without significant overhead from
learning and configuring a larger automation framework.

## TODO

* Setup DNS records for each created host in the cluster
* Setup DNS domain for the domain if it does not exist
* Create ssh key's via API if they don't exist
* Add consistent error handling and usage printing
* Add error handling for missing DIGITALOCEAN_TOKEN

## Setup

```sh
$ gem install droplet_kit
$ chmod +x armada.rb
$ mv armada.rb ~/bin (optional)
$ export DIGITALOCEAN_TOKEN=YOUR_TOKEN_HERE
$ armada.rb <options> (list|deploy|sink) <arguments>
```

## Examples

### Get help menu

```sh
$ armada.rb -h
Usage: armada.rb <options> (list|deploy|sink) <arguments>
    -n, --number N                   Number of droplets to create
    -s, --size N                     Size of droplets to create
    -i, --image N                    Image of droplets to create
    -r, --region N                   Region to create droplets in
    -k, --ssh-keys X,Y,Z             Comma delimited public key fingerprints
    -d, --domain N                   Domain name for droplet hostnames
    -v, --verbose                    Display extra info on what is happening
    -h, --help                       Display this screen
```

### List parameter options from DigitalOcean

```sh
$ armada list sizes
$ armada list regions
$ armada list images
$ armada list ssh_keys
```

### Create and bootup a group of droplets to your specifications

```sh
$ armada -v -n 5 -s 512mb -i freebsd-10-1-x64 -r nyc3 \
  -k fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b:92:c3:7b:3e:b1:c2:a7:11 -d example.com deploy hadooped
  
Created droplet hadooped0.example.com
Created droplet hadooped1.example.com
Created droplet hadooped2.example.com
Created droplet hadooped3.example.com
Created droplet hadooped4.example.com
2015-08-25 14:32:31 -0400: Waiting for fleet to sail...
2015-08-25 14:32:39 -0400: Waiting for fleet to sail...
2015-08-25 14:32:46 -0400: Waiting for fleet to sail...
2015-08-25 14:32:53 -0400: Waiting for fleet to sail...
2015-08-25 14:33:01 -0400: Waiting for fleet to sail...
2015-08-25 14:33:09 -0400: Waiting for fleet to sail...
2015-08-25 14:33:17 -0400: Waiting for fleet to sail...
2015-08-25 14:33:25 -0400: Waiting for fleet to sail...
2015-08-25 14:33:32 -0400: Waiting for fleet to sail...
Deployed hadooped0.example.com to 172.16.31.10 DropletID: 6830389
Deployed hadooped1.example.com to 172.16.58.3 DropletID: 6830390
Deployed hadooped2.example.com to 172.16.58.3 DropletID: 6830391
Deployed hadooped3.example.com to 172.16.58.3 DropletID: 6830393
Deployed hadooped4.example.com to 172.16.58.3 DropletID: 6830394
```

### Created droplets are enumerated with name and domain like:

```sh
$ armada list droplets | grep hadooped

hadooped0.example.com
hadooped1.example.com
hadooped2.example.com
hadooped3.example.com
hadooped4.example.com
```

### Destroy droplets whose hostnames match a given regular expression

```sh
$ armada sink ^hadooped

Destroying droplet: 6830389 (hadooped0.example.com)
Destroying droplet: 6830390 (hadooped1.example.com)
Destroying droplet: 6830391 (hadooped2.example.com)
Destroying droplet: 6830393 (hadooped3.example.com)
Destroying droplet: 6830394 (hadooped4.example.com)
```
{'fraction_non_alphanumeric': 0.09607731665719159, 'fraction_numerical': 0.09437180216031836, 'mean_word_length': 3.4487989886219976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2903624', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1150, 'n_words': 400}