apps/admin/: - Nuxt 4.1.3 + @nuxt/ui 4 + @nuxtjs/supabase, port 3017 staging - 7 pages: index (59 LOC dashboard), login (72 LOC), auth/confirm, plus stubs für domains/users/stats/moderation (14-17 LOC each, content für separate Phase 2 Session) - composables/useAdminAuth.ts: Supabase login + verifyAdminRole hook - middleware/admin-auth.ts: route guard (Phase 3 backend-check ready) - layouts/default.vue, app.vue, README.md - nuxt.config.ts: SSR=true, port 3017, dark-mode preference, Supabase pkce-flow, runtimeConfig.adminSecret für Phase 3 backend-binding Deploy-Infrastructure: - .github/workflows/deploy-admin-staging.yml: build admin auf push to main mit path-filter apps/admin/**, scp tar zu Server, atomic-mv + pm2 restart - scripts/deploy-admin-from-artifact.sh: Server-side deploy (extract, atomic mv, pm2 reload). Kein prisma-migrate (admin hat kein eigenes DB-Schema). - apps/admin/start-admin-staging.sh: pm2 start-script mit Infisical-wrapper, port 3017, mappt Infisical SUPABASE_URL/KEY auf NUXT_PUBLIC_* - ecosystem.config.js: rebreak-admin-staging Eintrag (port 3017, max_memory_restart 400M) - ops/nginx/admin-staging.rebreak.org.conf: HTTP→HTTPS redirect, SSL paths, proxy auf 127.0.0.1:3017, noindex header Pending User-Actions für go-live: 1. DNS-A-Record admin.staging.rebreak.org → 49.13.55.22 2. SSL-cert via certbot (oder bestehender wildcard *.staging.rebreak.org) 3. nginx-config auf Server aktivieren (sudo cp + ln + reload) 4. pm2 initial start: pm2 start ecosystem.config.js --only rebreak-admin-staging 5. Infisical-secret ADMIN_SECRET (server-only, Phase 3 binding) GH-Actions: keine neuen Secrets (nutzt bestehende HETZNER_SSH_KEY/HOST/USER) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
112 lines
3.6 KiB
JavaScript
112 lines
3.6 KiB
JavaScript
/**
|
||
* ecosystem.config.js – PM2 Prozess-Konfiguration für Rebreak
|
||
* (backend/-Layout, post-cutover)
|
||
*
|
||
* Repo-Root: /srv/rebreak
|
||
* Backend: /srv/rebreak/backend (standalone Nitro)
|
||
* Node: /root/.nvm/versions/node/v24.11.1/bin/node
|
||
*
|
||
* Aktivierung auf Server:
|
||
* pm2 startOrReload /srv/rebreak/ecosystem.config.js
|
||
*/
|
||
|
||
const NODE_BIN = "/root/.nvm/versions/node/v24.11.1/bin/node";
|
||
const REPO_ROOT = "/srv/rebreak";
|
||
const APP_DIR = `${REPO_ROOT}/backend`;
|
||
|
||
module.exports = {
|
||
apps: [
|
||
// ─── Rebreak Staging (Nitro standalone) ────────────────────────────────
|
||
{
|
||
name: "rebreak-staging",
|
||
script: `${APP_DIR}/start-staging.sh`,
|
||
interpreter: "bash",
|
||
cwd: APP_DIR,
|
||
instances: 1,
|
||
autorestart: true,
|
||
watch: false,
|
||
max_memory_restart: "700M",
|
||
env: {
|
||
NODE_ENV: "production",
|
||
PORT: "3016",
|
||
NITRO_PORT: "3016",
|
||
},
|
||
},
|
||
|
||
// ─── Rebreak Prod (Nitro standalone) ───────────────────────────────────
|
||
// Wird erst aktiviert wenn Phase 3 (DNS-Cutover) abgeschlossen ist.
|
||
// start-prod.sh wird analog start-staging.sh aufgesetzt
|
||
// (existiert noch nicht im backend/ — nicht-blockierend für Cutover).
|
||
// Start: pm2 start ecosystem.config.js --only rebreak
|
||
// {
|
||
// name: "rebreak",
|
||
// script: `${APP_DIR}/start-prod.sh`,
|
||
// interpreter: "bash",
|
||
// cwd: APP_DIR,
|
||
// instances: 1,
|
||
// autorestart: true,
|
||
// watch: false,
|
||
// max_memory_restart: "700M",
|
||
// env: {
|
||
// NODE_ENV: "production",
|
||
// PORT: "3015",
|
||
// NITRO_PORT: "3015",
|
||
// },
|
||
// },
|
||
|
||
// ─── Admin Staging (Nuxt 4 SSR, port 3017) ────────────────────────────
|
||
// Wird einmalig via SSH initial gestartet (pm2 start ecosystem.config.js --only rebreak-admin-staging).
|
||
// Danach: deploy-admin-from-artifact.sh uebernimmt Restarts.
|
||
// start-admin-staging.sh: infisical run + node .output-staging/server/index.mjs
|
||
{
|
||
name: "rebreak-admin-staging",
|
||
script: `${REPO_ROOT}/apps/admin/start-admin-staging.sh`,
|
||
interpreter: "bash",
|
||
cwd: `${REPO_ROOT}/apps/admin`,
|
||
instances: 1,
|
||
autorestart: true,
|
||
watch: false,
|
||
max_memory_restart: "400M",
|
||
env: {
|
||
NODE_ENV: "production",
|
||
PORT: "3017",
|
||
NITRO_PORT: "3017",
|
||
},
|
||
},
|
||
|
||
// ─── Webhook-Listener ──────────────────────────────────────────────────
|
||
{
|
||
name: "rebreak-webhook",
|
||
script: `${REPO_ROOT}/scripts/deploy-webhook/server.mjs`,
|
||
interpreter: NODE_BIN,
|
||
cwd: REPO_ROOT,
|
||
instances: 1,
|
||
autorestart: true,
|
||
watch: false,
|
||
max_memory_restart: "128M",
|
||
},
|
||
|
||
// ─── DNS-Blocker (auskommentiert bis DNS-Daemons aufgesetzt sind) ──────
|
||
// {
|
||
// name: "dns-rebreak",
|
||
// script: `${APP_DIR}/server/dns/start-prod.sh`,
|
||
// interpreter: "bash",
|
||
// cwd: `${APP_DIR}/server/dns`,
|
||
// instances: 1,
|
||
// autorestart: true,
|
||
// watch: false,
|
||
// max_memory_restart: "512M",
|
||
// },
|
||
// {
|
||
// name: "dns-rebreak-staging",
|
||
// script: `${APP_DIR}/server/dns/start-staging.sh`,
|
||
// interpreter: "bash",
|
||
// cwd: `${APP_DIR}/server/dns`,
|
||
// instances: 1,
|
||
// autorestart: true,
|
||
// watch: false,
|
||
// max_memory_restart: "512M",
|
||
// },
|
||
],
|
||
};
|