tl;dr Quickly spin up multiple VMs with useful DNSs on your local machine and automate complex environments easily. Here’s a video: _Recorded by ianmiell_asciinema.org Multinode VM Setup Introduction Maintaining at scale, I’m more frequently concerned with clusters of VMs than the containers themselves. Docker The irony of this is not lost on me. Frequently I need to spin up clusters of machines. Either this is very slow/unreliable (Enterprise OpenStack implementation) or expensive (Amazon). The obvious answer to this is to use Vagrant, but this can be challenging. managing So I present here a very easy way to set up a useful Vagrant cluster. With this framework, you can then automate your ‘real’ environment and play to your heart’s content. $ $ pip install shutit shutit skeleton # Input a name for this module.# Default: /Users/imiell/shutit_resins [hit return to take default] # Input a ShutIt pattern.Default: bashbash: a shell scriptdocker: a docker image buildvagrant: a vagrant setupdocker_tutorial: a docker-based tutorialshutitfile: a shutitfile-based project [type in vagrant] vagrant How many machines do you want (default: 3)? 3 [hit return to take default] What do you want to call the machines (eg superserver) (default: machine)? [hit return to take default] Do you want to have open ssh access between machines? (default: yes) yes Initialized empty Git repository in /Users/imiell/shutit_resins/.git/Cloning into ‘shutit-library’...remote: Counting objects: 1322, done.remote: Compressing objects: 100% (33/33), done.remote: Total 1322 (delta 20), reused 0 (delta 0), pack-reused 1289Receiving objects: 100% (1322/1322), 1.12 MiB | 807.00 KiB/s, done.Resolving deltas: 100% (658/658), done.Checking connectivity… done. # Run:cd /Users/imiell/shutit_resins && ./run.shto run. [follow the instructions to run up your cluster. $ cd /Users/imiell/shutit_resins && ./run.sh This will automatically run up an n-node cluster and then finish up. NOTE: Make sure you have enough resources on your machine to run this! BTW, if you re-run the run.sh it automatically clears up previous VMs spun up by the script to prevent your machine grinding to a halt with old machines. _Recorded by ianmiell_asciinema.org Multinode VM Setup Going deeper What you can do from there is automate the setup of these nodes to your needs. For example: def build(self, shutit):[... go to end of this function ...] # Install apacheshutit.login(command='vagrant ssh machine1')shutit.login(command='sudo su - ')shutit.install('apache2')shutit.logout()shutit.logout() # Go to machine2 and call machine1's servershutit.login(command='vagrant ssh machine2')shutit.login(command='sudo su -')shutit.install('curl')shutit.send('curl machine1.vagrant.test')shutit.logout()shutit.logout() Will set up an apache server and curl a request to the first machine from the second. Examples This is obviously a simple example. I’ve used this for these more complex setups which are can be instructive and useful: Chef server and client Creates a chef server and client. _shutit-chef-env - Chef server within vagrant automatically set up_github.com ianmiell/shutit-chef-env Docker Swarm Creates a 3-node docker swarm _Contribute to shutit-library development by creating an account on GitHub._github.com ianmiell/shutit-library OpenShift Cluster This one sets up a full OpenShift cluster, setting it up using the standard ansible scripts. _shutit-openshift-cluster - Vagrant-based standup of an OpenShift Origin cluster using ansible_github.com ianmiell/shutit-openshift-cluster Automation of an etcd migration on OpenShift This branch of the above code sets up OpenShift using the alternative Chef scripts, and migrates an etcd cluster from one set of nodes to another. _shutit-openshift-cluster - Vagrant-based standup of an OpenShift Origin cluster using ansible_github.com ianmiell/shutit-openshift-cluster Docker Notary Setting up of a Docker notary sandbox. _Contribute to shutit-notary-trust-sandbox development by creating an account on GitHub._github.com ianmiell/shutit-notary-trust-sandbox Help Wanted If you have a need for an environment, or can improve the setup of any of the above please let me know: @ianmiell Learn More My book : Docker in Practice Get 39% off with the code: 39miell