Automation framework for programmers

View project onGitHub


Automation framework for programmers.


Many more examples explained here:

Step 1: Get ShutIt

[sudo] pip install shutit

Run the above as root, and ensuring python-pip and docker are already installed.

Step 2: Create a Skeleton bash ShutIt Module

As your preferred user:

shutit skeleton

Hit return through and follow the instructions.

Step 3: Automate

Go to the newly-created directory, and open up the .py file.

In there is a function called ‘build’ with a cheat sheet of functions.

For this example we are going to add commands to ensure that we have a the documentation branch of ShutIt checked out.

# Ensure git is installed. This handles different distros gracefully.

# If the directory does not exist, we create it
if not shutit.file_exists('/opt/shutit',directory=True):
	shutit.send('mkdir /opt/shutit')

# Move to the directory
shutit.send('cd /opt/shutit')

# If this is not ShutIt, quit with a message.
if shutit.file_exists('.git',directory=True):
	if shutit.send_and_get_output('git remote -v | grep origin | grep push | grep ianmiell.shutit | wc -l') != '1':'Git repo detected that is not ShutIt - terminating')
	# If this is not a git repo, and there are any files in here, we have a problem
	if shutit.send_and_get_output('ls') != '':'Not a git repo, and there are other files already in here - terminating')

# Get the branch information
branch = shutit.send_and_get_output("git status -s -b | grep '##' | awk '{print $2}' | awk -F. '{print $1}'")

# If the branch is not correct, check out the correct branch
if branch != 'gh-pages':
	shutit.send('git checkout gh-pages')

Step 4: Use a template

You can use bash to do all sorts of things. ShutIt was original written to manage complex Docker builds, so you could write that in bash using the above template. However, there exist other templates for other purposes such as:

  • Docker containers
  • Vagrant machines
  • Vagrant multinode setup

To use these, follow the shutit skeleton steps above and pick the options you want.

Videos are available going through these steps (links above).

Troubleshooting Docker Patterns

‘Permission denied’

If at this point you get an error to do with ‘permission denied’, then you may need to configure ShutIt to call ‘sudo docker’ instead of docker. Open the ~/.shutit/config file, and change this line


For example if you run with sudo, and the executable is ‘’:


‘Use sudo docker/ to run docker?’

If you use “sudo docker”, or “” or some other command to run docker, then you might need to alter accordingly.

Something else?

Didn’t work for you? It’s probably my fault, not yours. Mail me: