Add Traefik route and launchd agent for peppa.telecom.quest
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5184fc214c
commit
145eb2311a
@ -14,4 +14,4 @@ TELEGRAM_BOT_TOKEN=
|
||||
TELEGRAM_PM_CHAT_ID=
|
||||
|
||||
# Public URL of the web platform
|
||||
PEPPA_WEB_URL=http://localhost:3100
|
||||
PEPPA_WEB_URL=https://peppa.telecom.quest
|
||||
|
||||
16
infra/traefik/peppa.yml
Normal file
16
infra/traefik/peppa.yml
Normal file
@ -0,0 +1,16 @@
|
||||
# Peppa — софтвейр-фабрика (веб-платформа).
|
||||
# Источник: /Users/telecom/Dev/Peppa — Next.js на хосте, порт 3100 (launchd quest.telecom.peppa.web).
|
||||
# Копия этого файла кладётся в /Users/timur/Dev/_Zorro/_INFRA/traefik/dynamic/ — Traefik подхватит по file-watch.
|
||||
http:
|
||||
routers:
|
||||
peppa:
|
||||
rule: "Host(`peppa.telecom.quest`)"
|
||||
service: peppa
|
||||
entryPoints: [web]
|
||||
priority: 30
|
||||
middlewares: [compress]
|
||||
services:
|
||||
peppa:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://host.docker.internal:3100"
|
||||
@ -1,32 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs the Peppa watchdog as a launchd agent (starts at login, restarts on crash).
|
||||
# caffeinate -i keeps the Mac from idle-sleeping while the watchdog runs.
|
||||
# Remove: launchctl bootout gui/$(id -u)/quest.telecom.peppa.watchdog && rm the plist.
|
||||
# Installs Peppa's launchd agents (start at login, restart on crash):
|
||||
# quest.telecom.peppa.watchdog — session watchdog under caffeinate -i (no idle sleep)
|
||||
# quest.telecom.peppa.web — Next.js platform on :3100 (needs `pnpm --filter @peppa/web build`)
|
||||
# Usage: scripts/install-launchd.sh [watchdog] [web] (default: both)
|
||||
# Remove: launchctl bootout gui/$(id -u)/<label> && rm ~/Library/LaunchAgents/<label>.plist
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LABEL=quest.telecom.peppa.watchdog
|
||||
PLIST="$HOME/Library/LaunchAgents/$LABEL.plist"
|
||||
mkdir -p "$HOME/Library/LaunchAgents" "$HOME/.peppa"
|
||||
cat > "$PLIST" <<PLIST
|
||||
PATH_ENV="$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
|
||||
install_agent() { # label log workdir args...
|
||||
local label=$1 log=$2 workdir=$3; shift 3
|
||||
local plist="$HOME/Library/LaunchAgents/$label.plist" args=""
|
||||
for a in "$@"; do args+=" <string>$a</string>"$'\n'; done
|
||||
cat > "$plist" <<PLIST
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key><string>$LABEL</string>
|
||||
<key>Label</key><string>$label</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/bin/caffeinate</string><string>-i</string>
|
||||
<string>$ROOT/packages/cli/bin/peppa</string><string>watchdog</string>
|
||||
</array>
|
||||
$args </array>
|
||||
<key>WorkingDirectory</key><string>$workdir</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict><key>PATH</key><string>$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string></dict>
|
||||
<dict><key>PATH</key><string>$PATH_ENV</string></dict>
|
||||
<key>RunAtLoad</key><true/>
|
||||
<key>KeepAlive</key><true/>
|
||||
<key>StandardOutPath</key><string>$HOME/.peppa/watchdog.log</string>
|
||||
<key>StandardErrorPath</key><string>$HOME/.peppa/watchdog.log</string>
|
||||
<key>StandardOutPath</key><string>$HOME/.peppa/$log</string>
|
||||
<key>StandardErrorPath</key><string>$HOME/.peppa/$log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
launchctl bootout "gui/$(id -u)/$LABEL" 2>/dev/null || true
|
||||
launchctl bootstrap "gui/$(id -u)" "$PLIST"
|
||||
echo "watchdog installed: $PLIST (log: ~/.peppa/watchdog.log)"
|
||||
launchctl bootout "gui/$(id -u)/$label" 2>/dev/null || true
|
||||
launchctl bootstrap "gui/$(id -u)" "$plist"
|
||||
echo "installed $label (log: ~/.peppa/$log)"
|
||||
}
|
||||
|
||||
SERVICES=("$@")
|
||||
[ ${#SERVICES[@]} -eq 0 ] && SERVICES=(watchdog web)
|
||||
for s in "${SERVICES[@]}"; do
|
||||
case "$s" in
|
||||
watchdog)
|
||||
install_agent quest.telecom.peppa.watchdog watchdog.log "$ROOT" \
|
||||
/usr/bin/caffeinate -i "$ROOT/packages/cli/bin/peppa" watchdog ;;
|
||||
web)
|
||||
install_agent quest.telecom.peppa.web web.log "$ROOT/apps/web" \
|
||||
/bin/bash -c "set -a; . '$ROOT/.env'; set +a; exec '$ROOT/apps/web/node_modules/.bin/next' start -p 3100" ;;
|
||||
*) echo "unknown service $s" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user