I have been working with DigitalOcean for several months, on average DigitalOcean deploys your VPS server in 55 seconds. After the server is deployed, all the manual/prone to errors/boring configuration process is needed.
As I am using puppet to configure all my servers I have create provisioningDO rakefile script (based on John Arundel’s book Puppet 3 Cookbook) to deploy and configure my servers in 4 min 15 sec. It means After 4 min 15 secs, my servers are ready for production.
provisioningDO uses Jack Pearkes’ tugboat CLI tool so, a fully installed and configured tugboat CLI is necessary. It shouldn’t take you more than 5-10 minutes to have a working and ready to go tugboat installation 🙂
Script can be downloaded from my github repository provisioningDO or in a zip format provisioningDO.zip
The scripts accomplishes the following:
- Deploys a new VPS instance (or droplet as it is called on DigitalOcean)
- Generates the SSL certificates and copy them to the droplet.
- Upgrades S.O and configures the puppet client.
- Finally runs the puppet client once, so your server will achieve the desired state configured in your puppet manifests.
provisioningDo rakefile supports severals variables to customize your droplet and your puppet client configuration:
SERVER eg: vps1.example.com
DOMAIN eg: example.com
ENVIRONMENT eg: production/test/QA # This is the puppet client environment
REGION eg: 1 # for NY1
SIZE eg: 66 # default for a 512 droplet
IDTEMPLATE should be 303619 for a i386 or 308287 for a amd64 Debian image
To deploy a new i386 server:
ENVIRONMENT=production REGION=1 SIZE=66 SERVER=vps1.example.com DOMAIN=example.com rake droplet_deploy
To decommission a server:
SERVER=vps1.example.com DOMAIN=example.com rake droplet_decommission
Now that all the explanation is done. Let’s see how it works:
And after 4m15secs the server is fully functional with puppet modules applied.
- In only one line a fully server is deployed and configured in less than 5 minutes.
- At this moment only Debian droplets can be deployed (i386 & amd64). With few changes this rakefile can be adapted to deploy Ubuntu images too (for next release) and with some extra work to the rest of Linux distributions.
You may think that 5 minutes is too much for giving a proper service level, and some other strategies should be adapted. I may agree but please note that it is not necessary to wait till last moment to deploy a server. Having a pool of spare (ready to go) servers could be better solution. Even more seeing the DigitalOcean’s prices table:
(Taken from https://www.digitalocean.com/pricing)
1 GB RAM /1 CPU / 30GB SSD Disk / 2 TB transfer $0.015 per hour
2 GB RAM / 2 CPUs / 40 GB SSD Disk / 3 TB transfer $0.030 per hour
16 GB RAM / 8CPUs / 160 GB SSD Disk / 6 TB transfer $0.238 per hour
For a only few cents you can have several servers waiting to enter into production. It’s up to you.
Another approach could be have a customized golden image (DigitalOcean supports it) with the O.S upgrades applied and the puppet client already installed. So only the SSL certificates part would be needed. This approach could launch a server in around 2 minutes. But it has, in my opinion a BIG problem: “YOU have to maintain the golden image”. It means:
- Every time the O.S has an upgrade pending, the golden image must be upgraded too.
- A golden image is needed in every datacenter (at this moment DigitalOcean has 3 actives) What happens if in a near future it grows to 5 or 8 and you need to manage golden images in more and more datacenters?
I prefer use DigitalOcean‘s basic images and deploy all from scratch, so with only one tool I can deploy servers in several to many datacenters. 🙂
Nice article, I’m going to try it, just noticed that the link to jugboat it not correct, it’s https://github.com/pearkes/tugboathttp://jack.ly/, probably it should be https://github.com/pearkes/tugboat. Thanks & good luck!
Link fixed 🙂