Skip to content

Instantly share code, notes, and snippets.

@bfritz
Created January 18, 2012 17:08
Show Gist options
  • Save bfritz/1634105 to your computer and use it in GitHub Desktop.
Save bfritz/1634105 to your computer and use it in GitHub Desktop.
install openjdk to vagrant/virtualbox VM with pallet 0.6.6
(defpallet
:services
{:myapp-vagrant {:provider "node-list"
:node-list [
["vagrant" "myapp" "127.0.0.1" :debian :is-64bit true :ssh-port 2222]]
:environment
{:user
{:username "vagrant"
:private-key-path "/home/brad/.gem/gems/vagrant-0.8.10/keys/vagrant"
:public-key-path "/home/brad/.gem/gems/vagrant-0.8.10/keys/vagrant.pub"}}}})
(ns #^{:author "Brad Fritz"}
deploy
"Deploy MYAPP infrastructure. Based on pallet-examples demo.clj."
(:use [pallet core compute]
[pallet.phase :only [phase-fn]]))
(require 'pallet.crate.java)
;; define the "myapp" nodes from ~/.pallet/config.clj
(def myapp (compute-service-from-config-file :myapp-vagrant))
;; nodes can be listed with the nodes function
;; (nodes myapp)
;; images for MYAPP are pre-built
(def myapp-node-spec
(node-spec :image nil))
;; define bits of the configuration
(def with-java
(server-spec
:phases {:configure (phase-fn
(pallet.crate.java/java :openjdk))}))
;; compose the configuration bits
(def myapp-group-spec
(group-spec
"myapp" :extends [with-java] :node-spec myapp-node-spec))
;; since our VM node is already running, use lift to apply configuration to it
(pallet.core/lift myapp-group-spec :compute myapp :phase :configure)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment