Contributing to ServerDock

Thanks for your interest. ServerDock is pre-release, in Phase 1: deploying from an image is built and tested, and there is no install script yet. See the roadmap.

Before you start

  1. Read docs/vision.md, the core promise (light, safe, honest, simple), and docs/architecture.md.
  2. For anything non-trivial, open an issue or discussion first. Features that raise idle RAM/CPU or widen the attack surface need a strong reason.

How work flows

  1. Plan: non-trivial changes get a short plan in docs/plans/NNNN-<slug>.md (goal, out of scope, design, footprint budget, security notes, test plan).
  2. Review the plan before writing code.
  3. Implement in small PRs with tests.
  4. Review: correctness, plus security, accessibility, and footprint reviews where relevant.

Lasting decisions are recorded as ADRs in docs/decisions/ (on GitHub).

Rules that are not negotiable

  • No shell strings. Use the Docker API / compose-go; exec only with argv arrays.
  • Footprint budgets in docs/architecture.md are hard limits.
  • Never log or return secrets, and never send them to an AI provider.
  • Honest state: never report success before the work is done.
  • Tests for every change; integration tests use a real Docker daemon.

Testing notes

  • go test ./... also builds the real binary for a few tests (file modes, the secret-sentinel suite); go test -short skips them.
  • Run the suite on Linux as root and as a non-root user: some tests need root (running as another uid) and some fail only for a non-root user (privileged ports). The tests never bind :80 or :443.
  • SERVERDOCK_TEST_PROXY_LOG_LEVEL=DEBUG makes the embedded Caddy log at DEBUG. It exists for TestSecretsNeverLeak, which scans Caddy's and the server's logs for secrets. It is read by the server only for that purpose: there is no flag and it is not in --help. The server logs a WARN at start when it is set to anything but WARN or ERROR. The proxy's log encoder (redactedHeaders() in internal/agent/proxy/redact.go) hides the X-SD-CSRF header from Caddy's logs: extend that list for any new secret-bearing header, and add the secret to the sentinel suite.

What CI runs

CI runs only the jobs your change needs (.github/scripts/ci-scope.sh and bench-needed.sh decide; the table is at the top of .github/workflows/ci.yml):

Scroll sideways for more columns

Table 1, under "What CI runs"
You changed CI runs
Docs, Markdown or site/ only Nothing heavy; the required checks pass without building
web/ (not web/dist/) The web app, its end-to-end tests and the bench
The committed screenshots (site/public/screens/) The web app, its end-to-end tests and the screenshot check
Go, module, workflow, CI-script or bench files, docs/security.md, docs/api/ or web/dist/ Everything

The Docker RC job (integration-rc: the integration tests against the newest Engine on Docker's test channel, usually a release candidate) is separate and never a required check. It runs nightly, on release branches (release/**, and pull requests into them), and on pull requests that change internal/agent/dockerapi, internal/agentops, .github/workflows/ci.yml or .github/scripts/docker-rc-needed.sh (the script decides; docker-rc-needed_test.sh tests it). The label ci:full (add it, then push or re-run) runs it too. A red RC job does not fail the run; it is read at release time (see the release checklist below).

The public website has its own workflow, site.yml, which runs only for site/ and published docs. To run everything on a PR anyway, add the label ci:full, then push or re-run the workflow. Pushes to main use the same scope; the nightly run checks everything.

Release checklist

The maintainer ticks these in the release pull request. CI cannot do them.

  • Not done yet: Docker RC. The integration-rc job of ci.yml (the newest Engine on Docker's test channel; its summary names the version, and says so when that build is older than the runner's stable engine) is green on the release branch, or the PR carries a written note naming the Docker bug that breaks it (with a link to the Docker issue) and what ServerDock does about it. The job is never a required check, so a red one does not stop a merge: this line is where it is read.
  • Not done yet: RC on the release branch's last push. If the last push to the release branch skipped the RC job (a docs-only push turns the whole Go scope off, and the RC with it), run the workflow by hand with workflow_dispatch on that branch and read the result.

Sign your commits (DCO)

We use the Developer Certificate of Origin, not a CLA. Add a sign-off to every commit:

git commit -s -m "Your message"

License

By contributing you agree that your contributions are licensed under the AGPL-3.0 (on GitHub).

Security issues

Do not open public issues for vulnerabilities. See SECURITY.md.

Code of conduct

This project follows the Contributor Covenant (on GitHub).

Refresh screenshots

The public website shows real screenshots of the web UI with demo data (six views, dark and light, in site/public/screens/). They are made by web/e2e/screens.capture.ts in CI, never by hand. A change to the UI (web/src/), the capture, the lockfile or docs/api/openapi.json makes them stale, and the screens check in CI says so. A Dependabot web PR flags it too: a new lockfile usually means a new Chromium.

Only the CI artifact may be committed. Local captures differ in fonts and rendering. make screens is for previewing only; it writes to a scratch folder, never to site/public/screens/.

To refresh:

  1. Open the failed or warning screens-capture job of the PR's latest run. On a stale main, use the latest push run on main.
  2. Check that gh --version is 2.63.0 or later (earlier versions have a path traversal in gh run download, CVE-2024-54132). Then run gh run download <run-id> -n site-screens -D site/public/screens.
  3. Run git status. It must show changes only under site/public/screens/. Stop and report anything else. Commit with the message "Refresh screenshots (run )" and push. On a stale main, open a PR named "Refresh screenshots" with only that commit.
  4. The re-run of screens-hash then takes the fast path, and screens-capture is skipped.

Once the screens check is required, also turn on "Require branches to be up to date before merging" for main: the check hashes the merge result, so a second UI PR must rebase and refresh before it merges.

If the job reports that committed files are no longer produced, remove them with git rm. Review every changed image in the PR: GitHub shows image diffs, and the pictures must show only demo data.

The web app

The single-page app lives in web/ (SvelteKit, static output). Node (see web/.nvmrc) is needed only to build it: go build and go test work without it and embed a placeholder page (serverdock version prints ui=placeholder).

  • make web installs the pinned dependencies (npm ci), runs svelte-check and builds web/build (gzip twins, 250 KB JavaScript budget). make build then embeds it (-tags spa, ui=spa).
  • make dev runs a throwaway server and Vite over HTTPS (self-signed certificate) at https://localhost:5173, proxying /api. The Host allowlist and Origin rule are not loosened; web/scripts/dev-proxy-check.sh verifies that.
  • make web-types regenerates web/src/lib/api-types.ts from docs/api/openapi.json; CI fails if it is stale.
  • npm dependencies are pinned exactly and kept minimal; add one only with a plan that names it.
  • TypeScript is pinned to 6.x (SvelteKit's peer). openapi-typescript (codegen only, dev) declares a 5.x peer, so package.json has an explicit overrides entry that lets it use the same TypeScript; every npm ci reproduces that. Drop the override when the tool supports 6.
  • npm audit --omit=dev and npm audit --audit-level=high (dev included, since vite and its plugins write the shipped bundle) both run in CI.
  • Any future release workflow must build web/build itself from the checked-out commit (npm ci --ignore-scripts && npm run build). It must never download an artifact by run id or with a token, because a release must not embed a bundle it did not build.
  • make e2e runs the Playwright + axe suite (web/e2e) against bin/serverdock (so run make web build first; the first time, cd web && npx playwright install chromium webkit). It starts the binary on high ports with a temp data directory, does the first run through the API and checks every shell state in eight projects (desktop, phone, 320 px, 200% zoom, dark, reduced motion, forced colours, WebKit). Zero axe violations and zero CSP violations are required.
  • Playwright tests that change state use the server and admin fixtures (web/e2e/fixtures.ts): a fresh binary per test, so back-off counters and the one-time setup token are never shared. They expire or revoke sessions, pending sign-ins and setup tokens by editing the temp database with Node's built-in node:sqlite, so no test-only flag exists in the server.