Customizing Your Deployment
Pinchy’s docker-compose.yml is owned by the Pinchy project and gets replaced whenever you upgrade. If you customize it directly, your changes disappear on the next curl -o docker-compose.yml ....
The supported customization surface is docker-compose.override.yml — a file you create in the same directory as docker-compose.yml. Docker Compose automatically merges it on top of the base file, every time you run docker compose up. Upgrades never touch it.
Recipe 1: Extra environment variables
Section titled “Recipe 1: Extra environment variables”Add debug flags or optional Pinchy variables that aren’t in .env.example:
services: pinchy: environment: - DEBUG=pinchy:* - SOME_OPTIONAL_FLAG=trueCompose merges this with the base environment: block — existing variables are kept, new ones are added. For duplicate keys, the override wins. See the Docker Compose merge docs for edge cases.
Recipe 2: Expose the database for an external tool
Section titled “Recipe 2: Expose the database for an external tool”If you want to connect psql or DBeaver from the same host for debugging:
services: db: ports: - "127.0.0.1:5432:5432"Remove the override when you’re done debugging.
Recipe 3: Mount additional OpenClaw extensions
Section titled “Recipe 3: Mount additional OpenClaw extensions”If you’ve written a custom OpenClaw plugin and want it loaded alongside the bundled Pinchy plugins:
services: openclaw: volumes: - /opt/my-extensions:/root/.openclaw/extensions/custom:roMount read-only (:ro) when possible — OpenClaw reads extensions at startup; it doesn’t need write access.
Recipe 4: Mount your own document directories
Section titled “Recipe 4: Mount your own document directories”Host directories you want agents to read belong under /data/, on both the openclaw and the pinchy service:
services: openclaw: volumes: - /srv/docs/hr:/data/hr:ro
pinchy: volumes: - pinchy-data:/data - /srv/docs/hr:/data/hr:roThe - pinchy-data:/data line re-declares that mount without the base file’s :ro, which Docker needs before it can create a mount point underneath it — at the cost of the read-only protection that line carried. Mount Data Directories covers the details and the trade-off, including how the directories show up in the agent permissions picker.
What’s not supported
Section titled “What’s not supported”The override file is for additions, not replacements. The following are outside the supported surface and may break on any release:
- Replacing the
image:on thepinchyoropenclawservice with a different image - Renaming volumes, services, or networks
- Rewiring inter-service dependencies or health checks
- Changing the Postgres image to a non-17 version
- Pre-seeding or hand-editing
openclaw.jsonoutside Pinchy — OpenClaw 2026.5.12+ requiresgateway.auth.tokento be present at startup, and Pinchy’s boot-init step seeds it from the database before OpenClaw boots. An out-of-band write collides with that seed and risks restart loops on the OpenClaw container.
If you find yourself needing any of these, open an issue — your use case might belong in core Pinchy rather than in an override.
Testing overrides
Section titled “Testing overrides”Before running docker compose up -d, check the merged config:
docker compose configThis prints the effective configuration (base + override merged) without starting anything. Use it to verify your override does what you expect.
Overrides and upgrades
Section titled “Overrides and upgrades”Your docker-compose.override.yml survives upgrades unchanged. However, if a new Pinchy release changes a base-file field you’re overriding (for example, renames a volume), the merge may produce an unexpected result. Re-check docker compose config after every major release.
Resource limits and health checks
Section titled “Resource limits and health checks”Pinchy’s docker-compose.yml caps memory and CPU for all three containers, and gives pinchy and db HTTP/TCP health checks so Docker can tell a wedged container from a healthy one. All six limits are overridable via .env — you never need to touch docker-compose.yml itself. For every other variable .env accepts, see the Environment Variables reference.
| Variable | Default | Caps |
|---|---|---|
PINCHY_MEM_LIMIT |
1g |
Memory for the pinchy container (web UI, API, WebSocket bridge) |
PINCHY_CPUS |
1.5 |
CPU cores for pinchy |
OPENCLAW_MEM_LIMIT |
2g |
Memory for the openclaw container (agent runtime, model calls) |
OPENCLAW_CPUS |
2 |
CPU cores for openclaw |
DB_MEM_LIMIT |
1g |
Memory for the db container (PostgreSQL 17) |
DB_CPUS |
1 |
CPU cores for db |
Why these exist
Section titled “Why these exist”Without a limit, a single runaway container — a leaking process, a model call that buffers an oversized response, a query that goes wide — can exhaust all memory on the host and take down every other container (and often the host itself) with it. mem_limit/cpus contain that failure to the one container that caused it. Combined with restart: unless-stopped (already set on all three services and not something you should change), an OOM-killed container comes back on its own instead of leaving the deployment wedged until someone notices and runs docker compose up -d by hand.
Sizing your host
Section titled “Sizing your host”The defaults add up to roughly 4 GB of memory ceiling across the three containers (1 + 2 + 1). That’s a ceiling, not a reservation — containers use less at idle — but your host needs headroom above that total for the OS, Docker itself, and any reverse proxy you run alongside Pinchy. We recommend a host with meaningfully more than 4 GB, e.g. 6–8 GB or more, so the limits are a backstop rather than a wall you hit during normal operation.
If you’re intentionally running on a constrained 4 GB VPS — a real scenario, not just a hypothetical — lower the limits in .env so the three containers leave the OS enough room to breathe:
# .env — tuned for a 4 GB VPSPINCHY_MEM_LIMIT=768mPINCHY_CPUS=1OPENCLAW_MEM_LIMIT=1.5gOPENCLAW_CPUS=1.5DB_MEM_LIMIT=512mDB_CPUS=0.5Memory when the knowledge base indexes Office documents
Section titled “Memory when the knowledge base indexes Office documents”Word and PowerPoint files take a detour on their way into the knowledge base: Pinchy converts them to PDF first, with LibreOffice running inside the pinchy container. That’s what lets it read the legacy .doc and .ppt formats at all — no modern parsing library can — and it gives every citation one rendered document that the index and the preview agree on.
Two things about that are worth knowing when you size the container.
LibreOffice is not a daemon. It starts, converts a batch of documents, and exits. The memory it needs is transient: nothing stays resident between reindexes, and a deployment that never indexes an Office document never pays for it.
It shares the container with the embedding model. The knowledge base embeds in-process, so during a reindex the same container holds a ~300 MB model that is actively working while the converter runs. We measured that overlap directly — 17 Word documents converting while the embedder kept embedding, at several ceilings:
PINCHY_MEM_LIMIT |
Result |
|---|---|
1g (default) |
All 17 converted — the default has room to spare |
768m |
All 17 converted, ~20 % slower |
640m |
All 17 converted, ~70 % slower |
512m |
Out of memory. The container was killed mid-run |
So the default 1g is enough, and the 4 GB VPS tuning above (768m) still works — but 512m is below the floor once Office documents are in the corpus. Going the other way pays off in time rather than reliability: the converter is the one part of Pinchy that gets meaningfully faster with more memory, so 2g is worth it for a large first-time index.
Converted PDFs live on their own volume, pinchy-kb-artifacts. Your source documents are never touched — /data stays read-only. The volume is a cache: every artifact is re-derivable from its source, so deleting it costs a reindex and nothing else. When an upgrade changes how Office files are converted, Pinchy converts the files again on its own, starting when it starts, and deletes the PDFs converted the old way once no file a knowledge-base agent can search is indexed from them any more, so the volume doesn’t keep a generation nothing reads. Until then the volume holds both. Upgrading says what that means for a rollback.
Plan for some headroom on that volume beyond the PDFs themselves. Office files are converted 20 at a time, and while a batch runs, each of its files sits on the volume twice — the private copy it is read from (see below) and the checked copy the converter makes of that, each never larger than the file itself — so for 20 decks near the 200 MB limit, that’s up to 8 GB — and the converter writes its PDFs right next to them before they’re stored. LibreOffice also needs scratch space while it opens a document, about as much as the document unpacks to, and it gets that on this volume as well, not in the container’s /tmp. A .docx or .pptx is a compressed archive and can unpack to far more than it weighs: one 150 KB Word file we tested needed 26 MB. The copies and the scratch space are deleted as soon as the batch finishes, and anything an interrupted run left behind (a restart or an upgrade mid-reindex) is cleared when Pinchy starts. If the volume fills up anyway, a file whose checked copy didn’t fit, that LibreOffice couldn’t open for lack of room, or whose converted PDF didn’t fit counts as failed for that run: whatever was indexed from an earlier version of it stays searchable, and it’s read again on the next run. Nothing is listed as unsearchable for it — with the one exception at the end of this paragraph. We ask the volume, not the converter, whether that happened, because LibreOffice reports a document it ran out of room for exactly as it reports one it can’t read. A file that came out without a PDF is put down to the volume when the volume no longer takes a write, has fewer than 1,024 free inodes, or has less space left than the file needs: what it unpacks to (nothing for a file that isn’t an archive, such as a classic .doc or .ppt), plus room for its PDF twice over, because LibreOffice writes the PDF to its scratch space first and then copies it out — 32 MiB, or four times the file’s size for a large one. A file LibreOffice can’t make a PDF of on a volume with that much room, such as a deck whose every slide is hidden, is listed as unsearchable as usual. That room for the PDF is an estimate, because the PDF was never written, and a file full of pictures can outgrow it: LibreOffice re-encodes pictures, and an 8.5 MB Word file of 200 screenshots we tested made an 82 MB PDF. Such a file whose PDF didn’t fit, on a volume that still had the estimated room — for that file anywhere between 34 MB and 164 MB free — is the exception: we can’t tell it from a deck of hidden slides, so it’s listed as unsearchable, whatever was indexed from an earlier version of it is dropped, and it’s read again on the next runs, five tries in all, the same as any Office file that couldn’t be converted. It can’t happen on a volume that keeps more room free than twice your largest PDF while a batch runs.
The volume also holds a private copy of each document while it is being read — by a reindex, or for a spreadsheet preview — so that no reader ever opens a path in a mounted folder that someone could have swapped for a link. Pinchy streams the file into the copy rather than holding it in memory, and deletes the copy as soon as the read is done; copies an interrupted run left behind are cleared when Pinchy starts. Office documents are converted in batches of 20, so during a conversion that can be 20 copies at once, next to the 20 checked copies above. A document whose private copy doesn’t fit counts as failed for that run, like one whose checked copy didn’t, and a spreadsheet preview answers that the reader is unavailable right now.
CPU when the knowledge base embeds
Section titled “CPU when the knowledge base embeds”The knowledge base’s embedding model runs inside the pinchy container, and it computes on the CPU. Pinchy sizes its thread pool to the CPU the container may actually use — the smaller of the host’s cores and PINCHY_CPUS, rounded down — minus one core, which it leaves for the requests, uploads and document extraction running alongside. It never goes above six threads. With the default PINCHY_CPUS=1.5, that’s one thread on any host; PINCHY_CPUS=2.5 gives one too, 4 gives three, and anything from 7 up gives six.
That’s deliberately fewer threads than the hardware might seem to allow. The model’s threads wait for each other many times per document, so a thread without a core of its own holds all the others up. We measured it on two cores capped at 1.5 CPUs, the default on a small VPS:
| Threads | One search query | Three at once | One indexed chunk |
|---|---|---|---|
| 4 | 3–6 s | up to 15 s | 3–6 s |
| 1 | under 25 ms | under 60 ms | under 1 s |
The spare core matters on bigger boxes too, just less. On four cores, an indexed chunk took 0.27–0.39 s at four threads and 0.31–0.40 s at three; with one other busy process in the container, four threads slowed to 0.4–1.1 s while three stayed at 0.31–0.32 s. Search queries took under 10 ms either way.
What a bigger box buys you is faster indexing, not faster search: a search query is short and already takes milliseconds. To speed up a large first index, raise PINCHY_CPUS (and the host’s cores with it); Pinchy picks up the extra cores on its next start.
If your host hides its CPU limit from the container, set the thread count yourself in docker-compose.override.yml:
services: pinchy: environment: - KB_EMBEDDING_THREADS=2Any positive whole number works; anything else is ignored and Pinchy decides as above. Leave a core spare where you can; on one or two cores, stay at 1.
Health checks
Section titled “Health checks”db and pinchy each have a Docker health check: db polls pg_isready, and pinchy polls its own /api/internal/openclaw-config-ready endpoint. openclaw has a lightweight TCP liveness check — a raw connect to the gateway’s WebSocket port (18789) that succeeds as soon as the gateway is accepting connections. It doesn’t inspect the gateway’s internal state, only that something is listening; OpenClaw’s own start script already respawns the gateway process if it dies internally, so this check exists to surface a fully stuck container (process alive, port not listening). Note that Compose does not restart a container just because it is unhealthy — restart: policies act on container exit, not health status. The check is diagnostic: a stuck container shows as unhealthy in docker compose ps so you can spot it and restart it yourself, rather than it silently sitting “up” but unreachable.
You can watch health status with:
docker compose psA container stuck in unhealthy for longer than its configured retries × interval is a signal worth investigating in docker compose logs <service> before assuming a resource limit is to blame.