feat: unify on single repo-root compose file for dev and prod
This commit is contained in:
parent
9acdbaa453
commit
af993bd43f
18 changed files with 253 additions and 229 deletions
|
|
@ -1,22 +1,30 @@
|
|||
#!/bin/bash
|
||||
# Dev-only setup (runs via postCreateCommand in the attached `api` container).
|
||||
# Production needs none of this: images carry their dependencies and the
|
||||
# api entrypoint migrates on every start.
|
||||
set -e
|
||||
|
||||
REPO=/srv/kirche-einfach
|
||||
|
||||
echo "=== Setting up kirche-einfach ==="
|
||||
|
||||
# Backend
|
||||
# Backend deps into the venv volume (setup runs via sudo; handed to vscode below).
|
||||
echo "--- Installing Python dependencies ---"
|
||||
cd /workspaces/kirche-einfach/backend
|
||||
cd "$REPO/backend"
|
||||
uv sync
|
||||
|
||||
# Frontend
|
||||
echo "--- Installing Node dependencies ---"
|
||||
cd /workspaces/kirche-einfach/frontend
|
||||
npm install
|
||||
# opencode CLI (dev tooling; intentionally not baked into the image).
|
||||
if [ ! -x /home/vscode/.opencode/bin/opencode ]; then
|
||||
echo "--- Installing opencode ---"
|
||||
su vscode -c "curl -fsSL https://opencode.ai/install | bash"
|
||||
ln -sf /home/vscode/.opencode/bin/opencode /usr/local/bin/opencode
|
||||
fi
|
||||
|
||||
# Compose services (langflow, lfx) must be up; fail loudly otherwise.
|
||||
# (api/frontend are starting alongside this script.)
|
||||
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
|
||||
if [ ! -f "$REPO/.env" ]; then
|
||||
echo "ERROR: $REPO/.env is missing. Copy .env.example to .env and fill in secrets." >&2
|
||||
exit 1
|
||||
fi
|
||||
python3 - <<'EOF'
|
||||
|
|
@ -45,19 +53,17 @@ if pending:
|
|||
sys.exit(f"ERROR: compose services not ready: {sorted(pending)}")
|
||||
EOF
|
||||
|
||||
# Migrate the SQLite schema and reconcile backend/flows into the DB + LFX.
|
||||
echo "--- Migrating database ---"
|
||||
cd /workspaces/kirche-einfach/backend
|
||||
uv run alembic upgrade head
|
||||
|
||||
# Reconcile backend/flows into the DB + LFX (schema is migrated by the api
|
||||
# entrypoint on every start).
|
||||
echo "--- Syncing canonical flows ---"
|
||||
cd "$REPO/backend"
|
||||
uv run python scripts/sync_flows.py --sync || echo "WARN: flow sync failed (check backend/flows and LFX)"
|
||||
|
||||
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 \
|
||||
# Hand dirs back to vscode (this script runs via sudo; uv creates caches as root)
|
||||
chown -R vscode:vscode "$REPO/backend/.venv" \
|
||||
"$REPO/frontend/node_modules" \
|
||||
/home/vscode/.cache 2>/dev/null || true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue