A phase specifies a sequence of crates to be executed. A phase can be defined as part of a server-spec, or inline in a configure or lift invocation, using the phase-fn macro.

A phase is a function taking a single session argument, which it modifies and returns. The session argument is passed to crate functions, which also return the session.

phase-fn macro

The phase-fn macro is a convenience for defining a phase. In the following example, the two server-spec definitions are equivalent. The phase-fn macro also adds some error checking of the session map.

(require 'pallet.core)
(require 'pallet.phase)
(require 'pallet.action.package)

(pallet.core/server-spec
  :phases
    {:configure
       (pallet.phase/phase-fn
         (pallet.action.package/package "curl"))})

(pallet.core/server-spec
  :phases
    {:configure
       (fn [session]
         (->
           session
           (pallet.action.package/package "curl")))})

:bootstrap

The :bootstrap phase is applied whenever pallet starts a new node.

:settings

The :settings phase is applied first, before any other phase. This phase is intended to provide configuration settings only, and to have no side-effects on the nodes.

:configure

The :configure phase is applied by default by both the converge and the lift commands.

Inline phase

The :phase keyword in lift and converge can be used to carry out ad-hoc configuration or administration tasks. In this example we install curl on all running mytag nodes.

  (require 'pallet.core)
  (require 'pallet.compute)
  (require 'pallet.configure)
  (require 'pallet.phase)
  (require 'pallet.action.package)

  (pallet.core/lift
    (pallet.core/group-spec "mytag")
    :phase (pallet.phase/phase-fn (pallet.action.package/package "curl"))
    :compute (pallet.configure/compute-service))