文件最后提交记录最后更新时间
2 个月前
2 个月前
2 个月前
1 个月前
2 个月前
16 天前
2 个月前
README

GeoLibre Node collaboration relay

This is the Docker-friendly, single-process host for GeoLibre's collaboration protocol. It uses the same @geolibre/collab-core policy as the hosted Cloudflare Worker and persists session state in SQLite.

npm run build -w geolibre-collab-node
PORT=8787 COLLAB_DB_PATH=./data/collab.sqlite npm start -w geolibre-collab-node

Configuration:

  • PORT — HTTP/WebSocket port (default 8787)
  • HOST — listen address (default 0.0.0.0)
  • COLLAB_DB_PATH — SQLite file (default ./data/collab.sqlite)
  • COLLAB_MAX_SNAPSHOT_BYTES — maximum UTF-8 snapshot frame size (default 1000000, matching the hosted Worker)
  • COLLAB_IDLE_TTL_MS — time after the last participant disconnects before the session and its persisted data are deleted (default two hours)

Endpoints are POST /sessions, GET /sessions/:id/ws, and GET /health. Persist the directory containing COLLAB_DB_PATH, and terminate TLS at the ingress so browsers can connect with wss://.

Checking a deployment

scripts/smoke.mjs exercises the three endpoints against a running relay — health, session creation, and a WebSocket join round-trip — and needs nothing beyond Node:

node workers/collab-node/scripts/smoke.mjs http://127.0.0.1:8787

CI runs it against the freshly built image. The Dockerfile already imports the staged bundle during docker build, so a missing ws or a broken @geolibre/collab-core target fails there; this script covers the rest, which only a running container shows: that the process starts and stays up, and that it actually serves HTTP and completes a WebSocket upgrade.

Volume ownership

The container runs as the unprivileged node user, and the image creates /data so a fresh named volume inherits that ownership. Docker only does this for a volume it creates: a volume that already has content from an image that ran as root keeps its root ownership, and the relay then exits at boot with SQLITE_READONLY: attempt to write a readonly database. Repair it once with

docker run --rm -v geolibre_geolibre-collab:/data busybox chown -R 1000:1000 /data

The same applies to the projects server's volume, using its geolibre user.