Pin VPS deploy to /root/periscope only.
Refuse update-periscope.sh unless dirname resolves to the canonical checkout, set compose project name periscope, and document that the GitHub clone URL may still be manvalan/pinscope.
This commit is contained in:
@@ -1,24 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
# Rebuild and restart the Periscope stack on the production host
|
||||
# (periscope.michelebigi.it). Run from anywhere:
|
||||
# (periscope.michelebigi.it).
|
||||
#
|
||||
# Canonical live checkout (one tree only):
|
||||
# /root/periscope
|
||||
# Clone URL may still be github.com/manvalan/pinscope — clone into that path:
|
||||
# git clone git@github.com:manvalan/pinscope.git /root/periscope
|
||||
#
|
||||
# Resolve the repo root from this script's location only (no find):
|
||||
# cd /root/periscope
|
||||
# ./scripts/update-periscope.sh
|
||||
# or:
|
||||
# /root/periscope/scripts/update-periscope.sh
|
||||
#
|
||||
# Optional:
|
||||
# SITE=https://periscope.michelebigi.it ./scripts/update-periscope.sh
|
||||
# ./scripts/update-periscope.sh --no-pull
|
||||
# CANONICAL_ROOT=/other/periscope ./scripts/update-periscope.sh
|
||||
#
|
||||
# Does not touch ./data (projects + component library).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SITE="${SITE:-https://periscope.michelebigi.it}"
|
||||
CANONICAL_ROOT="${CANONICAL_ROOT:-/root/periscope}"
|
||||
DO_PULL=1
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--no-pull) DO_PULL=0 ;;
|
||||
-h|--help)
|
||||
sed -n '2,12p' "$0"
|
||||
sed -n '2,22p' "$0"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
@@ -35,6 +46,14 @@ cd "$ROOT"
|
||||
log() { printf '\n==> %s\n' "$*"; }
|
||||
die() { printf 'error: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
if [[ "$ROOT" != "$CANONICAL_ROOT" ]]; then
|
||||
die "Checkout is $ROOT; live deploy must be $CANONICAL_ROOT.
|
||||
Stop compose in the old tree (often /root/pinscope), move or clone this
|
||||
repo to $CANONICAL_ROOT (keep .env and data/), then run
|
||||
$CANONICAL_ROOT/scripts/update-periscope.sh
|
||||
Override only if the host layout differs: CANONICAL_ROOT=$ROOT $0"
|
||||
fi
|
||||
|
||||
if [[ "${ENVIRONMENT:-}" == "production" ]]; then
|
||||
die "ENVIRONMENT=production is set. The backend will refuse to start without Clerk. Unset it for this self-hosted instance."
|
||||
fi
|
||||
@@ -43,6 +62,8 @@ if [[ ! -f docker-compose.yml ]]; then
|
||||
die "docker-compose.yml not found in $ROOT — run this from the Periscope checkout."
|
||||
fi
|
||||
|
||||
log "checkout $ROOT (compose project: periscope)"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose "$@"
|
||||
|
||||
Reference in New Issue
Block a user