From 80d81b80229a335cd173b5a2326e75e47a03892a Mon Sep 17 00:00:00 2001 From: Jonas Miederer Date: Fri, 11 Sep 2026 19:21:13 +0200 Subject: [PATCH] fix: postCreate failures (absolute paths, sudo HOME, socket-wait bug) --- .devcontainer/devcontainer.json | 7 +++++-- .devcontainer/setup.sh | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 360eee8..2d14211 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,8 +23,11 @@ } }, "overrideCommand": false, - "postCreateCommand": "sudo -E bash .devcontainer/setup.sh", - "postStartCommand": "bash .devcontainer/postStart.sh", + // Absolute paths: lifecycle commands run in the image WORKDIR + // (/srv/kirche-einfach/backend), not the workspace folder — relative + // .devcontainer/... paths fail with "No such file or directory" (exit 127). + "postCreateCommand": "sudo -E bash /srv/kirche-einfach/.devcontainer/setup.sh", + "postStartCommand": "bash /srv/kirche-einfach/.devcontainer/postStart.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index dda5724..6cf642d 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -11,8 +11,10 @@ REPO=/srv/kirche-einfach # UV_PROJECT_ENVIRONMENT/UV_PYTHON_INSTALL_DIR plus every compose-provided # variable — uv then created a project-local backend/.venv in the bind-mount # instead of using /opt/venv, and sync_flows.py ran without its settings.) +# -H repoints HOME to /home/vscode: without it HOME stays /root (from the +# outer sudo) and uv/pip caches fail with Permission denied. as_vscode() { - sudo -u vscode -E bash -c "$*" + sudo -H -u vscode -E bash -c "$*" } # Venv lives outside the bind-mount (see backend/Dockerfile). @@ -71,13 +73,13 @@ targets = [("langflow", 7860), ("lfx", 6004)] deadline = time.time() + 180 pending = dict(targets) while pending and time.time() < deadline: - for host, port in list(pending): + for host, port in list(pending.items()): s = socket.socket() s.settimeout(2) try: s.connect((host, port)) print(f"OK {host}:{port}", flush=True) - del pending[(host, port)] + del pending[host] except OSError: pass finally: