Pallet 0.7 API documentation

Pallet, DevOps for the JVM

Pallet is a platform for agile and programmatic automation of infrastructure in the cloud, on server racks or directly on virtual machines. Pallet provides cloud provider and operating system independence, and allows for an unprecedented level of customization.

Actions implement the conversion of phase functions to script and other execution code.

An action has an :action-type. Known types include :script/bash and :fn/clojure.

An action has a :location, with a value of :origin for execution on the node running pallet, and :target for the target node.

An action has an :execution, which is one of :aggregated, :in-sequence or :collected. Calls to :aggregated actions will be grouped, and run before :in-sequence actions. Calls to :collected actions will be grouped, and run after :in-sequence actions.

Conditional action execution.

A directory manipulation action, to create and remove directories with given ownership and mode.

Set up the system environment.

Script execution. Script generation occurs with the correct script context.

File manipulation.

Filesystem action

Package management action.

package is used to install or remove a package.

package-source is used to specify a non-standard source for packages.

Actions for working with the centos repositories

Actions for working with the debian backports repository

Actions for working with the epel repository

Actions for working with the jpackage repository

Actions for working with the rpmforge repository

Action to specify the content of a remote directory. At present the content can come from a downloaded tar or zip file.

Action to specify remote file content.

remote-file has many options for the content of remote files. Ownership and mode can of course be specified. By default the remote file is versioned, and multiple versions are kept.

Modification of remote files outside of pallet cause an error to be raised by default.

Provides an action that can be repeated if it fails

Service control.

User management action.

An action plan contains actions for execution.

The action plan is built by executing a phase function. Each phase function calls actions which insert themselves into the action plan.

The action plan is transformed to provide aggregated operations, and to resolve precedence relations between actions.

A translated plan is executed by passing an executor, which is a map from action type to function. The executor functions are called with the result of evaluating the action with it's arguments.

Arguments to actions. Adds capability of evaluating arguments at action application

Blobstore abstraction

Implementation details

A url based blobstore implementation.

Process command-line arguments according to a given cmdspec

Produce a shell script for launching Pallet, possibly customised for extra jars

Hybrid provider service implementation.

Implementation details

Information from local jvm

A simple node list provider.

The node-list provider enables pallet to work with a server rack or existing virtual machines. It works by maintaining a list of nodes. Each node minimally provides an IP address, a host name, a group name and an operating system. Nodes are constructed using make-node.

An instance of the node-list provider can be built using node-list-service.

(node-list-service
  [["host1" "fullstack" "192.168.1.101" :ubuntu]
   ["host2" "fullstack" "192.168.1.102" :ubuntu]])

Some standard file formating.

Core functionality is provided in lift and converge.

  • node :: A node in the compute service
  • node-spec :: A specification for a node. The node-spec provides an image hardware, location and network template for starting new nodes.
  • server-spec :: A specification for a server. This is a map of phases and a default node-spec. A server-spec has the following keys :phase, :packager and node-spec keys.
  • group-spec :: A group of identically configured nodes, represented as a map with :group-name, :count and server-spec keys. The group-name is used to link running nodes to their configuration (via pallet.node.Node/group-name)
  • group :: A group of identically configured nodes, represented as a group-spec, together with the servers that are running for that group-spec.
  • group name :: The name used to identify a group.
  • server :: A map used to descibe the node, image, etc of a single node running as part of a group. A server has the following keys :group-name, :node, :node-id and server-spec keys.
  • phase list :: A list of phases to be used
  • action plan :: A list of actions that should be run.

crontab management

Set up the system environment.

Generation and installation of /etc/default-style files.

/etc/hosts file.

/etc/hosts file.

Crate for working with network services

Package repositories

Install methods for crates

Helpers for debugging.

Wrappers for enlive to enable template specialisation and use xml.

The environment provide a mechanism for customising pallet and pallet crates according to some externally determined criteria.

An environment can be specified at the global, service, invocation and tag scopes.

To provide a global default, specify an :environment key at the top level of defpallet in ~/.pallet/config.clj.

To provide a service spevific default, specify an :environment key at the service level of defpallet in ~/.pallet/config.clj.

To provide a project specific default, define pallet.config/environment.

To provide a specific environment when invoking lift or converge, pass an environment map using the :environment key.

The merging of values between scopes is key specific, and is determined by merge-key-algorithm.

Keep track of operations started by pallet

Invoke tasks requiring a compute service. This decouples main from anything pallet, jclouds or maven specific, and ensures compiling main doesn't compile the world.

Map merging algorithms. Enables specification of merging function on a per key basis.

Provides functions for working with parameters.

Parameters are data maps that allow propogation of information between the functions of a crate, and between crates. There are two conventions for using parameters in crates that are directly supported here.

Host specific parameters are specified under [:parameters :host (keyword target-id)] These functions are get-for-target, assoc-for-target, and update-for-target.

Service specific paramters, used across hosts, are specified under [:parameters :service (keyword service-name)] These functions are get-for-service, assoc-for-service, and update-for-service.

The get-for functions have slightly different semantics compared with clojure.core/get, in that they throw an exception if the key is undefined and no default value is specified.

Delayed evaluation of parameters specified as arguments to action functions are also implemented here. lookup and lookup-for-target.

A phase is a function of a single session argument, that contains calls to crate functions or actions. A phase has an implicitly defined pre and post phase.

A namespace that can be used to pull in most of pallet's namespaces. uesful when working at the clojure REPL.

Compatibility namespace

Namespace for backward compatibility

Compatability namespace

Compatability namespace

Compatability namespace

Compatability namespace

Compatibility namespace

Compatability namespace

Compatibility namespace

Compatibility namespace

Compatability namespace

Compatability namespace

Compatability namespace

Conditional resource execution.

Compatability namespace

Compatability namespace

Compatibility namespace

Compatability namespace

Functions for querying sessions.

This is the official crate API for extracting information from the session.

Conveniently launch a sub-process providing its stdin and collecting its stdout

Runtime string interpolation built on top of clojure.contrib.strint.

Compatibility namespace

Add a service definition to pallet.

Create a pallet configuration file in ~/.pallet/config.clj

List blobstore contianers.

Adjust node counts.

Display the node definition for the given node-types

Display a list of tasks or help for a given task.

List images.

Apply configuration.

List nodes.

Provide information on the supported and enabled providers.

Upload to a blob.

Print the pallet version

Template file writing

A template for writing properties style config files.

Dispatch that is version aware.

A version is a dotted string, eg. "1.0.3", which is represented as a vector [1 0 3].

A version specification is either a version vector, which matches a single version (and all point versions thereof), or a vector of two elements, specifying an inclusive version range. A nil in the version vector signifies an open end to the range.

The basic idea is that you wish to dispatch on hierarchy where the dispatched data may provide a version.