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:
- Avoid possible mistakes by a system administrator (or whoever is setting up the server) and speed up routine tasks.
- 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:
- Get recipes code from GitHub.
- Install Sprinkle: sudo gem install sprinkle.
- Set your server credentials in deploy.rb.
- Pick packages you want to install in install.rb. Add other packages or modify existing ones.
- Run sprinkle -s install.rb inside or sprinkle_recipes directory and follow Sprinkle instructions.
Most recent posts
- Responsive layout tests with Capybara and RSpec
- SQL Joins Visualizer – build SQL JOIN between two tables by using Venn diagrams
- Flexbox as a solution for browser reflow optimization
- Make AngularJS 1.0.7 work with Jasmine 2.0
- Git housekeeping tutorial: clean-up outdated branches in local and remote repositories
Most popular posts
- API with Ruby on Rails: useful tricks 47,818 views
- Creation of pure Swift module 20,574 views
- PostgreSQL most useful extensions 19,507 views
- Advanced server definitions in Capistrano 18,372 views
- Git housekeeping tutorial: clean-up outdated branches in local and remote repositories 16,182 views