Files
Nexus/restart.sh
T
Hartmut 01f8974314
CI / Architecture Guardrails (pull_request) Successful in 2m59s
CI / Typecheck (pull_request) Successful in 6m41s
CI / Lint (pull_request) Successful in 4m18s
CI / Assistant Split Regression (pull_request) Successful in 5m6s
CI / Unit Tests (pull_request) Successful in 7m21s
CI / Build (pull_request) Successful in 5m21s
CI / Fresh-Linux Docker Deploy (pull_request) Failing after 38s
CI / E2E Tests (pull_request) Successful in 3m28s
CI / Release Images (pull_request) Has been skipped
rename(phase 3): compose/DB/infra names + stray code refs capakraken → nexus
- docker-compose.yml / .prod.yml / .ci.yml: project names, POSTGRES_DB/USER,
  pg_isready, DATABASE_URL, volume names (nexus_pgdata, nexus_prod_*)
- .github/workflows/ci.yml: POSTGRES_PASSWORD, pg_isready, psql credentials,
  GRANT statements, POSTGRES_PASSWORD=nexus_dev for Docker Deploy job
- scripts/db-target-guard.mjs: expectedDatabase default, NEXUS_EXPECTED_DB_NAME
- scripts/prisma-with-env.mjs, e2e/test-server.mjs: env-var rename
- packages/db/src/safe-destructive-env.ts + reset-dispo-import.ts: DB name set
- packages/db/src/destructive-db-guard.ts: PROTECTED_DATABASE_NAMES → "nexus"
- packages/db/src/destructive-db-guard.test.ts: all fixture DB names + comments
- .env.example, tooling/deploy/deploy.env.example: DATABASE_URL, image refs
- packages/api: Redis channel/key prefixes (rbac-invalidate, sse, ratelimit),
  logger service name, app-base-url log prefix
- E2E: DB container names, localStorage/sessionStorage keys, email domains
- scripts: architecture-guardrails filter, export/import-dev-seed defaults,
  harden-postgres defaults, start.sh pg_isready, worktree-hygiene fixture
- tooling/migrate/rename-to-nexus.sh: new maintenance-window cutover script

Only intentional capakraken survivor: anonymization.ts DEFAULT_ANONYMIZATION_SEED
(functional cryptographic constant — changing it would invalidate stored aliases).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 16:35:39 +02:00

51 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# restart.sh — Rebuild the CapaKraken app container from scratch.
#
# When to use:
# - After changing pnpm-lock.yaml (new/removed dependencies)
# - After Prisma schema changes
# - After Dockerfile.dev changes
# - When you see "Cannot find module" errors in the app container
#
# A plain `docker compose restart` only restarts the existing container — it
# does NOT rebuild the image or reinstall dependencies.
#
# How it works:
# The startup script (tooling/docker/app-dev-start.sh) runs `pnpm install`
# at boot to reconcile host-side workspace symlinks with the container's
# pnpm store in the named volume. This script rebuilds the Docker image
# (which re-runs pnpm install into the image layer), then optionally purges
# stale named volumes so the startup install starts fresh.
#
# Usage:
# ./restart.sh # rebuild app image and restart
# ./restart.sh --clean # also remove node_modules + .next volumes
# ./restart.sh --full # --clean + recreate all services (postgres, redis, etc.)
set -euo pipefail
PROFILE="full"
SERVICES="app"
CLEAN=false
for arg in "$@"; do
case "$arg" in
--clean) CLEAN=true ;;
--full) CLEAN=true; SERVICES="" ;; # empty = all services in the profile
esac
done
echo "==> Stopping app container..."
docker compose --profile "$PROFILE" stop app 2>/dev/null || true
if $CLEAN; then
echo "==> Removing stale node_modules and .next volumes..."
docker volume rm nexus_node_modules nexus_next 2>/dev/null || true
fi
echo "==> Rebuilding and starting ($( [[ -z "$SERVICES" ]] && echo "all services" || echo "$SERVICES" ))..."
docker compose --profile "$PROFILE" up --build -d $SERVICES
echo "==> Tailing logs (Ctrl-C to detach)..."
docker compose --profile "$PROFILE" logs -f app