Skip to content

juasiepo/tugboat

 
 

Repository files navigation

Tugboat

Build Status Coverage Status

A command line tool for interacting with your DigitalOcean droplets.

Installation

gem install tugboat

Configuration

Run the configuration utility, tugboat authorize. You can grab your keys here.

$ tugboat authorize
Enter your client key: foo
Enter your API key: bar
Enter your SSH key path (optional, defaults to ~/.ssh/id_rsa):
Enter your SSH user (optional, defaults to jack):
Enter your SSH port number (optional, defaults to 22):
Authentication with DigitalOcean was successful!

Usage

Retrieve a list of your droplets

$ tugboat droplets
pearkes-web-001 (ip: 30.30.30.1, status: active, region: 1, id: 13231511)
pearkes-admin-001 (ip: 30.30.30.3, status: active, region: 1, id: 13231512)
pearkes-api-001 (ip: 30.30.30.5, status: active, region: 1, id: 13231513)

Fuzzy name matching

You can pass a unique fragment of a droplets name for interactions throughout tugboat.

$ tugboat restart admin
Droplet fuzzy name provided. Finding droplet ID...done, 13231512 (pearkes-admin-001)
Queuing restart for 13231512 (pearkes-admin-001)...done

tugboat handles multiple matches as well:

$ tugboat restart pearkes
Droplet fuzzy name provided. Finding droplet ID...Multiple droplets found.

0) pearkes-web-001  (13231511)
1) pearkes-admin-001 (13231512)
2) pearkes-api-001 (13231513)

Please choose a droplet: ["0", "1", "2"] 0
Queuing restart for 13231511 (pearkes-web-001)...done

SSH into a droplet

You can configure an SSH username and key path in tugboat authorize, or by changing your ~/.tugboat.

This lets you ssh into a droplet by providing it's name, or a partial match.

$ tugboat ssh admin
Droplet fuzzy name provided. Finding droplet ID...done, 13231512 (pearkes-admin-001)
Executing SSH (pearkes-admin-001)...
Welcome to Ubuntu 12.10 (GNU/Linux 3.5.0-17-generic x86_64)
pearkes@pearkes-admin-001:~#

Create a droplet

$ tugboat create pearkes-www-002 -s 64 -i 2676 -r 2 -k 11251
Queueing creation of droplet 'pearkes-www-002'...done

Info about a droplet

$ tugboat info admin
Droplet fuzzy name provided. Finding droplet ID...done, 13231512 (pearkes-admin-001)

Name:             pearkes-admin-001
ID:               13231512
Status:           active
IP:               30.30.30.3
Region ID:        1
Image ID:         25489
Size ID:          66
Backups Active:   false

Destroy a droplet

$ tugboat destroy pearkes-www-002
Droplet fuzzy name provided. Finding droplet ID...done, 13231515 (pearkes-www-002)
Warning! Potentially destructive action. Please confirm [y/n]: y
Queuing destroy for 13231515 (pearkes-www-002)...done

Restart a droplet

$ tugboat restart admin
Droplet fuzzy name provided. Finding droplet ID...done, 13231512 (pearkes-admin-001)
Queuing restart for 13231512 (pearkes-admin-001)...done

Shutdown a droplet

$ tugboat halt admin
Droplet fuzzy name provided. Finding droplet ID...done, 13231512 (pearkes-admin-001)
Queuing shutdown for 13231512 (pearkes-admin-001)...done

Snapshot a droplet

$ tugboat snapshot test-admin-snaphot admin
Queuing snapshot 'test-admin-snapshot' for 13231512 (pearkes-admin-001)...done

Resize a droplet

$ tugboat resize admin -s 66
Queuing resize for 13231512 (pearkes-admin-001)...done

List Available Images

You can list images that you have created.

$ tugboat images
My Images:
pearkes-admin-001 2013-05-19 (id: 13231512, distro: Ubuntu)
....

Optionally, list images provided by DigitalOcean as well.

$ tugboat images --global
My Images:
pearkes-admin-001 2013-05-19 (id: 13231512, distro: Ubuntu)
....
Global Images:
CentOS 5.8 x64 (id: 1601, distro: CentOS)
...

List Available Sizes

$ tugboat sizes
Sizes:
512MB (id: 66)
1GB (id: 63)
...

List Available Regions

$ tugboat regions
Regions:
New York 1 (id: 1)
Amsterdam 1 (id: 2)
San Francisco 1 (id: 3)

List SSH Keys

$ tugboat keys
Keys:
pearkes (id: 10501)
...

Wait for Droplet State

Sometimes you want to wait for a droplet to enter some state, for example "off".

$ tugboat wait admin --state off
Droplet fuzzy name provided. Finding droplet ID...done, 13231512 (pearkes-admin-001)
Waiting for droplet to become off....
...

This will simply block until the droplet returns a state of "off". A period will be printed after each request.

Help

If you're curious about command flags for a specific command, you can ask tugboat about it.

$ tugboat help restart

For a complete overview of all of the available commands, run:

$ tugboat help

Contributing

See the contributing guide.

About

A command line tool for interacting with your DigitalOcean droplets.

Resources

License

Stars

Watchers

Forks

Packages

No packages published