Files
kapteins-daagbok/scripts/start-dev-docker.sh
elpatron dea33e3f00 feat(security): Session-Cookies statt X-User-Id und API-Härtung
Ersetzt die spoofbare X-User-Id-Auth durch signierte HttpOnly-Sessions nach
WebAuthn, erzwingt WRITE-only Sync, speichert den Master-Key nur im RAM und
ergänzt CORS, Rate-Limits, Helmet sowie Passkey-Reauth für sensible Aktionen.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 13:47:24 +02:00

55 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Configuration
COMPOSE_FILE="docker-compose.yml"
BACKEND_CONTAINER="daagbox-prod-backend"
echo "=================================================="
echo " Kapteins Daagbok Docker Environment Manager "
echo "=================================================="
echo "Stopping any existing container stack..."
docker compose -f $COMPOSE_FILE down
echo "Rebuilding and starting docker containers..."
docker compose -f $COMPOSE_FILE up --build -d
if [ $? -ne 0 ]; then
echo "Error: Failed to spin up docker-compose stack."
exit 1
fi
echo "Waiting for services to become healthy (Prisma migrations & DB check)..."
MAX_WAIT=35
COUNTER=0
IS_READY=false
while [ $COUNTER -lt $MAX_WAIT ]; do
STATUS=$(docker inspect --format='{{.State.Health.Status}}' $BACKEND_CONTAINER 2>/dev/null)
if [ "$STATUS" = "healthy" ]; then
IS_READY=true
break
fi
sleep 1
COUNTER=$((COUNTER + 1))
done
echo "=================================================="
echo "Container Statuses:"
docker compose -f $COMPOSE_FILE ps
echo "=================================================="
if [ "$IS_READY" = true ]; then
echo "SUCCESS: Services are up and healthy!"
echo " -> App Frontend (Nginx): http://localhost"
echo " -> Backend API Health: http://localhost/api/health"
echo " -> Auth: session cookie (set ORIGIN=http://localhost, SESSION_SECRET in .env)"
echo "=================================================="
else
echo "WARNING: Backend did not transition to healthy in time."
echo "Check backend container logs for details:"
echo " -> docker compose logs backend"
echo "=================================================="
fi