summaryrefslogtreecommitdiff
path: root/src/scripts/deploy.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-10-08 08:26:37 -0300
committerEuAndreh <eu@euandre.org>2023-11-25 12:14:34 -0300
commite406d80377858f37ce683163b2b0ce45e59cfe9f (patch)
treeac2a4ba2543cc1b2507e8aa57acfc039e71cf3c8 /src/scripts/deploy.sh
parentInitial empty commit (diff)
downloadasami-e406d80377858f37ce683163b2b0ce45e59cfe9f.tar.gz
asami-e406d80377858f37ce683163b2b0ce45e59cfe9f.tar.xz
Init server infrastructure files
Diffstat (limited to 'src/scripts/deploy.sh')
-rwxr-xr-xsrc/scripts/deploy.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/scripts/deploy.sh b/src/scripts/deploy.sh
new file mode 100755
index 0000000..dc30484
--- /dev/null
+++ b/src/scripts/deploy.sh
@@ -0,0 +1,72 @@
+#!/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 main 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
+
+
+echo FIXME