feat: add Docker/OpenTofu deployment and DE/NL routing
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
WM_DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
# shellcheck source=common.sh
|
||||
source "$WM_DEPLOY_DIR/scripts/common.sh"
|
||||
wm_load_env
|
||||
wm_assert_data_mount
|
||||
|
||||
if [[ "$(id -u)" -ne 0 ]]; then
|
||||
wm_die "Dieses Skript muss als root ausgeführt werden."
|
||||
fi
|
||||
|
||||
install -d -m 0755 \
|
||||
"$WATERMAPS_DATA_DIR/geofabrik" \
|
||||
"$WATERMAPS_DATA_DIR/local" \
|
||||
"$WATERMAPS_DATA_DIR/certbot/www" \
|
||||
"$WATERMAPS_DATA_DIR/certbot/letsencrypt" \
|
||||
"$WATERMAPS_RUNTIME_DIR/nginx/conf.d" \
|
||||
"$WATERMAPS_RUNTIME_DIR/locks"
|
||||
|
||||
wm_acquire_route_lock ||
|
||||
wm_die "Deployment abgebrochen, weil gerade Routingdaten aktualisiert werden."
|
||||
|
||||
if [[ ! -f "$WATERMAPS_RUNTIME_DIR/nginx/conf.d/default.conf" ]]; then
|
||||
install -m 0644 \
|
||||
"$WM_DEPLOY_DIR/nginx/bootstrap.conf" \
|
||||
"$WATERMAPS_RUNTIME_DIR/nginx/conf.d/default.conf"
|
||||
fi
|
||||
|
||||
wm_log "Anwendungsimage wird gebaut."
|
||||
wm_compose build watermaps
|
||||
wm_compose up --detach --remove-orphans watermaps nginx
|
||||
|
||||
wm_wait_for_health watermaps 240
|
||||
wm_wait_for_health nginx 120
|
||||
|
||||
route_rebuild_required=false
|
||||
update_args=()
|
||||
if [[ "${WATERMAPS_REBUILD_ROUTE_DATA:-false}" == "true" ]]; then
|
||||
route_rebuild_required=true
|
||||
update_args+=(--force)
|
||||
elif ! wm_route_data_ready; then
|
||||
route_rebuild_required=true
|
||||
fi
|
||||
|
||||
if [[ "$route_rebuild_required" == "true" ]]; then
|
||||
wm_log "Deutschland- und Niederlande-Routingdaten werden sicher vorbereitet."
|
||||
WATERMAPS_ROUTE_LOCK_HELD=true \
|
||||
"$WM_DEPLOY_DIR/scripts/update-route-data.sh" "${update_args[@]}"
|
||||
fi
|
||||
|
||||
wm_assert_route_data
|
||||
wm_wait_for_health watermaps 240
|
||||
wm_smoke_test_route
|
||||
|
||||
wm_log "Deployment ist bereit. Vor dem Livegang liefert Port 80 nur ACME-Challenges und ansonsten HTTP 404."
|
||||
Reference in New Issue
Block a user