BlueGit

timfa questward

Files

questward / deploy / start-server.sh

start-server.sh

a75d35b0 History
start-server.sh 993 B Download Raw
1#!/usr/bin/env bash
2# Production process entrypoint for systemd.
3# Always updates the tree before starting Node so crash/power-loss recovery
4# can pick up a fix from origin (intentional — do not skip pull on crash).
5set -euo pipefail
6
7REPO="${QUESTWARD_REPO:-${TILE_MMO_REPO:-$(cd "$(dirname "$0")/.." && pwd)}}"
8BRANCH="${QUESTWARD_GIT_BRANCH:-${TILE_MMO_GIT_BRANCH:-master}}"
9cd "$REPO"
10
11echo "[deploy] Working tree: $REPO (branch $BRANCH)"
12git fetch origin "$BRANCH"
13git reset --hard "origin/$BRANCH"
14git clean -fd
15git pull --ff-only origin "$BRANCH" || true
16
17echo "[deploy] npm install…"
18npm install --omit=dev
19
20echo "[deploy] Submodules…"
21git submodule update --init --recursive
22
23echo "[deploy] Build client framework…"
24npm run build:client
25
26if [[ ! -f client/frameworkv3/js/framework.js ]]; then
27 echo "[deploy] ERROR: client/frameworkv3/js/framework.js missing after build." >&2
28 exit 1
29fi
30
31echo "[deploy] Starting server…"
32exec node --experimental-sqlite server/src/index.js