Includes homelab deploy tooling, image position/zoom manifest persistence, and full trading/casino stack. Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
1.3 KiB
Bash
33 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# Ohne systemd/sudo: Dateien nach ~/playbull kopieren und npm install.
|
|
# Auf dem Homelab: cd ~/bestewebsite/bestewebsite && bash deploy/sync-user.sh
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SRC="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
# shellcheck source=/dev/null
|
|
[[ -f "${SCRIPT_DIR}/env.homelab" ]] && source "${SCRIPT_DIR}/env.homelab"
|
|
APP_DIR="${APP_DIR:-/home/gizzler/bestewebsite/bestewebsite}"
|
|
APP_PORT="${APP_PORT:-3080}"
|
|
|
|
mkdir -p "${APP_DIR}"
|
|
rsync -a --delete \
|
|
--exclude node_modules --exclude data --exclude .git \
|
|
"${SRC}/" "${APP_DIR}/"
|
|
|
|
cd "${APP_DIR}"
|
|
command -v node >/dev/null || { echo "Node.js fehlt (v24+)."; exit 1; }
|
|
npm install --omit=dev
|
|
|
|
ENV="${APP_DIR}/.env"
|
|
touch "${ENV}"
|
|
grep -q '^PORT=' "${ENV}" 2>/dev/null && sed -i "s/^PORT=.*/PORT=${APP_PORT}/" "${ENV}" || echo "PORT=${APP_PORT}" >> "${ENV}"
|
|
grep -q '^TRUST_PROXY=' "${ENV}" 2>/dev/null || echo "TRUST_PROXY=1" >> "${ENV}"
|
|
|
|
echo ""
|
|
echo "=== Sync fertig: ${APP_DIR} ==="
|
|
echo "Start (Test): cd ${APP_DIR} && node server/index.js"
|
|
echo "Dauerbetrieb: bash deploy/finish-on-server.sh (sudo + systemd)"
|
|
echo ""
|
|
echo "Falls schon laeuft: pkill -f 'node server/index.js' ; cd ${APP_DIR} && nohup node server/index.js >> data/server.log 2>&1 &"
|