Status of pallet/lein-template and lein2?

98 views
Skip to first unread message

Paul Butcher

unread,
Jul 10, 2012, 1:04:47 PM7/10/12
to palle...@googlegroups.com
What is the status of pallet/lein-template with lein2? The fact that it generates a :profiles section suggests that it should work with lein2? But it also generates a :dev-dependencies section, which is (as far as I know?) a lein1-only thing?

The project that's generated doesn't seem to be working for me with lein2 either. Here's what I get:

pauls-macbook-pro:clj paul$ lein --version
Leiningen 2.0.0-preview7 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM
pauls-macbook-pro:clj paul$ lein new pallet PalletTest
pauls-macbook-pro:clj paul$ cd PalletTest/
pauls-macbook-pro:PalletTest paul$ lein pallet
Error loading pallet:  Could not locate pallet/main__init.class or pallet/main.clj on classpath: 
You need to install pallet and it's dependencies in
~/.lein/plugins in order to use the lein-pallet plugin
outside of a project.
pauls-macbook-pro:PalletTest paul$ cat project.clj 
(defproject PalletTest "0.1.0-SNAPSHOT"
  :description "FIXME Pallet project for PalletTest"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.cloudhoist/pallet "0.7.1"]
                 [org.cloudhoist/pallet-jclouds "1.3.0-beta.1"]
                 ;; To get started we include all jclouds compute providers.
                 ;; You may wish to replace this with the specific jclouds
                 ;; providers you use, to reduce dependency sizes.
                 [org.jclouds/jclouds-allblobstore "1.3.2"]
                 [org.jclouds/jclouds-allcompute "1.3.2"]
                 [org.jclouds.driver/jclouds-slf4j "1.3.2"]
                 [org.slf4j/slf4j-api "1.6.1"]
                 [ch.qos.logback/logback-core "1.0.0"]
                 [ch.qos.logback/logback-classic "1.0.0"]]
  :dev-dependencies [[org.cloudhoist/pallet
                      "0.7.1" :type "test-jar"]
                     [org.cloudhoist/pallet-lein "0.5.0"]]
  :profiles {:dev {:plugins [[org.cloudhoist/pallet-lein "0.5.0"]]}}
  :local-repo-classpath true
  :repositories

What am I missing?


paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: pa...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

Hugo Duncan

unread,
Jul 10, 2012, 1:34:38 PM7/10/12
to palle...@googlegroups.com
Paul Butcher <pa...@paulbutcher.com> writes:

> What is the status of pallet/lein-template with lein2? The fact that
> it generates a :profiles section suggests that it should work with
> lein2? But it also generates a :dev-dependencies section, which is (as
> far as I know?) a lein1-only thing?

The intention is that the generated project.clj should work with both
lein1 and lein2.

>> pauls-macbook-pro:PalletTest paul$ lein pallet
>> Error loading pallet: Could not locate pallet/main__init.class or pallet/main.clj on classpath:
>> You need to install pallet and it's dependencies in
>> ~/.lein/plugins in order to use the lein-pallet plugin
>> outside of a project.

I can reproduce the above, and it seems to be caused by a bug in the
no-arg code path. e.g. `lein pallet nodes` works here.

Hugo

Hugo Duncan

unread,
Jul 10, 2012, 2:52:31 PM7/10/12
to palle...@googlegroups.com
Hugo Duncan <hu...@hugoduncan.org> writes:

>>> pauls-macbook-pro:PalletTest paul$ lein pallet
>>> Error loading pallet: Could not locate pallet/main__init.class or pallet/main.clj on classpath:
>>> You need to install pallet and it's dependencies in
>>> ~/.lein/plugins in order to use the lein-pallet plugin
>>> outside of a project.
>
> I can reproduce the above, and it seems to be caused by a bug in the
> no-arg code path. e.g. `lein pallet nodes` works here.

Fixed in pallet-lein 0.5.1.

Hugo

Paul Butcher

unread,
Jul 12, 2012, 6:06:37 AM7/12/12
to palle...@googlegroups.com
Many thanks, Hugo. I'm afraid I've hit another problem :-( "lein pallet providers" gives me:

Paul-Butchers-MacBook-Pro:PalletTest paul$ lein pallet providers
10:46:21.538 [main] ERROR pallet.main - Exception
clojure.lang.Compiler$CompilerException: java.lang.IllegalArgumentException: No matching method: viewableAs, compiling:(pallet/task/providers.clj:38)

(followed by a long stacktrace that I can send if it's going to be helpful).

I'm generally trying to get my head around "lein pallet" and I'm not finding it to be very discoverable :-( I've not found any documentation on palletops.com (am I missing something?), and "lein pallet help" gives:

Paul-Butchers-MacBook-Pro:PalletTest paul$ lein pallet help
Pallet is a cloud administration tool.

Several tasks are available:
  new-project
  help

Run pallet help $TASK for details.
Run the `lein new pallet` to create a pallet project.


0

Which clearly doesn't list all the tasks that lein pallet supports :-) And of the two that it does list, as far as I'm aware, new-project doesn't do anything useful (we should use pallet/lein-template instead?) (incidentally, it's somewhat confusing that lein-template is called pallet-lein-new in GitHub?)

So I think that I'm right in saying that the set of tasks that's supported by "lein pallet" is basically defined by the files in this directory?:


But not all of these are functional - for example providers has the problem I mentioned at the top of this mail, help is being unhelpful, and version gives me:

Paul-Butchers-MacBook-Pro:PalletTest paul$ lein pallet version
Pallet nil on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM
0

What is the best way for me to get an understanding of what "lein pallet" can do, and how it should best be used?

--

paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: pa...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

Ryan Stradling

unread,
Jul 12, 2012, 8:20:57 AM7/12/12
to palle...@googlegroups.com, palle...@googlegroups.com
Are you using Lein 2 or 1?

Sent from my iPhone

Paul Butcher

unread,
Jul 12, 2012, 8:57:08 AM7/12/12
to palle...@googlegroups.com

On Thursday, 12 July 2012 at 13:20, Ryan Stradling wrote:

Are you using Lein 2 or 1?

Lein 2.

Paul Butcher

unread,
Jul 12, 2012, 9:02:39 AM7/12/12
to palle...@googlegroups.com

On Thursday, 12 July 2012 at 13:57, Paul Butcher wrote:

On Thursday, 12 July 2012 at 13:20, Ryan Stradling wrote:

Are you using Lein 2 or 1?

Lein 2.

Specifically 2.0.0-preview7. I've just tried with 1.7.1, and I see exactly the same behaviour, however.

Hugo Duncan

unread,
Jul 12, 2012, 11:16:38 AM7/12/12
to palle...@googlegroups.com
Paul Butcher <pa...@paulbutcher.com> writes:

>> Paul-Butchers-MacBook-Pro:PalletTest paul$ lein pallet providers
>> 10:46:21.538 [main] ERROR pallet.main - Exception
>> clojure.lang.Compiler$CompilerException: java.lang.IllegalArgumentException: No matching method: viewableAs, compiling:(pallet/task/providers.clj:38)

Thanks for reporting this. https://github.com/pallet/pallet/issues/141.

> I'm generally trying to get my head around "lein pallet" and I'm not
> finding it to be very discoverable :-( I've not found any
> documentation on palletops.com (am I missing something?), and "lein
> pallet help" gives:
>
>> Paul-Butchers-MacBook-Pro:PalletTest paul$ lein pallet help
>> Pallet is a cloud administration tool.
>>
>> Several tasks are available:
>> new-project
>> help
>>
>> Run pallet help $TASK for details.
>> Run the `lein new pallet` to create a pallet project.
>>
>>
>> See https://palletops.com.
>> 0

I've update pallet 0.7.2-SNAPSHOT to fix the resolving of tasks in this
list. Thanks for reporting it.

> Which clearly doesn't list all the tasks that lein pallet supports :-)
> And of the two that it does list, as far as I'm aware, new-project
> doesn't do anything useful (we should use pallet/lein-template
> instead?) (incidentally, it's somewhat confusing that lein-template is
> called pallet-lein-new in GitHub?)

The new-project task is now removed (0.7.2-SNAPSHOT).

pallet-lein-new was named before auto-discovery of templates was added
to lein-newnew. I suppose we could rename the repo, unless anyone has
objections.

> So I think that I'm right in saying that the set of tasks that's supported by "lein pallet" is basically defined by the files in this directory?:
>
> https://github.com/pallet/pallet/tree/develop/src/pallet/task

Indeed, and you are free to add your own project specific tasks by
adding pallet.task.x namespaces in your project.

> But not all of these are functional - for example providers has the problem I mentioned at the top of this mail, help is being unhelpful, and version gives me:
>
>> Paul-Butchers-MacBook-Pro:PalletTest paul$ lein pallet version
>> Pallet nil on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM
>> 0

Fixed in 0.7.2-SNAPSHOT.

> What is the best way for me to get an understanding of what "lein pallet" can do, and how it should best be used?

Sounds like we need some documentation on the palletops site for
this. Hopefully the fix to the listing of tasks helps a little.

Hugo

David Santiago

unread,
Jul 12, 2012, 2:03:35 PM7/12/12
to palle...@googlegroups.com
On Thu, Jul 12, 2012 at 3:06 AM, Paul Butcher <pa...@paulbutcher.com> wrote:
> What is the best way for me to get an understanding of what "lein pallet"
> can do, and how it should best be used?

I can't imagine using pallet without lein pallet. It acts as a control
console for pallet, letting you perform common operations without
needing to write or modify any code. As long as you have configured
your providers in your config.clj file, and have node specs somewhere
on the class path, you can do things like

* lein pallet nodes - Gives you a list of all the nodes that are
currently running on your current provider.
* lein pallet converge some.namespace/var-holding-a-node-spec n -
Runs converge on the current provider, allowing you to create any
number (including 0) of nodes on the current provider
* lein pallet lift some.namespace/var-holding-a-node-spec
[some-phase] - Runs a lift to all nodes of the type specified by the
node-spec, either the default configure phase, or a phase you specify.

You can pick a provider to use on the command line with the -P flag,
or you can use lein2's profiles to select a pallet environment to use
(including provider in the environments) with lein2's with-profile
higher order task, or use sticky tasks with configleaf
(http://github.com/davidsantiago/configleaf).

When you put that all together, you can create, remove, and run code
on any number of running instances on any configured provider right
from the command line. I've found that for me, when it becomes this
easy, doing development for say a web service is completely different.
You can create a node on virtualbox for development, write a phase to
deploy your code and get it running on the virtualbox node, test it
out locally, and then when you want to run it in production, switch
providers and deploy code on the running nodes (or just create a whole
new set of nodes). You could do all those same things with some
scripts using pallet as a library, but I find it is much easier to
work from the pre-written tasks lein pallet gives you access to
whenever possible.

David

Paul Butcher

unread,
Jul 12, 2012, 2:10:02 PM7/12/12
to palle...@googlegroups.com

Thanks, as always, for the rapid response, Hugo.

On Thursday, 12 July 2012 at 16:16, Hugo Duncan wrote:

Sounds like we need some documentation on the palletops site for
this. Hopefully the fix to the listing of tasks helps a little.

Hugo

Yes, fixing help will certainly … err ... help :-) But some introductory text on palletops is also necessary I think to help orient new users.

Thanks!

--

Paul Butcher

unread,
Jul 12, 2012, 2:11:07 PM7/12/12
to palle...@googlegroups.com
Thanks David - that's very helpful context.

--
paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: pa...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher

Reply all
Reply to author
Forward
0 new messages