pallet.clj – Infrastructure Project File

pallet.clj – Infrastructure Project File

0 0


On Github hugoduncan / pallet-prj-cw-2013


Infrastructure Project File

Hugo Duncan / @hugoduncan / @palletops

The Infrastructure You Need

From day one.

One source, many clouds, virtualisation environments.

One source, many deployment environments.

One of the principles in pallet is that you should automate your infrastructure from day 1. Wherever your infrastructure is - local vm, cloud, datacenter. Should allow you to build dev, test, staging and production. Define once, use it everywhere.

Infrastructure Project File

Sits next to your project.clj file.

Checked in with your project

Checkout your project and build a dev environment

Easy to get going

Scales to complex scenarios

pallet.clj gives you a simple way of adding pallet to an application, in a way that scales.

Easy to start

In the project.clj file:

  [[com.palletops/pallet-lein "0.6.0-beta.7"]]

Create a pallet.clj file:

(defproject myproject
      (plan-fn (package "postgresql-9.1"))})
$ lein pallet up

Now on ec2…

lein pallet add-service ec2 aws-ec2 xxxx xxxx
lein pallet --service ec2 up

Use the exact same code.

Can specific cloud specific images.

As your infrastructure evolves

Split out code into functions

Split out code into re-usable modules

Modules are code artifacts

Modules are crates Crates are source and versionable in source and releases.


(defproject myproject
        [{:node-spec {:image {:os-family :ubuntu}}
          :selectors #{:default :ubuntu}
  :groups [...])
lein pallet up --selectors ubuntu
lein pallet up --groups db
lein pallet up --phases configure,test


Hugo Duncan / @hugoduncan

Toni Batchelli / @tbatchelli


Also explain-plan, better logging, better error reporting, etc.
(require '[my.ns :refer [group1 group2]])
(defproject myproject
  :groups [group1 group])

pallet/src is on the classpath

Group specs

(def group1
  (group-spec "group1"
        (remote-file "f" :content "hello"))}
    :roles #{:db}))

Multiple nodes

(def group1 (group-spec...))
(def group1 (group-spec...))
(defproject myproject
  :groups [group1 group])
lein pallet up --roles db

Will start/stop a node for each group