Skip to content

Instantly share code, notes, and snippets.

@jacobobryant
Created May 10, 2019 19:31
Show Gist options
  • Save jacobobryant/9c13f4cd692ff69d8f87b0d872aeb64e to your computer and use it in GitHub Desktop.
Save jacobobryant/9c13f4cd692ff69d8f87b0d872aeb64e to your computer and use it in GitHub Desktop.
Script for automating Datomic Cloud Ion push + deploy
#!/usr/bin/planck
(ns deploy.core
(:require [cljs.reader :refer [read-string]]
[planck.shell :as shell]))
(defn sh [& args]
(let [result (apply shell/sh args)]
(if (= 0 (:exit result))
(:out result)
(throw (ex-info (:err result) {})))))
(let [push-out (sh "clojure" "-A:dev" "-m" "datomic.ion.dev" "{:op :push}") ; optionally: :uname \"$(uuidgen)\"
_ (print push-out)
deploy-cmd (get-in (read-string (str "[" push-out "]")) [1 :deploy-command])
deploy-out (sh "bash" "-c" deploy-cmd)
_ (print deploy-out)
status-cmd (:status-command (read-string deploy-out))]
(println "Monitoring deployment; press Ctrl-C to exit.")
(while true
(print (sh "bash" "-c" status-cmd))
(sh "sleep" "5")))
@rbubke
Copy link

rbubke commented Jun 21, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment