Files
loki/scripts/db/deploy-host.sh
T
Mao NakamotoandClaude Opus 4.8 c6bc058cb4 chore: purge Vercel / Neon / managed-Supabase across the codebase
Self-hosted on Hetzner is the only reality now; the leftover references were
stale at best and a security hole at worst. Thorough sweep across code, config,
scripts, docs, and comments (84+ files). Self-hosted supabase.orangecat.ch is
kept; historical migration records stay accurate.

Functional / security fixes:
- cron-auth: prod detection was process.env.VERCEL (unset on the box!), so the
  fail-closed 'CRON_SECRET unset -> 503' gate never fired in production. Now
  keys on NODE_ENV=production. (security)
- auth trustHost: dropped the dead process.env.VERCEL===1 branch.
- AppFooter: read the baked-in build SHA instead of VERCEL_GIT_COMMIT_SHA/ENV.
- project bootstrap: removed 'neon projects create' + the Vercel deploy brief;
  DB option is now self-hosted Postgres, deploy guidance is the self-hosted flow.
- db-url: removed the legacy NEON_DATABASE_URL* fallbacks (+ updated its test).

Infra / removals:
- deleted .github/workflows/vercel-deploy.yml and scripts/db/dump-from-{neon,supabase}.sh.
- stripped NEON_* env fallbacks from db dump/restore/sync scripts.

User-facing:
- desktop offline overlay no longer blames a 'Vercel hiccup'; privacy page +
  PRIVACY_POLICY subprocessors now say Hetzner self-hosted / self-hosted Postgres.

Plus ~50 comment/doc rewrites (Vercel -> the cloud host/the box; Neon -> Postgres).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:46:43 +02:00

37 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Bootstrap Postgres host on a fresh Hetzner Ubuntu VM.
#
# Usage (on the VM):
# curl -fsSL https://raw.githubusercontent.com/.../deploy-host.sh | bash
# Or copy infra/postgres-host/ to the VM and run:
# cd infra/postgres-host && cp .env.example .env && $EDITOR .env && ./deploy-host.sh
#
# After deploy:
# DATABASE_URL=postgresql://studio:PASS@HOST:5432/cockpit
# DATABASE_POOL_URL=postgresql://studio:PASS@HOST:6432/cockpit
# The app connects over localhost on the same box, so keep :5432/:6432 bound
# to localhost only. Open the firewall (or use a tunnel) only for remote access.
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HOST_DIR="$DIR/../../infra/postgres-host"
if [ ! -f "$HOST_DIR/.env" ]; then
echo "Create $HOST_DIR/.env from .env.example first." >&2
exit 2
fi
if ! command -v docker >/dev/null 2>&1; then
echo "Installing Docker..."
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker "$USER" 2>/dev/null || true
fi
chmod +x "$HOST_DIR/init/"*.sh 2>/dev/null || true
docker compose -f "$HOST_DIR/docker-compose.yml" --env-file "$HOST_DIR/.env" up -d
echo ""
echo "Postgres host is up (localhost-only ports bound — open firewall or tunnel for remote access)."
echo "Next: set DATABASE_URL in the app .env → push schema with npm run migrate"