Created
November 12, 2015 11:13
-
-
Save frankiesardo/e7a05d75e52a9893fc06 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env boot | |
(set-env! | |
:dependencies '[[com.datomic/datomic-pro "0.9.5302"] | |
[com.datomic/datomic-transactor-pro "0.9.5302"]] | |
:repositories {"my.datomic.com" | |
{:url "https://my.datomic.com/repo" | |
:username "..." | |
:password "..."}}) | |
(require '[datomic.api :as d]) | |
(require '[datomic.backup-cli :refer [backup restore]]) | |
(def bucket-uri "...") | |
(def staging-uri "...") | |
(def prod-uri "...") | |
(def transactor-id "...") | |
(defn backup-prod [] | |
(backup {:from-db-uri prod-uri | |
:to-backup-uri bucket-uri})) | |
(defn restart-transactor [] | |
(clojure.java.shell/sh "aws" "ec2" "reboot-instances" "--instance-ids" transactor-id)) | |
(defn restore-staging [] | |
(d/delete-database staging-uri) | |
(restore {:from-backup-uri bucket-uri | |
:to-db-uri staging-uri}) | |
(restart-transactor)) | |
(defn -main [& args] | |
(backup-prod) | |
(restore-staging)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment