#!/bin/bash set -e echo "=== Setting up kirche-einfach ===" # Backend echo "--- Installing Python dependencies ---" cd /workspaces/kirche-einfach/backend uv sync # Frontend echo "--- Installing Node dependencies ---" cd /workspaces/kirche-einfach/frontend npm install # Compose services (db, langflow, lfx) must be up; fail loudly otherwise. echo "--- Waiting for compose services ---" if [ ! -f /workspaces/kirche-einfach/.env ]; then echo "ERROR: /workspaces/kirche-einfach/.env is missing. Copy .env.example to .env and fill in secrets." >&2 exit 1 fi python3 - <<'EOF' import socket import sys import time targets = [("db", 5432), ("langflow", 7860), ("lfx", 6004)] deadline = time.time() + 180 pending = dict(targets) while pending and time.time() < deadline: for host, port in list(pending): s = socket.socket() s.settimeout(2) try: s.connect((host, port)) print(f"OK {host}:{port}", flush=True) del pending[(host, port)] except OSError: pass finally: s.close() if pending: time.sleep(2) if pending: sys.exit(f"ERROR: compose services not ready: {sorted(pending)}") EOF echo "" echo "=== Setup complete ===" echo "Forgejo username: $FORGEJO_USERNAME" # Hand dirs back to vscode (this script runs via sudo; uv/npm create caches as root) chown -R vscode:vscode /workspaces/kirche-einfach/backend/.venv \ /workspaces/kirche-einfach/frontend/node_modules \ /home/vscode/.cache 2>/dev/null || true