Running a server
Backups, updates and monitoring
What the data volume holds, how to back it up and restore it, how to update the server, how the databases are kept in shape, and where to look when something is wrong.
What the volume holds#
Everything the installation keeps is in the volume mounted at /data:
| Path | Holds |
|---|---|
lambda.db |
the platform’s records: apps, versions, drafts, settings, sealed secrets |
analytics.db |
the counted visits - nothing else depends on it |
code/ |
the kept versions of every app: a manifest each, and the files they hold, kept once per app |
resources/ |
what each app’s online version serves, written anew with every deployment |
databases/ |
the apps’ databases, a folder each |
workspaces/, features/ |
the apps’ files, and the drafts: which files each holds, and its copy of the data |
git/ |
the apps’ git history |
sources/ |
published sources packed for download - a cache |
branding/, showcase/ |
the installation’s logo and the showcase’s pictures |
secrets.key |
the key the secrets are sealed with |
assemblies/, staging/, crawlers/, geo/, dumps/ |
compiled apps, uploads and downloads on their way, the lists of crawlers, the address registries, crash dumps |
With PostgreSQL, the records and the apps’ databases are in the database server instead; everything else stays in the volume.
Back up#
Back up the whole volume. For a consistent copy of the SQLite files, stop the container for the moment of the copy - or snapshot the file system the volume lives on.
Shell
docker stop lambda # with Compose: docker compose stop
docker run --rm -v lambda-data:/data:ro -v "$PWD":/backup alpine \
tar czf /backup/lambda-$(date +%F).tar.gz -C /data .
docker start lambda # with Compose: docker compose start
Compose prefixes the volume’s name with the project’s: genhttp-lambda_lambda-data for the repository’s sample, <folder>_lambda-data otherwise - docker volume ls shows it. A mistyped name does not fail: Docker makes a new, empty volume, and the backup holds nothing.
With PostgreSQL, back up the database as well (pg_dump), at the same time as the volume.
Restore, or move to another server#
Restore the volume’s contents on the new server - into the volume your setup uses, Compose’s prefix included - and start the container with the same configuration:
Shell
docker volume create lambda-data
docker run --rm -v lambda-data:/data -v "$PWD":/backup alpine \
tar xzf /backup/lambda-2026-11-19.tar.gz -C /data
The secrets open if secrets.key came along, or LAMBDA_SECRETS_KEY is set to the key the data was written with; with another key, the server logs an error when a secret is first read or stored. If the new server has another address, update LAMBDA_PUBLIC_URL; existing clones need git remote set-url to the new host.
Update#
Shell
docker pull genhttp/lambda
docker compose up -d # or: docker rm -f lambda, then run it again
The platform’s database is migrated as the server starts; apps and their data are left as they are. Production and system apps are compiled right after the start, the others on their first request. Images are tagged with their version as well as latest - pin one (genhttp/lambda:0.11.0) to update deliberately, and take a backup before you do.
Keeping the databases in shape#
The platform optimizes the databases itself: its own records and analytics, and the database of every app that keeps one - not the drafts’ copies, which go when a draft is put online. Each is optimized at most once a day, in its quiet hours: an app’s own where enough of its requests were counted to tell them, otherwise the installation’s. On the first day, before those are known, from 03:00 to 06:00 on the server’s clock - the container’s, which is UTC unless TZ says otherwise. An app nobody visited since its database was last optimized is left alone.
What is done is the database’s own upkeep:
SQLite
PRAGMA optimizebrings the statistics the query planner reads up to date.VACUUMrebuilds the file where a quarter of it, and a megabyte at the least, is room that deleted records left - room that counts against the app’s data allowance until then. It is left out where it would cost too much: for a file over 256 MB, since writers wait while it runs; where there is no room for SQLite’s temporary copy (inTMPDIR, else/var/tmp) or for twice the file in the volume; and where a table has neither anINTEGER PRIMARY KEYnor an index, whose rows a rebuild would number anew.PRAGMA wal_checkpoint(TRUNCATE)gives back the room the journal grew to.
PostgreSQL
VACUUM (ANALYZE, SKIP_LOCKED)on every table, one after the other: the room of deleted rows is marked for reuse and the statistics are taken, as autovacuum does. A table somebody holds a lock on is skipped. NeverVACUUM FULL, which locks out every reader.
The panel shows what the last runs did under Settings, beside the switch; what was done to an app’s database - the statements run, what was left out and why, the room before and after - is optimization of its GET /api/v1/admin/lambdas/{publicKey}. Every run is logged as Optimized databases count …, and a database that fails as a warning; it is tried again the next day. Where the database has maintenance of its own - a PostgreSQL server looked after by its administrators - switch it off under Settings.
Monitoring#
- Dashboard in the panel: what needs you - apps failing, requests to connect, the volume filling up, data over its allowance.
- Server: memory and load over the last day. A managed heap that keeps climbing across collections is a leak; memory the runtime holds while the heap stays flat is not.
- Storage: free space, and what takes it - by part and by app. Versions and drafts are where it goes: an app’s versions keep what they hold once - each takes what it changed, 50 per app by default - and each draft copies its app’s data.
- Log: everything the server and the apps print, live; it holds the recent past in memory. The container’s output has the whole run (
docker logs lambda). - Health check: the server’s own binary asks the server for
GET /api/v1/system(--health), as the image has no shell to ask with; any answer short of a server error counts, anddocker psshows the result. - After an unclean stop, the panel says how the previous run ended - its memory and requests at the last heartbeat.
Budget#
- Memory: the files of a version are read where they are needed - its code to compile it, its resources as they are copied out to be served - so what a version weighs takes little memory to save, change or deploy. What a request carries is held while it is read: a version sent whole as JSON with its pictures in base64 - about 430 MB for 120 MB of pictures - or a git push. On a small machine, lower the size a version may come to under Limits, for every tier.
- Disk: what several versions of an app hold is kept once, so a version takes what it changed - and a large file that changes with every save takes its room again with every version. Lower Versions kept or the size of a version where disk is tight.
- Requests: apps answer 64 requests at a time (
LAMBDA_MAX_CONCURRENCY), each within 15 seconds (LAMBDA_EXECUTION_TIMEOUT_SECONDS).