Sprinkle Cheatsheet

Deployment Options

Deployment options go into the script which you run with sprinkle (e.g. install.rb).

Example
    deployment do
      # Choose a delivery actor with native settings.
      # See: Actors
      #
      # delivery :actor do
      #   ... actor settings ...
      # end

      delivery :capistrano do
        recipes 'deploy'
      end

      # Specify installation options for certain installers.
      # (Normally only global options for source installer.)
      source do
        prefix    '/usr/local'
        archives  '/usr/local/sources'
        builds    '/usr/local/build'
      end
    end

Actors

Actors are mechanisms by which sprinkle will talk to target computer.

Policies

A policy is a list of packages (or virtual packages) to be installed on a particular server (or rather a server with a particular role). Hence, a package can have roles assigned to it. Roles should be originally defined in whatever is the config file of the actor you chose to use. (See Actors)

Example
    policy :blog, :roles => :app do
      requires :webserver
      requires :database
      requires :rails
    end

Packages

Packages are sets of installations, options, and verifications, grouped under a meaningful name. For example, there can be package called postgres. It installs postgres, verifies presence of necessary executables, specifies other packages it relies upon, and can serve as a dependency for other packages.

Virtual Packages are providing you with options. For example, postgres, and mysql packages could be part of the virtual package called :database (using :provides => :database option). In such case when you run the script with sprinkle, you will get a choice of what to install for database.

Options
Example
    # package :package_name, :provides => :virtual_package_name do
    #   ... installers, options, verifiers ...
    # end

    package :postgres, :provides => :database do
      source 'http://example.com/postgres.tgz'
      requires :build_essential
      verify { has_executable 'psql' }
    end

Verifiers

Verifiers are convenient helpers which you can use to check if something was installed correctly. You can use this helper within a verify block (see example below). Sprinkle runs the verify block to find out whether or not something is already installed on the target machine. This way things never get done twice.

Example
    package :postgres, :provides => :database do
      # ... installations, options ...
    
      verify do 
        has_executable 'psql'
        # ... more verifiers go here ...
      end
    end

Installers

Installers are different mechanisms of getting software onto the target machine. There are different scripts that allow to download/compile software from source, use packaging systems (such as apt-get), simply copy files, and even inject content into existing files.