GitHub App server
patchula serve runs the same engine as patchula run as a long-lived GitHub
App: it queues webhooks, sweeps on a schedule, mints its own tokens and keeps
caches warm, so a ticked checkbox is acted on within seconds.
Create the GitHub App
Section titled “Create the GitHub App”The App needs:
- repository permissions: contents write, pull requests write, issues write (dashboard and labels), workflows write (workflow updates), and checks and commit statuses read (merge fallback);
- events: push, issues, pull request, installation, installation repositories, check suite, check run and repository (which keeps the repository API current);
- a webhook secret;
- Enable Device Flow ticked, so people can run from their machines.
A repository or organisation webhook can point at the server instead of the App’s own webhook URL, using the same secret.
Settings
Section titled “Settings”Operator settings are a Pkl file that amends the bundled PatchulaSettings.pkl,
the same file the CLI reads. They are separate from repository configs, which
amend PatchulaConfig.pkl. Only the server reads the server section.
amends "PatchulaSettings.pkl"
concurrency = 8server { allowedInstallations { 123456 } allowedRepositories { "acme/my-app" } sweepCron = "0 0 * * * *" // hourly; six fields, seconds first pollSecs = 3600 // catalogs with no wait are re-read hourly reportDirectory = "/var/lib/patchula/reports"}patchula config settings-schema # print the schemapatchula config check-settings /etc/patchula/settings.pklEmpty allowlists allow everything the App can see. The file, and every local
module it imports, is re-read about once a second, and evaluated again only
when one of them changed. An invalid edit keeps the last good settings, logs a sanitised
error and makes /readyz fail until it is fixed; a running batch keeps the
snapshot it started with. A change to the http section takes effect at each
installation’s next batch. Every setting is in the settings
reference.
Each batch’s report is logged as one JSON event, or with reportDirectory
written to a file there. The directory keeps the newest reportsKept reports
(200 by default) and deletes older ones after each new report, so a busy or
failing server does not fill its volume. A temporary file a crashed write left
behind is deleted once it is a day old. Only files named as the server names
reports are touched.
Credentials and startup
Section titled “Credentials and startup”export PATCHULA_APP_ID=12345export PATCHULA_APP_PRIVATE_KEY_FILE=/etc/patchula/app.pemexport PATCHULA_WEBHOOK_SECRET_FILE=/etc/patchula/webhook-secretexport PATCHULA_SETTINGS=/etc/patchula/settings.pklexport PATCHULA_SERVER_CACHE=/var/lib/patchulapatchula servePATCHULA_APP_PRIVATE_KEY and PATCHULA_WEBHOOK_SECRET can hold the values
directly instead, but not both a file and a value for the same secret. Secrets
never appear in settings or command-line arguments, and no key, JWT, token,
signature or request body is ever logged. Installation tokens live in memory,
are renewed two minutes before they expire, and never touch SQLite. A
token GitHub refuses with 401, such as one revoked or minted before the
owner approved new permissions, is dropped and the request sent once more
with a fresh one. Keep the
host clock synchronised; JWTs are issued 60 seconds in the past.
/healthz is liveness. /readyz needs valid settings, a working cache and a
successful token probe for every allowed installation, and returns 503 while
draining. Logs are JSON on stderr; PATCHULA_LOG=debug adds request-level
detail.
What starts a batch
Section titled “What starts a batch”- a push to a repository’s default branch;
- a ticked box on the Count’s dashboard, or the re-check, add-to-batch or remove-from-batch box on one of his PRs;
- one of his PRs being closed;
- the App being installed, or a repository being added;
- checks completing on one of his PRs;
- the sweep schedule. Starting the server does not sweep; queued work survives restarts.
Whether a completed check is on one of his PRs is answered from the write
receipts the server keeps for the repository, with no GitHub request; a
repository with no receipted PR of his has the PR read instead. A PR his
last run opened but left without a receipt (one it could not verify, or
whose release notes it has to fetch again) isn’t recognised, and waits for
the repository’s next run. After a prs.branch change, check events keep
answering from the receipts under the old prefix until a run saves receipts
under the new one, so a PR receipted only under the new prefix waits for that
run too.
Each trigger can be turned off under triggers. Events from the App itself,
disallowed repositories and unrelated events are acknowledged and ignored.
A ticked re-check box is also acknowledged on the PR itself as soon as the delivery is queued: the server puts the rebasing banner at the top of the Count’s part of the description, through the installation’s own client and its write pacing, and leaves the box ticked for the batch that does the work. That batch’s rewrite takes the banner down. While a batch or remote run holds the repository, or is waiting for it, the server leaves the banner to the run, or to the follow-up batch the tick queued; it never writes the description between a run’s last read and its last write. Ticks on different PRs of a repository are acknowledged side by side, and two quick ticks on the same PR take turns, so the banner goes up once. Once the server stops taking deliveries at shutdown, acknowledgements still in flight get ten seconds to finish beside the current batch, and are then aborted.
Webhook handling
Section titled “Webhook handling”Signatures (X-Hub-Signature-256) are verified over the raw bytes before any
JSON is parsed. A bad signature gets 401, a body over 2 MiB 413, a signed but
malformed delivery 400, and a durably queued one 202. If SQLite is busy or
the server is draining, the answer is 503. Delivery IDs are deduplicated for
seven days, counted from the delivery that was queued: one answered 503 is not
recorded, so its redelivery is processed. Every rejection carries a JSON
error_kind, such as bad-signature or draining.
GitHub does not redeliver failed deliveries on its own, so the server asks it to. At start, and then every ten minutes, it reads the App’s recent deliveries with the App JWT and asks GitHub to redeliver each one none of whose attempts, original or redelivered, got a 2xx and whose newest attempt got no answer, a 5xx, or a 408 or 429: one answered 503, sent while the server was down or restarting, or refused for a moment by a proxy in front of it. A delivery the server refused outright, such as a bad signature (401), a malformed delivery (400) or a body over 2 MiB (413), is not redelivered, since it would be refused again. A delivery with any successful attempt is left alone, and one already asked for is asked again only once that redelivery has failed too. The server keeps how far it read in its cache, so each pass reads only newer deliveries, with five minutes of overlap; the first start reads all GitHub keeps, a few days, up to 100,000 deliveries. Past that it keeps the newest and logs that it stopped, leaving older ones to the sweep. Redelivery requests are paced like the Count’s other writes to GitHub, and a rate-limit refusal ends the pass; the next pass picks up where it stopped. A failed pass is logged and the next one tries again; it never holds up webhooks. This covers the App’s own webhook, not a repository or organisation webhook pointed at the server.
Repository and organisation webhooks can omit the installation; the server looks it up with the App JWT and caches the answer for five minutes.
The queue
Section titled “The queue”Batches of up to workers installations (4 by default) run at once, each
installation one batch at a time, with up to concurrency repositories
scanned in parallel in each. Each installation has its own GitHub rate limits,
so they do not wait on each other; each batch runs its own lockfile tools,
though, so lower workers on a small host. Within an installation and across
them, a person’s work runs first — a push, a dashboard or pull request
checkbox, or a closed pull request — then completed checks, then the sweep
and discovery; a repository queued by more than one of these keeps the most
urgent class, whatever runs first. A batch’s claims finish before its public
record writes, so recording never holds queue rows. The first event opens a coalescing window
(coalescingMs), and events that arrive during a batch fold into one follow-up
batch. Each repository finishes on its own: when one fails, only that one is
retried, after a backoff that starts at a minute and doubles with each
consecutive failure up to an hour, plus a small spread per repository so that
repositories that failed together do not retry in step. A success resets it.
A new event for the repository, such as a push that fixes it, runs it after the
usual coalescing window instead of waiting out the backoff. A run that dies
with the server or takes it down, such as by an OOM kill or a panic, counts as
a failure; one cut short by a shutdown does not. If the repository changes
while a batch is running — its default branch moves, a pull request the run
is reconciling changes, or the write inventory disagrees with what the run
read — the run stops rather than write against the stale view, reports the
repository stale with the race as its reason, and the server requeues it
for a minute later. A stale repository is not a failure and does not back
off; a repository that both raced and errored is a failure, as before. A
repository requeued three times in a row fails the next one instead, backing
off like any other failure; a success or a failure resets the count.
When a repository’s run completes and its queue row finishes done, the server also records what its answer was computed from — each catalog, advisory query, git ref, mutable tag and image tag it read — in the same transaction. A failed or requeued run keeps the previous record. When the repository or its installation goes, the server drops the repository’s input rows; a watched thing no repository reads any more is deleted after a week. Every hour the server logs how many things the fleet watches and how many repositories read them (maximum, median and 90th percentile; see the cache internals).
A poller re-reads each watched catalog and advisory query once for all the
repositories that read it, as often as the freshness the Count promises
needs: within the release-age wait’s reuse window for a catalog every
reader waits on, within pollSecs (an hour by default) for one with no
wait, and within http.advisoryFreshnessSecs for an advisory query. Queued
runs then read those from the store instead of asking the
registry or OSV.dev themselves; a row the poller has not confirmed within
its bound is read by the run directly, as before. Since a change the poller
finds still waits for the next sweep, a new release of a package with no
release-age wait can take up to pollSecs plus one sweep to show up (two
hours at the defaults, one before the poller); a fix for a known advisory
is still read on every sweep. Before a PR is opened or
updated, the catalog of each version it proposes is read live once more;
when it changed since, the repository writes and settles nothing derived
from it (only closing obsolete PRs happens before that read) and runs
again a minute later, reading that catalog live. A batch whose reviewed
target is yanked or deprecated is held.
Remote runs and manual retries always read live. A poller that stops
stops the server. How it works is in the poller
internals.
Queue rows survive restarts. SIGTERM stops new work, drains the running batches
within --shutdown-timeout-secs (60 by default), and requeues the rest. A lock
beside the cache allows one server per cache; give CLI jobs a separate cache.
Quiet sweeps
Section titled “Quiet sweeps”A repository that has not moved since its last complete run does not cost
a full run during a sweep. Each complete run stores the head commit, a
hash of the repository’s report — timings, stats and evaluation timestamps
excluded — and next_due, the earliest instant at which time alone can
change the answer: a held-back release becoming eligible, an update or
maintenance window opening, a waiting lockfile refresh, an hourly PR quota
freeing. It also stores what its inventory saw on GitHub: the default
branch’s head, the Count’s branches with their open pull requests, and his
open issues (the dashboard), each with GitHub’s updatedAt, and, when the
run wrote, what it wrote.
On a batch the sweep alone started, the server first probes the batch’s repositories in one GraphQL query and compares each answer with what the last run left. A repository whose head moved, or whose branches, pull requests or dashboard changed in a way the run’s own writes do not account for, runs in full, as the webhook that was lost would have. The rest replay the cached extraction and catalog reads, and one whose report hashes the same and is not due is skipped with no GitHub request of its own beyond the probe and the hinted tag and digest refreshes every sweep makes — the installation’s listing still costs what discovery always costs. Missing state, a missing cached extraction, a passed due or a changed answer all run the repository in full, as does any batch carrying more than the sweep — a delivered event, a person’s trigger, a check callback or a discovery row. The check always fails open toward running.
For a repository whose pull requests the Count merges himself once their
checks pass, the probe also reads those pull requests’ check rollups, so a
lost check delivery does not leave one unmerged. A lost webhook is
therefore acted on at the next sweep: within about an hour at the default
sweepCron. A probe that cannot read a repository
twice in a row runs it in full. While the installation’s GraphQL budget is
under half, the probe stops until the budget resets and the sweep skips
on the stored answers alone, so runs keep the budget.
A repository without a patchula.pkl is visited in full once, then
skipped by the sweep, whose probe asks only whether a config appeared. A
default-branch push that adds a config runs it at once, as any
default-branch push does while triggers.push is on (the default); if that
push’s webhook is lost, or triggers.push is off, the config is acted on
at the next sweep.
Run from your machine
Section titled “Run from your machine”patchula remote hands a lookup, run --dry-run, run or tui to the
server instead of running it locally:
patchula remote run --dry-run acme/my-apppatchula remote run --server https://patchula.acme.dev acme/my-appThe run uses the server’s App credentials, warm caches and lockfile tools, so
the machine needs no GitHub token and no mise. The server comes from --server <URL>, then PATCHULA_SERVER, then the server advertised by the
repository (when running one repository); with none of
those, patchula remote fails. The URL must use HTTPS, except for a server on
localhost or a loopback address.
With no repository named, patchula remote targets this checkout’s GitHub
repository (origin, or its only remote). The server always reads what is
pushed on GitHub, never your local working tree. Local commands (lookup,
run, tui, apply) always run on this machine and never talk to a server.
On first use the CLI asks you to sign in: it prints a code to enter at
github.com/login/device, and you authorise the server’s App. The token is
stored in ~/.config/patchula/servers.json (or under XDG_CONFIG_HOME) and
refreshed as it expires. patchula remote login and patchula remote logout
sign in and out explicitly, with --server <URL>, PATCHULA_SERVER, or this
checkout’s server; GitHub’s Settings → Applications revokes the App’s access.
The server refuses any other token, including personal access tokens and other
Apps’ tokens.
Each repository in the request must:
- have the App installed, in the same installation as the others, and be allowed by the server’s settings;
- let you push. Read access is not enough, because on a public repository everyone has it.
A server runs one request per user at a time, and a real run uses its
installation’s engine, so it never races that installation’s webhook batch. The
repository’s own patchula.pkl applies, and the server’s own settings file
decides the rest. A run in progress at shutdown finishes within the shutdown
deadline.
Found from a repository
Section titled “Found from a repository”The server hides its URL in an HTML comment in each PR and dashboard it writes.
When patchula remote runs one repository with neither --server nor
PATCHULA_SERVER, it looks for that comment in the 500 most recently updated
open issues and PRs. The comment counts only if a GitHub App wrote it, the server names that App’s
bot at /api/v1/auth, and GitHub’s own description of that App
(GET /apps/{slug}) has the client ID the server hands out for sign-in. A
comment pasted by a person is ignored, and a server advertised in another App’s
comment can only ever sign you in to that other App, never to the Count’s; when
GitHub cannot be asked, nothing is found. Discovery probes at most five distinct
advertised servers per scan; pass --server <URL> (or set PATCHULA_SERVER) if
the repository’s server is not found.
Once found and used successfully, the server URL and its verified App client ID
are remembered for that repository in ~/.config/patchula/remotes.json (with a
one-line note on stderr) so later patchula remote commands skip the scan and
refuse the server if it later names a different App. patchula remote logout
forgets both the server’s token and any repositories remembered for it.
The advertised URL is publicUrl, or the App’s webhook URL with /webhook
removed. A webhook relay such as smee.io gives no server URL, so set
publicUrl there. Set advertise = false to keep the URL out of what the
Count writes. Turning it on or off edits the open PRs once. A server whose
App has no client ID advertises nothing, because the CLI could not sign in.
Repository API
Section titled “Repository API”A read-only JSON API shows what the Count last saw of each public repository
he runs, for a dashboard to display. It needs no sign-in and answers any
origin (Access-Control-Allow-Origin: *), so a page on another site can call
it from the browser. Set publicApi = false to turn it off.
GET /api/v1/repositories lists the repositories in name order:
{ "repositories": [ { "repository": "acme/my-app", "ranAt": "2026-10-23T09:00:00+00:00", "queued": null, "status": "complete", "reason": null, "defaultBranch": "main", "dependencies": 42, "updates": 3, "pullRequests": 2, "dashboard": 7 } ]}updates counts dependencies with at least one update, pullRequests counts
the Count’s open PRs, and dashboard is the dependency dashboard’s issue
number. status is the last run’s repository status — complete,
skipped, stale or error, as in the report — and
reason says why a non-complete one ended that way. A repository that has
not run yet has only repository, ranAt: null and queued. queued is
null, or {"at", "running"} when work for the repository is waiting or in
a batch.
GET /api/v1/repositories/{owner}/{repo} returns everything from the last run:
| Field | Meaning |
|---|---|
repository, ranAt, queued, status, reason, defaultBranch, dashboard |
as in the list |
commit |
the default branch commit the run read |
warnings |
the run’s warnings |
lookupFailures |
dependencies whose lookup failed, as in the report |
packageFiles |
each package file’s dependencies and their updates, as in the report |
branches |
each update branch the run planned: branch, status, reason, message, baseCommit, commit, lockfilePending, and the files it changes, without diffs |
pullRequests |
the Count’s open PRs as the run left them, newest first; null if GitHub would not list them |
merged |
up to 20 PRs the Count merged himself: number, title, url, and mergedAt when GitHub recorded it |
Each open PR has number, url, branch, title, body, draft, labels,
headSha, base, createdAt, updatedAt, mergeable, mergeableState,
autoMerge, and action: what the run did to it ({"status", "reason"}), or
null if the run left it alone. GitHub works out mergeable and
mergeableState in the background, so either can be null.
The server doesn’t read the PRs again to record them: it takes them from what
the run read and wrote. A PR the run wrote shows GitHub’s answer to that write,
and one it left alone shows how GitHub showed it when the run started, so
mergeable, mergeableState, updatedAt and checks-driven states can be a
few seconds older than the end of the run. They are brought up to date by the
repository’s next run: one that a trigger starts (a
closed PR or completed checks on one of his PRs, say, while that trigger is
on) or the sweep. An edit no trigger covers waits for the sweep. A PR whose
head branch the run deleted is gone, since GitHub closes it. Only when a
repository’s run can’t name every open PR (a repository without a config, a
repository whose run failed during its writes, or a branch with more open PRs
or labels than one page holds) does the server list the open PRs from GitHub
and read each one. A batch that fails as a whole records nothing, and the
previous record stays.
A dashboard that merges sends GitHub’s
PUT /repos/{owner}/{repo}/pulls/{number}/merge with its own token, passing
headSha as sha so that GitHub refuses if the PR changed since the run.
A public repository shows everything, including what lookups with private
registry credentials found, as its
dependency dashboard does. A repository that is private when it runs is stored
without that: such a dependency keeps what the repository declares, but loses
its updates, and its metadata’s held-back releases, lookup evidence, tag
digests and image checks, and does not count in updates. So if the repository
later becomes public, the API does not show what its private-registry lookups
found until it runs again as a public repository.
Discovery and installation events decide which repositories are listed:
- a sweep replaces each installation’s list;
- repositories added to or removed from an installation, and renamed or transferred ones, come and go straight away (a rename or transfer drops the old name at once);
- an uninstalled installation’s repositories go within a minute;
- a run of a repository the server has not listed yet adds it once GitHub confirms it is in the installation;
- settings that no longer allow a repository hide it at once;
- a webhook can hide a repository but never show it. GitHub can send deliveries late and out of order, and a redelivery replays an old payload, so a delivery saying a repository is private applies at once, while one saying it is public (or adding it as public) makes the server read the repository from GitHub, after answering the delivery. Until that read answers public, the repository stays hidden, and if the read fails it stays hidden until the next sweep. A delivery saying private for a repository the server has not listed yet adds it hidden, so a run or sweep that read it as public just before cannot show it afterwards;
- a run can hide a repository but never show it, since a webhook may have changed it during the run. The record reads the repository’s visibility from GitHub when it stores the run, so one made private during the run is stored without what credentials found. A repository the run already saw private skips that read: private stays private.
These sources can disagree, so the server keeps, for each repository, when it last had evidence that the repository is private. Evidence of private always applies. Anything saying public (a sweep, or the read after a webhook) applies only if it started after that evidence: a sweep that began before a repository was made private, or a read sent before a “private” delivery arrived, leaves it hidden. A repository made private and public again within the same millisecond stays hidden until the next sweep or webhook.
A private repository is never shown, and neither is one whose visibility the server could not read.
The server records a repository after each run that writes: queued batches and
patchula remote run, but not lookups or dry runs. A run never replaces one that
started later. An unknown or hidden repository is a 404 with errorKind
unknown-repository, and with the API off every request is a 404 with
errorKind disabled.
Container image
Section titled “Container image”Each release publishes an image for linux/amd64 and linux/arm64 to the GitHub Container Registry:
ghcr.io/sweepies/count-patchula:X.Y.ZThe tags are each release’s version without the v, and latest. A
prerelease, which comes before each release, is tagged with its own version,
such as X.Y.Z-rc.1, and rc, which always points at the newest prerelease;
it moves neither latest nor X.Y.Z. There are no minor, major or edge tags,
so pin the version and upgrade on purpose.
The image is built with apko from
Wolfi packages. It holds patchula, git, curl and
packslip, on Wolfi’s glibc, and starts patchula serve
as user and group 10001. Lockfile tools are not in the image: mise installs
each one into the volume the first time a repository needs it (see what the
runner needs). The image sets no
HEALTHCHECK or EXPOSE; configure the health check and
publish 8080 yourself.
Each build takes Wolfi’s current packages, so a release picks up Wolfi’s fixes, and rebuilding an old commit later gives a different image. The image a tag publishes is exactly the one the release smoke-tested, and its provenance attestation records the commit and workflow run that built it. The release workflow attests that provenance, and each platform’s SPDX SBOM from apko, in GitHub and in the registry. Check the provenance with:
gh attestation verify oci://ghcr.io/sweepies/count-patchula:X.Y.Z --repo sweepies/count-patchulaA platform’s SBOM is attested to that platform’s image, so name it by digest
and add --predicate-type https://spdx.dev/Document/v2.3.
/var/lib/patchula is a volume. It holds the server cache and queue, the
partial clones, mise and the tool store, so a new container picks up where the
last one stopped. A new named volume takes the directory’s owner; a bind mount
must be writable by user 10001.
| Variable | Image default |
|---|---|
PATCHULA_LISTEN |
0.0.0.0:8080 |
PATCHULA_SETTINGS |
/etc/patchula/settings.pkl, which only amends PatchulaSettings.pkl |
PATCHULA_SERVER_CACHE |
/var/lib/patchula |
PATCHULA_TOOLS_DIR |
/var/lib/patchula/tools |
RUSTUP_HOME |
/var/lib/patchula/rustup |
The credentials have no default. Mount your settings file over
/etc/patchula/settings.pkl, or point PATCHULA_SETTINGS at another path.
docker run --detach --name patchula \ --publish 127.0.0.1:8080:8080 \ --stop-timeout 75 \ --health-cmd 'curl --fail --silent --output /dev/null http://127.0.0.1:8080/healthz' \ --health-start-period 30s \ --volume patchula:/var/lib/patchula \ --volume /etc/patchula/settings.pkl:/etc/patchula/settings.pkl:ro \ --volume /etc/patchula/app.pem:/run/secrets/app.pem:ro \ --volume /etc/patchula/webhook-secret:/run/secrets/webhook-secret:ro \ --env PATCHULA_APP_ID=12345 \ --env PATCHULA_APP_PRIVATE_KEY_FILE=/run/secrets/app.pem \ --env PATCHULA_WEBHOOK_SECRET_FILE=/run/secrets/webhook-secret \ ghcr.io/sweepies/count-patchula:X.Y.ZThe mounted secret files must be readable by user 10001. To pass the values
instead, use --env PATCHULA_APP_PRIVATE_KEY and --env PATCHULA_WEBHOOK_SECRET with no value, which read them from your shell.
--stop-timeout 75 keeps the stop signal’s grace period longer than the
60-second drain, because Docker’s default of 10 seconds would kill a running
batch.
The lockfile runner works in the container’s temporary directory, so a
read-only root filesystem needs a writable /tmp.
Health check
Section titled “Health check”GET /healthz answers 200 while the server runs. The image has curl for
runtimes that run a command, such as Docker (above) and Compose:
services: patchula: image: ghcr.io/sweepies/count-patchula:X.Y.Z ports: - "127.0.0.1:8080:8080" healthcheck: test: ["CMD", "curl", "--fail", "--silent", "--output", "/dev/null", "http://127.0.0.1:8080/healthz"] interval: 30s timeout: 5s start_period: 30s retries: 3Kubernetes probes the port itself:
ports: - containerPort: 8080livenessProbe: httpGet: path: /healthz port: 8080 periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 3startupProbe: httpGet: path: /healthz port: 8080 failureThreshold: 30 periodSeconds: 2mise on first start
Section titled “mise on first start”When there is no mise on PATH, as in the image, patchula serve makes sure
the tool store has the mise version the Count pins before it signs in to
GitHub. If it is missing, it runs packslip:
packslip install github.com/jdx/mise --version <pinned> --pin ps1_nlhmwtfeufglxv5myvwvronk7apackslip checks the release’s signature against mise’s GitHub repository and
that signer fingerprint, then unpacks it into
$PATCHULA_TOOLS_DIR/patchula-mise/<version>/, as user 10001. That takes about
15 seconds, once per volume; later starts find it there and log the same
lockfile tools run with this mise line. When an upgrade pins a newer mise, the
next start installs it and removes the old one.
If the install fails, for example without network access, the server logs
cannot install mise yet with packslip’s reason and keeps running: webhooks,
lookups and branches without lockfiles work. The next job that needs mise, a
lockfile or a mise tool lookup, installs it again, so a network failure at
start heals without a restart; until an install succeeds, those jobs fail
with packslip’s reason. Jobs that need mise at once wait for one install.
packslip asks GitHub’s API for the release; set GITHUB_TOKEN (any token, no
scopes needed) if the host shares an address that runs out of GitHub’s
anonymous API limit.
Offline hosts
Section titled “Offline hosts”A host that cannot reach GitHub needs a volume that already holds mise. Fill one on a connected machine, with the same image version, and copy it over:
docker run --rm --volume patchula:/var/lib/patchula \ --entrypoint patchula ghcr.io/sweepies/count-patchula:X.Y.Z tools installpatchula tools install installs mise the same way, then prewarms every
pinned lockfile tool into the store, so the offline host needs no downloads
for the default tool versions either.
Hosting on Railway
Section titled “Hosting on Railway”Railway bills by the minute for the CPU and memory a service uses, which suits a server that idles between batches.
- Create a service from the Docker image
ghcr.io/sweepies/count-patchula:X.Y.Z(see the container image). It startspatchula serveand already listens on0.0.0.0:8080. - Give the service a public domain on port 8080. Railway terminates HTTPS, so
the App’s webhook URL is
https://<domain>/webhook. - Attach a volume mounted at
/var/lib/patchula, so the cache, queue and tool store survive deploys. Railway mounts volumes owned by root, which user 10001 cannot write, so setRAILWAY_RUN_UID=0in the service’s variables, as Railway’s volume reference describes. - Put
PATCHULA_APP_ID,PATCHULA_APP_PRIVATE_KEYandPATCHULA_WEBHOOK_SECRETin the service’s variables.
systemd
Section titled “systemd”Install mise or packslip for the service user, on the PATH in
/etc/patchula/environment; the server needs it like any
runner.
[Unit]Description=Count Patchula GitHub webhook serverAfter=network-online.targetWants=network-online.target
[Service]Type=simpleUser=patchulaGroup=patchulaStateDirectory=patchulaWorkingDirectory=/var/lib/patchulaEnvironmentFile=/etc/patchula/environmentLoadCredential=app.pem:/etc/patchula/app.pemLoadCredential=webhook-secret:/etc/patchula/webhook-secretExecStart=/usr/local/bin/patchula serve --settings /etc/patchula/settings.pkl --cache /var/lib/patchula --private-key-file %d/app.pem --webhook-secret-file %d/webhook-secret --shutdown-timeout-secs 60Restart=on-failureRestartSec=10TimeoutStopSec=75KillSignal=SIGTERMUMask=0077NoNewPrivileges=true
[Install]WantedBy=multi-user.target/etc/patchula/environment needs PATCHULA_APP_ID and that PATH. Keep the
stop timeout longer than the drain deadline.
© 2026 Sweepy