On Github celestial-ops / celestial-intro
Created by Ronen Narkis / @narkisr
{ :env :dev :machine { :hostname "red1" :user "ubuntu" :os :ubuntu-12.10 } :aws { :instance-type "t1.micro" :image-id "ami-64636a10" :key-name "Uranus" :endpoint "ec2.eu-west-1.amazonaws.com" } :type "redis" }
{ :puppet-std { :module { :name "redis-sandbox-0.3.4" :src "http://dl.bintray.com/content/narkisr/boxes/redis-sandbox-0.3.4.tar.gz" } :args [] } :type "redis" :classes {:redis {:append true}} }
(require '[puny.core :as p]) (p/entity foo) (defn validate-foo [foo] {}) (let [id (add-foo {:bar 1})] (get-foo id) ;=> {:bar 1} (foo-exists? id) ;=> truthy (update-foo id {:bar 2}) (get-foo id) ;=> {:bar 2} (delete-foo id) (foo-exists? id) ;=> falsey )
(defmodel action :operates-on :string :src :string :actions {:type "Actions"}) (defroutes- actions {:path "/actions" :description "Adhoc actions managment"} ; using custom action model (POST- "/action" [& ^:action action] {:nickname "addActions" :summary "Adds an actions set"} {:status 200 :body (str "got action " action)}))
(ns- deploy (task update-code (let [{:keys [src app-name run-id]} args] (debug "updating code on" remote) (copy src (releases app-name run-id)))) (task post-update ...) (task start ...) (task symlink ...) (task stop ...) (task pre-update ...))
(lifecycle base-deploy {deploy/update-code #{deploy/post-update deploy/symlink} deploy/stop #{deploy/update-code} deploy/pre-update #{deploy/update-code} deploy/symlink #{deploy/start} deploy/post-update #{deploy/start} deploy/start #{}})