[deprecated] Simple web application deployment
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
Guardfile
LICENSE
README.md
Rakefile Move rspec options to .rspec so guard can use them too. Apr 19, 2011
simpleton.gemspec

README.md

Simpleton is deprecated

There are tools which are much better suited at automating deployments and server interactions, such as Ansible, so please use those instead.

What is Simpleton?

Simpleton is a deployment micro-framework which aims to simplify and improve the deployment of web applications. In this regard, it is in the same space as Capistrano, Vlad the Deployer, and other similar tools.

Simpleton is written in Ruby, and relies on existing UNIX command-line tools (ssh, git, etc.) to bring out the best of both worlds: a powerful DSL with testable deployment scripts, and battle-tested tools that are available (almost) everywhere.

Installation

gem install simpleton

Example

Here's what a basic deployment script using Simpleton looks like:

require 'rubygems'
require 'simpleton'

Simpleton.configure do |config|
  config[:hosts] = ["host1", "host2"]
  config[:repository] = "git://github.com/fantastic/awesome.git"
  config[:commit] = "origin/master"
  config[:directory] = "/data/awesome"
end

Simpleton.use Simpleton::Middleware::GitUpdater
Simpleton.use Proc.new {'echo "Finished at `date` on the server."'}
Simpleton.run

The output you'd get would look something like this:

[host1]< cd /data/awesome && git fetch && git reset --hard origin/master
[host2]< cd /data/awesome && git fetch && git reset --hard origin/master
[host1]> HEAD is now at 123abcs This is the best commit ever.
[host1]< echo "Finished at `date` on the server."
[host2]> HEAD is now at 123abcs This is the best commit ever.
[host2]< echo "Finished at `date` on the server."
[host1]> Finished at Wed Mar  31 04:31:51 UTC 2010 on the server.
[host2]> Finished at Wed Mar  31 04:31:51 UTC 2010 on the server.

Design

Simpleton is built around Middleware and Workers.

Middleware

A Middleware is an object that responds to call, taking as an argument the Simpleton::Configuration hash. It returns a string or array of strings, representing commands that will be executed on a remote host.

For example, when the command from this middleware:

Proc.new { %Q[echo "The time on the server is `date`"] }

is run, it will echo the current time on a remote host, and when:

class Something
  def self.call(configuration)
    "git rev-parse #{configuration[:commit]}"
  end
end

is run, it will lookup the commit-id of the commit to deploy on a remote host.

Workers

Workers are objects that perform work for a single host in the configuration. Each Simpleton::Worker constructs a list of commands to run at its location by calling the Middleware objects in its queue; it then runs each constructed command, capturing its stdout, stderr and exit status.

If running a command fails (returns a non-zero status), the Worker will exit with the failed command's status and will not run any more commands.

Each worker runs in its own process, forked by Simpleton, so running commands on a host is isolated from problems that may arise from running commands on any other hosts.

Custom Workers

Simpleton supports running commands through a Worker other than the built-in Simpleton::Worker. To set the class of workers to be used, just set Simpleton::Master.worker_class:

Simpleton::Master.worker_class = My::Fancy::Worker

For details on how to implement your own Worker, see Simpleton::Worker.

Thanks

  • To Dan Hodos, for the project name.