Vagrant

vagrant up and boom, done. It spins up a virtual machine for your to play around in. You have your entire development environment.
I don’t like pre-baked vagrant boxes. I usually use vanilla ubuntu and use a provisioner tool like ansible or some simple shell scripts.
If you have lots of dependent services, then this will get complicated quickly. A project of mine requires an ES host, redis, mongodb, and the web application itself.
We ended up using docker-compose to bring up that stack very quickly. You could run those in a multi-box vagrant setup, but that means running 4 VMs at once.

Packer

Image creation is a numbing task if you have to do it a lot. Most people create automated scripts to do the provisioning part, but they still create the VM’s and capture the image manually. That’s where Packer comes in.
If you want an AWS AMI, Packer will:
- Spin up an instance
- Create the temporary security group and SSH keys
- Provision your application (chef, ansible, scripts, etc…)
- Save the AMI
- Destroy what it created to save the AMI

I first used Packer to create qcow2 images from a base Ubuntu ISO and upload the image to proxmox.

It can also control state cross-provider. You can create machines in AWS, run services in GCE, and update your DNS in DNSimple.

Jenkins

Most web-based repository managers like Gitlab have webhooks or plugins to a CI server like Jenkins. To do your application testing, just add the webhook and setup your task on the CI to run on merge requests.

As for deployment, you can have it trigger on tag pushes or leave out the webook all together.

Closing Thoughts

I like that this pipeline isn’t married to any cloud solution or configuration management framework.
Packer can create vmdk images using chef and Terraform can create the infrastructure and launch the VM on Vsphere. In experimentation I’ve used Packer to create Docker images and used Terraform to load them onto a container cluster in Google Compute Engine.

I still can’t figure out how to manage secrets properly. I’ve been using Hashicorp’s Vault, but I’ve been having weird errors. Another blog post for another time.

The tools are changing every day in this field. I’m looking at otto right now. A month after this blog post I could be using an entirely different pipeline.

Want to tell me this is a stupid way of deploying? Email or hit me up on twitter @thatarchguy