Zero to running in five minutes with lein.
The first thing we need is leiningen,
a build tool for clojure. You can downlaod this with your web browser, curl or
wget or your favourite download tool. Here we show using curl.
bash$ curl -O http://github.com/technomancy/leiningen/raw/stable/bin/lein
bash$ chmod +x leinbash$ lein plugin install lein-newnew 0.2.4
bash$ lein plugin install org.cloudhoist/lein-pallet-new 0.1.1-SNAPSHOT
bash$ lein plugin install org.cloudhoist/pallet-lein 0.4.2-SNAPSHOT
Now we can create a new clojure project using lein. To do this we install the pallet project template, then use it to creat a project named 'quickstart'.
bash$ lein new pallet quickstart with-pallet-jclouds 1.3.1
Created new project in: quickstart
bash$ cd quickstartNow you can configure your credentials.
bash$ lein pallet add-service aws aws-ec2 your-aws-key your-aws-secret-keyNote that this creates a ~/.pallet/services/aws.clj file with your credentials
in it.
The second argument above is the name of the jclouds provider, which is cloud specific. To find the value for other clouds, you can list the supported providers with:
bash$ lein pallet providersStart a repl with lein repl and load pallet with require at the repl
user=> prompt.
(require 'pallet.core 'pallet.compute 'pallet.configure)You can now start your first compute node:
(pallet.core/converge
(pallet.core/group-spec "mygroup" :count 1)
:compute (pallet.configure/compute-service :aws))To shut the node down again, change the :count value to zero:
(pallet.core/converge
(pallet.core/group-spec "mygroup" :count 0)
:compute (pallet.configure/compute-service :aws))Congratulations!