Created
October 15, 2020 13:17
-
-
Save joshkh/3455a6905517a814b4623d01925baf0e to your computer and use it in GitHub Desktop.
Deploy Ions to AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.deploy | |
(:require | |
[datomic.ion.dev :as dev] | |
[taoensso.timbre :refer [infof]])) | |
(defn check-status-loop [{arn :execution-arn :as args}] | |
(let [{:keys [deploy-status code-deploy-status] :as status} | |
(dev/deploy-status {:op :deploy-status | |
:execution-arn arn})] | |
(if (contains? (set [deploy-status code-deploy-status]) "RUNNING") | |
(do | |
(infof "Deployment in progress...") | |
@(future (Thread/sleep 3000) (check-status-loop args))) | |
status))) | |
(defn push [] | |
(dev/push {:op :push})) | |
(defn deploy [{:keys [rev deploy-groups]}] | |
(let [execution-arns (for [group deploy-groups] | |
(dev/deploy {:op :deploy | |
:group group | |
:rev rev}))] | |
(let [deployment-results (map check-status-loop execution-arns)] | |
(doall (map (fn [r] (infof "Deployment Complete: %s" r)) deployment-results)) | |
(System/exit 0)))) | |
(defn -main [& [deploy-group]] | |
(infof "Pushing to Code Deploy") | |
(let [{:keys [rev deploy-groups dependency-conflicts] :as push-result} (push)] | |
(infof "Deploying revision %s" rev) | |
(deploy (assoc push-result :deploy-groups [deploy-group])))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:alises {:deploy-to-aws {:main-opts ["-m" "app.deploy"] | |
:extra-deps {com.datomic/ion-dev {:mvn/version "0.9.265"}}}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run from the command line: