Blog by Railsware

Set up new servers with Sprinkle

Automated set-up and maintenance of new servers is the only inexpensive and effective way to create new servers quickly and consistently.
Using automated scripts allows you to kill two birds with one stone:

  1. Avoid possible mistakes by a system administrator (or whoever is setting up the server) and speed up routine tasks.
  2. Avoid configuration inconsistency when setting up typical configurations for a new server (let’s say a new node in a cloud).

The most popular server set-up and provision tools are Puppet and Chef. Both are really good tools but with major drawbacks. Puppet recipes are not easy to create, also both tools require a separate server for storing and managing recipes and maintenance work. It is a fine solution when you have large infrastructure with tens or hundreds of servers for the project, but borders on overkill when you just want to set up a new staging server for a project or create a new node once every few months.

For a more limited infrastructure you need something easier and more straightforward, like Capistrano, for application deployment. Moreover, you’re can use Capistrano not just for deployment but also for server provisioning as well (there is an available tool called Deprec that has a set of Capistrano tasks for setting up Ruby/Rails servers). It is not the most elegant way, but it works.

Fortunately, there is also a tool called Sprinkle, which is perhaps best described by its author:

Sprinkle is a software provisioning tool with which you can use to build remote servers, after the base operating system has been installed. For example, to install a Rails or Merb stack on a brand new slice directly after its been created.

Properties of packages such as their names, types, dependencies, etc., and what packages apply to what machines are described via a domain-specific language that Sprinkle executes (in fact one of the aims of Sprinkle is to define as concisely as possible a language for installing software).

Sprinkle is built on top of Capistrano, so it uses the same push approach. The tool provides clean and simple DSL for defining recipes. It leverages Debian’s and Ubuntu’s APT packaging system, RubyGems, and has special syntax for installing unix applications from the source and adding some pre- and post-installation hooks. Also, it manages dependencies between your packages. Just take a look at Sprinkle recipe examples on its website.

Our sprinkle recipes are used mostly for installing Ruby Enterprise Edition together with RubyGems, Nginx together with Passenger, SQL database (MySQL or PostgreSQL), SCM tool (Git or Mercurial), ImageMagick, different sysadmin tools, redis, memcached, etc. So we published most of the them to public. You can check Railsware’s Sprinkle recipes at GitHub.

Setting up new server with Sprinkle and our recipes set is quite easy:

  1. Get recipes code from GitHub.
  2. Install Sprinkle: sudo gem install sprinkle.
  3. Set your server credentials in deploy.rb.
  4. Pick packages you want to install in install.rb. Add other packages or modify existing ones.
  5. Run sprinkle -s install.rb inside or sprinkle_recipes directory and follow Sprinkle instructions.

Exit mobile version