bug: dispatcher fails in edge container — lib/env.sh not available #119

Closed
opened 2026-04-01 17:37:28 +00:00 by dev-bot · 0 comments
Collaborator

Problem

The dispatcher (docker/edge/dispatcher.sh) sources lib/env.sh on line 23, but the edge container only has the dispatcher script and Caddy. The disinto codebase is not available.

/usr/local/bin/dispatcher.sh: line 23: /usr/local/../lib/env.sh: No such file or directory

Also, the dispatcher is not started — Caddy is PID 1 and the only process running.

Fix

Clone the disinto repo at a pinned tag on container startup. Create docker/edge/entrypoint-edge.sh:

#!/usr/bin/env bash
set -euo pipefail

DISINTO_VERSION="${DISINTO_VERSION:-main}"
DISINTO_REPO="${FORGE_URL:-http://forgejo:3000}/johba/disinto.git"

# Shallow clone at the pinned version
if [ ! -d /opt/disinto/.git ]; then
  git clone --depth 1 --branch "$DISINTO_VERSION" "$DISINTO_REPO" /opt/disinto
fi

# Start dispatcher in background
bash /opt/disinto/docker/edge/dispatcher.sh &

# Caddy as main process
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile

Update docker/edge/Dockerfile:

FROM caddy:alpine
RUN apk add --no-cache bash jq curl git docker-cli
COPY entrypoint-edge.sh /usr/local/bin/entrypoint-edge.sh
ENTRYPOINT ["bash", "/usr/local/bin/entrypoint-edge.sh"]

Update compose (in bin/disinto generate_compose):

  • Remove the dispatcher.sh bind mount (no longer needed)
  • Add DISINTO_VERSION and FORGE_URL environment variables
  • Keep Docker socket mount (dispatcher needs it to launch runner containers)

Why this approach

  • No bind mount — decoupled from host repo (aligns with #112 versioned releases)
  • Version-pinnedDISINTO_VERSION env var set during release, dispatcher runs the same code version as agents
  • Shallow clone — fast startup, minimal disk
  • No code duplication — dispatcher sources lib/env.sh from the cloned repo, CI duplicate detection stays clean
  • Caddy stays PID 1 — dispatcher is a background process, container stays healthy via Caddy

What about dispatcher restarts?

If the dispatcher crashes, it stays down until the container restarts. That is acceptable — the dispatcher polls every 60s and vault actions are not time-critical. If we need supervision later, add s6-overlay or a simple bash restart loop.

Affected files

  • docker/edge/entrypoint-edge.sh (new)
  • docker/edge/Dockerfile (update — add entrypoint, remove COPY dispatcher.sh)
  • bin/disinto generate_compose (update — remove dispatcher mount, add env vars)

Acceptance criteria

  • Edge container clones disinto repo at startup
  • Clone uses DISINTO_VERSION tag (or main as default)
  • Dispatcher starts as background process
  • Dispatcher can source lib/env.sh and vault/vault-env.sh
  • Dispatcher polls ops repo and detects TOML files
  • Caddy serves as PID 1
  • No bind mount for disinto repo
  • CI green
## Problem The dispatcher (`docker/edge/dispatcher.sh`) sources `lib/env.sh` on line 23, but the edge container only has the dispatcher script and Caddy. The disinto codebase is not available. ``` /usr/local/bin/dispatcher.sh: line 23: /usr/local/../lib/env.sh: No such file or directory ``` Also, the dispatcher is not started — Caddy is PID 1 and the only process running. ## Fix Clone the disinto repo at a pinned tag on container startup. Create `docker/edge/entrypoint-edge.sh`: ```bash #!/usr/bin/env bash set -euo pipefail DISINTO_VERSION="${DISINTO_VERSION:-main}" DISINTO_REPO="${FORGE_URL:-http://forgejo:3000}/johba/disinto.git" # Shallow clone at the pinned version if [ ! -d /opt/disinto/.git ]; then git clone --depth 1 --branch "$DISINTO_VERSION" "$DISINTO_REPO" /opt/disinto fi # Start dispatcher in background bash /opt/disinto/docker/edge/dispatcher.sh & # Caddy as main process exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile ``` Update `docker/edge/Dockerfile`: ```dockerfile FROM caddy:alpine RUN apk add --no-cache bash jq curl git docker-cli COPY entrypoint-edge.sh /usr/local/bin/entrypoint-edge.sh ENTRYPOINT ["bash", "/usr/local/bin/entrypoint-edge.sh"] ``` Update compose (in `bin/disinto` generate_compose): - Remove the dispatcher.sh bind mount (no longer needed) - Add `DISINTO_VERSION` and `FORGE_URL` environment variables - Keep Docker socket mount (dispatcher needs it to launch runner containers) ### Why this approach - **No bind mount** — decoupled from host repo (aligns with #112 versioned releases) - **Version-pinned** — `DISINTO_VERSION` env var set during release, dispatcher runs the same code version as agents - **Shallow clone** — fast startup, minimal disk - **No code duplication** — dispatcher sources lib/env.sh from the cloned repo, CI duplicate detection stays clean - **Caddy stays PID 1** — dispatcher is a background process, container stays healthy via Caddy ### What about dispatcher restarts? If the dispatcher crashes, it stays down until the container restarts. That is acceptable — the dispatcher polls every 60s and vault actions are not time-critical. If we need supervision later, add `s6-overlay` or a simple bash restart loop. ## Affected files - `docker/edge/entrypoint-edge.sh` (new) - `docker/edge/Dockerfile` (update — add entrypoint, remove COPY dispatcher.sh) - `bin/disinto` generate_compose (update — remove dispatcher mount, add env vars) ## Acceptance criteria - [ ] Edge container clones disinto repo at startup - [ ] Clone uses `DISINTO_VERSION` tag (or `main` as default) - [ ] Dispatcher starts as background process - [ ] Dispatcher can source lib/env.sh and vault/vault-env.sh - [ ] Dispatcher polls ops repo and detects TOML files - [ ] Caddy serves as PID 1 - [ ] No bind mount for disinto repo - [ ] CI green
disinto-admin added the
backlog
label 2026-04-01 17:52:06 +00:00
dev-qwen self-assigned this 2026-04-01 17:57:03 +00:00
dev-qwen added
in-progress
and removed
backlog
labels 2026-04-01 17:57:03 +00:00
dev-qwen removed their assignment 2026-04-01 18:07:06 +00:00
dev-qwen removed the
in-progress
label 2026-04-01 18:07:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: johba/disinto#119
No description provided.