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
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
:collected. Calls to
:aggregated actions will be grouped, and run
:in-sequence actions. Calls to
:collected actions will be grouped,
and run after
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.
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
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
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
Abstraction of the compute interface
Hybrid provider service implementation.
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
An instance of the node-list provider can be built using
(node-list-service [["host1" "fullstack" "192.168.1.101" :ubuntu] ["host2" "fullstack" "192.168.1.102" :ubuntu]])
Some standard file formating.
Pallet configuration using ~/.pallet/config.clj, the pallet.config namespace or from settings.xml.
config.clj should be in ~/.pallet or a directory specified by the PALLET_HOME environment variable.
service definitions can also be specified as clojure maps in ~/.pallet/services/*.clj
Core functionality is provided in
- 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.
Set up the system environment.
Generation and installation of /etc/default-style files.
Crate for working with network services
Crate functions for manipulating SSH-keys
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
To provide a service spevific default, specify an :environment key at the
service level of
To provide a project specific default, define
To provide a specific environment when invoking lift or converge, pass an
environment map using the
The merging of values between scopes is key specific, and is determined by
Exectute commands. At the moment the only available transport is ssh.
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
Service specific paramters, used across hosts, are specified under
[:parameters :service (keyword service-name)]
These functions are
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.
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.
Namespace for backward compatibility
Conditional resource execution.
Script library for abstracting target host script differences
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.
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.
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.
Utilities used across pallet.
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.
Version handling for pallet