Self-hosted search done right: 2server's Meilisearch template
A shared Meilisearch on your own VM, independent of Soot. Four defaults in 2server's template — an indexing RAM cap, an unprivileged read-only container, per-index client keys and an authenticated readiness probe — remove the two ways self-hosted search usually breaks.
Self-hosted full-text search tends to fail in two quiet ways. Your apps each carry a copy of the master key, so when one leaks, every index leaks. And one big indexing run can eat the machine's RAM until the OOM killer picks a victim — usually at the worst possible hour.
2server's meilisearch template attacks both with resource limits and key isolation baked into the defaults: one shared Meilisearch on your own VM, independent of Soot — Soot neither runs through it nor needs it running.
Here is what the template does. Commands and variables live in the 2server meilisearch docs.
Indexing gets a ceiling, not the whole machine
A first index build or a reindex after a schema change is when a search engine is hungriest for memory. On a VM with headroom that's a slowdown. On a VM running your actual app, it can push the kernel to kill a process — and the process isn't guaranteed to be Meilisearch.
The template puts two fences around it:
- Indexing memory capped at 50% of the container's RAM. The other half is reserved for the engine serving queries and the container's OS — a stop line before the OOM killer ever gets involved.
- Tmp indexing writes to disk, not RAM. The temporary files an index build produces — the part that eats memory fastest — go to disk instead. Disk is slower, but a full disk is an error you can see; exhausted RAM is a dead container.
On the same VM, everything else survives the biggest index build you'll ever run — the build is just slower, not fatal.
An unprivileged, read-only container that publishes no ports
The container runs as the unprivileged user 65532:65532, and its root filesystem is mounted read-only: anything it must write has to be a separately mounted volume; everything else is off-limits. One more default: no ports are published to the host — traffic reaches Meilisearch over the internal network on that VM.
For a service that only exists to serve your app, these are the right defaults: nothing exposed means no question about who is scanning your port, and a read-only rootfs shrinks what an attacker can change if the process is ever compromised.
The master key never leaves the infrastructure layer
This is where self-hosted search most often goes wrong operationally. A Meilisearch master key can do anything — create, delete, read every index. If each app holds a copy "for convenience", one leak is a total leak.
In the template the master key stays isolated at the infrastructure layer and is never handed to an app. Instead, 2server issues a separate client API key per product index: your app holds a key scoped to exactly the index it needs. A leaked app key exposes one index; the master key stays somewhere the app can't read.
Readiness is authenticated before a release
A search container that is "up" can still be unready: indexes not loaded, or busy warming up. The template's readiness probe checks the authenticated /indexes endpoint — not just an open port. Only when the probe passes does the new version get released. A replacement takes traffic only once it proves it answers the real protected API, not merely that a process exists.
What the template does not do
The boundaries matter as much as the features:
- No automatic backup, no automatic Meilisearch version migration. When you upgrade, take a manual snapshot first. Treat upgrades as a prepared operation, not a routine restart.
- Not a Soot dependency. This engine runs for your apps, on your VM, separate from Soot. Soot's data-pool keeps its metadata in PostgreSQL, not Meilisearch — don't read that backwards.
Next step
If your app needs search on a VM that already runs 2server: read the meilisearch template docs, deploy it as the shared engine, issue one client key per index — and keep the master key where apps can never reach it. Before your first upgrade, take the snapshot yourself; that's the one job the template hands back to you.
