Skip to content

Instantly share code, notes, and snippets.

@tobyclemson
Created February 25, 2013 00:06
Show Gist options
  • Save tobyclemson/5026362 to your computer and use it in GitHub Desktop.
Save tobyclemson/5026362 to your computer and use it in GitHub Desktop.
(ns rosettajvm.deployment.provision
(:require [pallet.api :as api]
[pallet.configure :as configure])
(:use [pallet.crate.automated-admin-user :only [with-automated-admin-user]]
[rosettajvm.deployment.crate.openjdk-7-jre :only [with-openjdk-7-jre]]
[rosettajvm.deployment.crate.rosetta-jvm :only [with-rosetta-jvm]])
(:gen-class :name "rosettajvm.deployment.Provisioner"))
(def ubuntu-node
(api/node-spec
:image {:os-family :ubuntu
:image-id "us-east-1/ami-de0d9eb7"}
:network {:inbound-ports [22]}))
(def application-nodes
(api/group-spec "rosetta-jvm"
:extends [with-automated-admin-user
with-rosetta-jvm]
:node-spec ubuntu-node))
(defn bring-node-up-on [provider]
(api/converge
(merge application-nodes {:count 1})
:compute (configure/compute-service provider)))
(defn bring-node-down-on [provider]
(api/converge
(merge application-nodes {:count 0})
:compute (configure/compute-service provider)))
(defn -main [& args]
(let [action (first args)
provider (keyword (second args))]
(case action
"up" (bring-node-up-on provider)
"down" (bring-node-down-on provider))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment