fix: postCreate failures (absolute paths, sudo HOME, socket-wait bug)

This commit is contained in:
Jonas Miederer 2026-09-11 19:21:13 +02:00
parent d4aeab8dbf
commit 80d81b8022
2 changed files with 10 additions and 5 deletions

View file

@ -23,8 +23,11 @@
} }
}, },
"overrideCommand": false, "overrideCommand": false,
"postCreateCommand": "sudo -E bash .devcontainer/setup.sh", // Absolute paths: lifecycle commands run in the image WORKDIR
"postStartCommand": "bash .devcontainer/postStart.sh", // (/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": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [

View file

@ -11,8 +11,10 @@ REPO=/srv/kirche-einfach
# UV_PROJECT_ENVIRONMENT/UV_PYTHON_INSTALL_DIR plus every compose-provided # UV_PROJECT_ENVIRONMENT/UV_PYTHON_INSTALL_DIR plus every compose-provided
# variable — uv then created a project-local backend/.venv in the bind-mount # 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.) # 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() { as_vscode() {
sudo -u vscode -E bash -c "$*" sudo -H -u vscode -E bash -c "$*"
} }
# Venv lives outside the bind-mount (see backend/Dockerfile). # Venv lives outside the bind-mount (see backend/Dockerfile).
@ -71,13 +73,13 @@ targets = [("langflow", 7860), ("lfx", 6004)]
deadline = time.time() + 180 deadline = time.time() + 180
pending = dict(targets) pending = dict(targets)
while pending and time.time() < deadline: while pending and time.time() < deadline:
for host, port in list(pending): for host, port in list(pending.items()):
s = socket.socket() s = socket.socket()
s.settimeout(2) s.settimeout(2)
try: try:
s.connect((host, port)) s.connect((host, port))
print(f"OK {host}:{port}", flush=True) print(f"OK {host}:{port}", flush=True)
del pending[(host, port)] del pending[host]
except OSError: except OSError:
pass pass
finally: finally: