Files
Moonbase/updater/update.sh
2026-06-15 22:22:32 -05:00

21 lines
734 B
Bash
Executable File

#!/bin/sh
# Triggered by the webhook sidecar when an admin clicks "Pull & rebuild".
# Runs the rebuild DETACHED so the webhook responds immediately — otherwise the
# app container (which the admin's browser is talking to) would be recreated
# mid-request. The app UI then polls /api/version until the new version answers.
#
# Only `app` is rebuilt: postgres and this updater are left running untouched.
set -e
nohup sh -c '
cd /appdata
echo "=== update $(date) ==="
git config --global --add safe.directory /appdata
git fetch origin master
git reset --hard origin/master
COMPOSE_PROJECT_NAME=moonbase docker compose up -d --build app
echo "=== done $(date) ==="
' >> /appdata/update.log 2>&1 &
echo "update started"