2

I was reading about pallet here: http://twoguysarguing.wordpress.com/2010/11/01/starting-a-cluster-on-ec2-with-pallet/, as well as on the pallet site: http://palletops.com/. I'm still a little confused. The examples are arranged as if I'm expected to enter the code at a REPL.

But I think I'm missing something. Because I feel like (or I'm hoping) there should be some sort of lein support/integration, so that I can define some code to spin up a cluster, start the cluster, stop the cluster, deploy a war file, etc. via a series of lein commands.

I did find the following project on github, but it appears to be written to work with maven instead of lein: https://github.com/cemerick/clojure-web-deploy-conj.

And, this is very close to what I want, except that I want this tied into lein targets somehow: http://cemerick.com/2010/05/12/provisioning-administration-and-deployment-of-couchdb-java-tomcat/.

ds13
  • 7
  • 3
Kevin
  • 24,871
  • 19
  • 102
  • 158

2 Answers2

1

The Leiningen wiki refers to pallet/pallet-lein.

I don't have any experience with pallet, but it looks like the Leiningen plugin passes the first plugin argument to a function in the pallet.main namespace which appears to call into pallet.

So, the argument foo in lein pallet foo would be passed along to pallet.

Jeremy
  • 22,188
  • 4
  • 68
  • 81
  • that's nice but the github page doesn't provide any docs, and this page http://palletops.com/doc/first-steps/ shows `lein pallet add-service` and then says go to the REPL and enter the following code to start/stop a service. So the implication is that the plugin can add a service but does not have lein support to start/stop a service. And there is no mention of deploying a war. Am I missing something? – Kevin Apr 01 '12 at 16:29
  • I don't have any experience with pallet, but it looks like the Leiningen plugin passes the first plugin arg (foo in "lein pallet foo") to a function in the pallet.main namespace which appears to call into pallet. – Jeremy Apr 01 '12 at 17:47
0

So I found the following http://nakkaya.com/2010/02/25/writing-leiningen-plugins-101/, which describes the process for creating your own plugin. As it turns out it's fairly straightforward. Create a top level leiningen/ directory, give it a namespace name, and a function of the same name. And the function becomes a task in leiningen. So for example to provision a machine all I have to do is:

; In file leiningen/aws_provision.clj
(ns leiningen.aws-provision)

(defn aws-provision [project & args]
    (println "pallet code to provision the box here..."))

Then from the lein prompt I can do:

lein aws-provision

I guess pallet-lein isn't going to really be able to do what I want, because the details of which cloud provider, which machine size, which packages to install on the machine, etc. will be different for each person.

Kevin
  • 24,871
  • 19
  • 102
  • 158