Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #48 from lorcan/customlein

lein1 is used for deploying storm <0.9.0, otherwise lein2 is used.
  • Loading branch information...
commit 70a450ede4bbc2f426206c214c4381e7ed2f5d8a 2 parents 0bc55c6 + c93b0f4
@tbatchelli tbatchelli authored
View
9 src/clj/backtype/storm/branch.clj
@@ -0,0 +1,9 @@
+(ns backtype.storm.branch)
+
+(defn parse-branch [branch]
+ (map #(Integer/parseInt %) (.split branch "\\.")))
+
+(defn branch> [branch1 branch2]
+ (->> (map - (parse-branch branch1) (parse-branch branch2))
+ (take-while #(>= % 0))
+ (some pos?)))
View
11 src/clj/backtype/storm/crate/leiningen.clj
@@ -4,12 +4,13 @@
[pallet.action.exec-script :as exec-script]))
;; this is 1.5.2. freezing version to ensure deploy is stable
-;; (def download-url "https://raw.github.com/technomancy/leiningen/a1fa43400295d57a9acfed10735c1235904a9407/bin/lein")
+(def download-lein1-url "https://raw.github.com/technomancy/leiningen/a1fa43400295d57a9acfed10735c1235904a9407/bin/lein")
;; this is 2.3.2. freezing version to ensure deploy is stable
-(def download-url "https://raw.github.com/technomancy/leiningen/7d7426b14326fc5257d82d97c314e2ea8455597e/bin/lein")
+(def download-lein2-url "https://raw.github.com/technomancy/leiningen/7d7426b14326fc5257d82d97c314e2ea8455597e/bin/lein")
-(defn install [request]
- (-> request
+(defn install [request version]
+ (let [download-url (if (= version 1) download-lein1-url download-lein2-url)]
+ (-> request
(remote-file/remote-file
"/usr/local/bin/lein"
:url download-url
@@ -17,4 +18,4 @@
:mode 755)
(exec-script/exec-script
(export "LEIN_ROOT=1")
- ("/usr/local/bin/lein"))))
+ ("/usr/local/bin/lein")))))
View
12 src/clj/backtype/storm/crate/storm.clj
@@ -3,8 +3,8 @@
[pallet.compute :only [running? primary-ip private-ip]]
[pallet.compute.jclouds]
[org.jclouds.compute2 :only [nodes-in-group]]
-
- [pallet.configure :only [compute-service-properties pallet-config]])
+ [pallet.configure :only [compute-service-properties pallet-config]]
+ [backtype.storm.branch :only [branch>]])
(:require
[backtype.storm.crate.zeromq :as zeromq]
[backtype.storm.crate.leiningen :as leiningen]
@@ -41,12 +41,12 @@
(map (partial jclouds-node->node compute) (nodes-in-group compute (str "supervisor-" name))))]
(map primary-ip running-nodes)))
-(defn- install-dependencies [request]
+(defn- install-dependencies [request branch]
(->
request
(java/java :openjdk)
(git/git)
- (leiningen/install)
+ (leiningen/install (if (or (not branch) (= branch "master") (branch> branch "0.9.0")) 2 1))
(zeromq/install :version "2.1.4")
(zeromq/install-jzmq :version "2.1.0")
(package/package "daemontools")
@@ -107,7 +107,7 @@
(defn install-supervisor [request branch commit local-dir-path]
(->
request
- (install-dependencies)
+ (install-dependencies branch)
(directory/directory local-dir-path :owner "storm" :mode "700")
(make branch commit)))
@@ -160,7 +160,7 @@
(->
request
(directory/directory local-dir-path :owner "storm" :mode "700")
- (install-dependencies)
+ (install-dependencies branch)
(make branch commit)))
(defn exec-daemon [request]
View
9 src/clj/backtype/storm/node.clj
@@ -23,19 +23,12 @@
[pallet.resource.exec-script :as exec-script])
(:use
[backtype.storm config]
+ [backtype.storm.branch :only [branch>]]
[pallet compute core resource phase]
[pallet [utils :only [make-user]]]
[org.jclouds.compute2 :only [nodes-in-group]]
[clojure.walk]))
-(defn parse-branch [branch]
- (map #(Integer/parseInt %) (.split branch "\\.")))
-
-(defn branch> [branch1 branch2]
- (->> (map - (parse-branch branch1) (parse-branch branch2))
- (take-while #(>= % 0))
- (some pos?)))
-
;; CONSTANTS
(def clusters-conf
Please sign in to comment.
Something went wrong with that request. Please try again.