diff options
author | EuAndreh <eu@euandre.org> | 2023-03-11 08:53:30 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-11 19:36:12 -0300 |
commit | 786d6958a5733b28ec089685df7c0eac980c5f2a (patch) | |
tree | 9afb19eda6db66f68f5a914aa4fa38fde8b0d9b5 /src/infrastructure/scripts/deploy.sh | |
parent | channels.scm: Remove "nonguix" channel (diff) | |
download | toph-786d6958a5733b28ec089685df7c0eac980c5f2a.tar.gz toph-786d6958a5733b28ec089685df7c0eac980c5f2a.tar.xz |
Copy files back
Diffstat (limited to 'src/infrastructure/scripts/deploy.sh')
-rwxr-xr-x | src/infrastructure/scripts/deploy.sh | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/infrastructure/scripts/deploy.sh b/src/infrastructure/scripts/deploy.sh new file mode 100755 index 0000000..65a50c1 --- /dev/null +++ b/src/infrastructure/scripts/deploy.sh @@ -0,0 +1,71 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + deploy + deploy -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Do a blue/green deployment of the relevant service. It makes + sure that the new service is up and running before shutting + down the old one. + + + Examples: + + Just do the deploy: + + $ deploy + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +if [ "$(id -un)" != 'root' ]; then + printf 'This script must be run as root.\n\n' >&2 + usage >&2 + exit 2 +fi + + +: sudo herd restart a-service |