Files
watermaps/deploy/scripts/remote-go-live.sh
T
BuTzZ 2064570913
Test and publish container images / test (push) Successful in 2m43s
Test and publish container images / publish (push) Successful in 2m56s
Automate immutable production deployments
2026-07-29 13:00:50 +02:00

49 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
WM_DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=remote-common.sh
source "$WM_DEPLOY_DIR/scripts/remote-common.sh"
server_ipv4=""
identity_file=""
while [[ "$#" -gt 0 ]]; do
case "$1" in
--host)
[[ "$#" -ge 2 ]] || wm_local_die "Wert für --host fehlt."
server_ipv4="$2"
shift 2
;;
--identity)
[[ "$#" -ge 2 ]] || wm_local_die "Wert für --identity fehlt."
identity_file="$2"
shift 2
;;
--user)
[[ "$#" -ge 2 ]] || wm_local_die "Wert für --user fehlt."
WATERMAPS_SSH_USER="$2"
export WATERMAPS_SSH_USER
shift 2
;;
-h|--help)
printf 'Verwendung: %s [--host IPV4] [--identity DATEI] [--user BENUTZER]\n' "$0"
exit 0
;;
*)
wm_local_die "Unbekannte Option: $1"
;;
esac
done
wm_local_resolve_ssh "$server_ipv4" "$identity_file"
wm_local_wait_for_ssh
remote_prefix=""
if [[ -n "$WM_REMOTE_SUDO" ]]; then
remote_prefix="$WM_REMOTE_SUDO "
fi
ssh "${WM_SSH_OPTIONS[@]}" "$WM_SSH_TARGET" \
"${remote_prefix}WATERMAPS_ENV_FILE=/opt/watermaps/deploy/.env.production WATERMAPS_IMAGES_ENV_FILE=/opt/watermaps/deploy/.env.images /opt/watermaps/current/deploy/scripts/go-live.sh '$WM_SERVER_IPV4'"