pallet-attic / pallet-crates

Pallet Crates
palletops.com
28 stars 10 forks source link

How to configure tomcat?! #10

Closed vizanto closed 13 years ago

vizanto commented 13 years ago

What's wrong with this code:

(def webserver-conf
  (server-spec
   :phases {:configure (pallet.phase/phase-fn
                        (pallet.crate.tomcat/install :version "7.0.21")
                        )
            :settings (pallet.phase/phase-fn
                       (pallet.crate.tomcat/server-configuration
                        (pallet.crate.tomcat/server
                         nil
                         (pallet.crate.tomcat/global-resources)
                         (pallet.crate.tomcat/service
                          (pallet.crate.tomcat/engine
                           "catalina" "localhost"
                           (pallet.crate.tomcat/connector :port  "8080" :protocol "HTTP/1.1"))))))
            }))

(def testservice (pallet.compute/compute-service-from-config-file :testvm)) ; testing using virtualbox

(def tserver (group-spec "tester"
                :node-spec (node-spec :image {:os-family :ubuntu})
                :extends [webserver-conf]))

(lift tserver :phase :settings :compute testservice)

It simply crashes with:

Could not find keys [:host :besora-10-0-20-114 :tomcat :base] in session :parameters. Found keys [[:host] [:host :besora-10-0-20-114] [:host :besora-10-0-20-114 :tomcat]] with values null
  [Thrown class clojure.contrib.condition.Condition]

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: clojure.contrib.condition.Condition.fillInStackTrace(Unknown Source)
  1: java.lang.Throwable.<init>(Throwable.java:218)
  2: clojure.contrib.condition.Condition.<init>(Unknown Source)
  3: pallet.parameter$get_for.invoke(parameter.clj:63)
  4: pallet.parameter$get_for_target.invoke(parameter.clj:79)
  5: pallet.crate.tomcat$server_configuration.invoke(tomcat.clj:821)
  6: pallet.crate.tomcat$server_configuration.invoke(tomcat.clj:818)
  7: nodes.core$fn__13057.invoke(core.clj:57)

I'm sorry if a ticket isn't the right way to ask this, but all these separate functions without a working example are difficult to decipher.

hugoduncan commented 13 years ago

This might help: https://github.com/pallet/pallet-examples/blob/feature/update-to-0.6/webapp-haproxy-nodes/src/webapp_nodes/crates.clj

Note the use of the :settings phase. Tomcat is the first crate to be updated to using the :settings phase.

Questions like this should go to the mailing list please, or #pallet on freenode irc.