Run Calends on your own machine with Docker, including persistent storage, HTTPS and backups.
Since v1.1.0, prebuilt images are available on Docker Hub as xizozhe/calends and on GHCR as ghcr.io/imetn/calends. Both allow anonymous pulls and support linux/amd64 and linux/arm64. Since 1.25.0, esbuild bundles the same Worker to run in a single Node 24 process, with node:sqlite providing the D1 interface. The image no longer starts wrangler dev, workerd or Miniflare. The SQLite data path is unchanged.
Run a prebuilt image
docker run -d --name calends -p 127.0.0.1:8787:8787 -v calends-data:/data xizozhe/calends:latestdocker logs calendsCreate compose.yaml in a deployment directory of your choice (the repository’s docker/docker-compose.yml builds from source by default):
name: calendsservices: calends: image: xizozhe/calends:latest restart: unless-stopped mem_limit: 512m ports: - '127.0.0.1:8787:8787' volumes: - calends-data:/data environment: # Public address used in reminder and calendar links (optional) # SITE_URL: https://calends.example.com # Usually leave TRUST_PROXY unset (automatic visitor IP detection) TZ: UTC
volumes: calends-data: name: calends-datadocker compose up -ddocker compose logs calendsOpen http://localhost:8787 and set your password with the setup token from docker logs calends (or docker compose logs calends). To use GHCR instead, replace xizozhe/calends:latest with ghcr.io/imetn/calends:latest in the examples.
What happens on start
-
Migrations are applied to the database in the data directory (idempotent; checked on every start).
-
The setup token is prepared:
SETUP_TOKENfrom the environment if set; otherwise a random one is generated on first start, saved assetup-tokenin the data directory and reused after that. -
The Worker starts and listens on
PORT(8787 by default). -
If no password has been set yet, the setup token is printed to the logs:
[calends] first run: create your password at / with this setup token:[calends] <token> -
Scheduled work runs in-process every 15 minutes, matching the Cloudflare cron: each run checks reminders, and the top of each UTC hour also handles exchange-rate maintenance.
The container health check requests /healthz, checking the database directly without entering the Worker.
A typical ledger uses about 100–150 MB of memory with near-zero idle CPU. These are test-environment observations, not guarantees for every workload; sustained operation on a real 1 CPU / 1 GB server has not been verified. Compose defaults to a 512 MB memory limit, and the image caps the JavaScript heap at 192 MB. Use prebuilt images on small servers; building needs more memory.
Request bodies are limited to 64 KB for login and authentication routes, 20 MB for backups, imports and assistant chat, and 4 MB otherwise. Declared oversized requests return 413; chunked uploads stop at the limit and fail as unreadable bodies.
If the expected database is missing while other ledger databases or setup-token remain in the data directory, the container refuses to start and logs the reason instead of silently creating an empty ledger. Check the original volume and DATA_DIR; do not delete real data to bypass this check.
Environment variables
| Variable | Default | Details |
|---|---|---|
SETUP_TOKEN |
generated | Setup token for setting the first password. |
SITE_URL |
the address you open the app from | Links in reminders and the calendar feed. Passkey RP ID and origin also use this URL; set the public HTTPS URL behind a reverse proxy. |
TRUST_PROXY |
unset | Usually leave unset. off ignores X-Forwarded-For; a comma-separated IP/CIDR list adds trusted proxies. Custom domain and HTTPS. Not used on Cloudflare. |
DATA_DIR |
/data |
Data directory. |
PORT |
8787 |
Listening port. |
NODE_OPTIONS |
--max-old-space-size=192 --disable-warning=ExperimentalWarning |
JavaScript heap cap and warning settings; retain the warning flag when changing the cap. |
BASE_PATH |
empty | Subpath such as /calends; use the same build argument and runtime variable. |
Only SETUP_TOKEN, SITE_URL, BASE_PATH and RUNTIME (from CALENDS_RUNTIME, default node, used by upgrade guidance) (plus the legacy OWNER_PASSCODE) are passed to the Worker. TRUST_PROXY is handled by the Node HTTP entrypoint, not passed to the Worker. The former INTERNAL_PORT setting is removed; PORT is the only listening port. The container’s TZ doesn’t affect reminders; they follow Settings → General → Time zone.
HTTPS
On the public internet, put Calends behind a reverse proxy for HTTPS and follow the proxy header and port rules. Passkeys only work over HTTPS. With Caddy:
calends.example.com { reverse_proxy 127.0.0.1:8787}More in Custom domain and HTTPS.
Data and backups
Everything lives in the calends-data volume (/data in the container), including the SQLite database and the setup-token file. Removing the container keeps your data; removing the volume doesn’t.
Two ways to back up:
-
Settings → Data → Export full backup gives you a JSON file you can restore on any deployment; see Backup and restore;
-
or archive the volume with the container stopped:
Terminal window docker stop calendsdocker run --rm -v calends-data:/data -v "$PWD":/backup alpine tar czf /backup/calends-data.tgz -C /data .docker start calends
Build from source
The Dockerfile is at docker/Dockerfile, and the repository’s Compose file is at docker/docker-compose.yml. To build and start with Compose:
git clone https://github.com/imetn/calends && cd calendscd docker && docker compose up -d --builddocker compose logs calendsThe Compose project name is calends, and its data volume is calends_calends-data. Use that name when backing up or upgrading this deployment; it is separate from the calends-data volume used in the prebuilt-image examples above.
Alternatively, build from the repository root and start the image directly:
docker build -f docker/Dockerfile -t calends:local .docker run -d --name calends -p 127.0.0.1:8787:8787 -v calends-data:/data calends:localdocker logs calendsWithout Docker (systemd)
On Debian or Ubuntu, install Calends with its own copy of Node and start it on 127.0.0.1:8787:
curl -fsSL https://calends.date/install.sh | sudo bashRun the same command to upgrade: it backs up data, keeps settings, and restores the previous program and data if startup fails or the upgrade is interrupted. Use --version 1.84.0 for a specific release. The script does not configure domains or web servers; point your own reverse proxy at the local port, set SITE_URL and follow Custom domain and HTTPS. It has been tested in Debian 12 and Ubuntu 24.04 VMs; sustained operation on a real small-memory VPS has not been verified.
The manual steps below are also available.
A small VPS doesn’t need Docker. Since 1.26.0, each release includes a tarball that runs the same code as the image, needs no npm install, and works on x86 and ARM. It requires Linux, systemd and a system-wide Node 24 (check with node -v); the service can’t read a Node installed under a home directory, such as with nvm.
VERSION=1.84.0curl -fLO https://github.com/imetn/calends/releases/download/v$VERSION/calends-$VERSION.tar.gzcurl -fLO https://github.com/imetn/calends/releases/download/v$VERSION/calends-$VERSION.tar.gz.sha256sha256sum -c calends-$VERSION.tar.gz.sha256sudo mkdir -p /opt/calendssudo tar -xzf calends-$VERSION.tar.gz -C /opt/calends --strip-components=1 --no-same-ownersudo cp /opt/calends/calends.service /etc/systemd/system/sudo systemctl daemon-reloadIf you’re moving from Docker, copy the data now (replace calends with your container name) and put the container’s environment variables in /etc/calends.env, described below. Don’t copy over a service that has already started, and don’t move a subpath deployment this way. Skip this step on a fresh install:
sudo docker stop calendssudo mkdir -p -m 700 /var/lib/privatesudo docker cp calends:/data/. /var/lib/private/calends/Then start the service:
sudo systemctl enable --now calendssudo journalctl -u calends -n 20Don’t send the setup token and password over the public internet in plain text. Forward the port first with ssh -L 8787:localhost:8787 user@your-server, open http://localhost:8787/ and set your password with the setup token from the log. Data lives in /var/lib/calends, memory is capped at 512 MB, and the service restarts if the process exits unexpectedly.
Put settings from Configuration in /etc/calends.env, one NAME=value per line and protected with sudo chmod 600, then run sudo systemctl restart calends. Behind a reverse proxy, set HOST=127.0.0.1; usually leave TRUST_PROXY unset. Leave DATA_DIR unchanged and keep PORT above 1024. The tarball is built for the root path; use Docker to deploy under a subpath.
To upgrade or roll back, replace the code and leave the data alone. You can only roll back to a version whose database schema is no older than your data, so export a backup in Settings first. Set VERSION to the version you want, download and verify its tarball, then run:
sudo systemctl stop calendssudo rm -rf /opt/calendssudo mkdir -p /opt/calendssudo tar -xzf calends-$VERSION.tar.gz -C /opt/calends --strip-components=1 --no-same-ownersudo cp /opt/calends/calends.service /etc/systemd/system/sudo systemctl daemon-reloadsudo systemctl start calendsImage tags
| Tag | Meaning |
|---|---|
latest |
Tracks image updates. |
1.84.0 |
A specific release; recommended for controlled upgrades. |
1.84 |
Tracks patch releases in the 1.84 series. |
Both registries provide these tags. For production, pin an exact version such as xizozhe/calends:1.84.0; use ghcr.io/imetn/calends:1.84.0 as an alternative.
Upgrade the image
Pull the new image, then recreate the container using the same data volume:
docker pull xizozhe/calends:latestdocker stop calendsdocker rm calendsdocker run -d --name calends -p 127.0.0.1:8787:8787 -v calends-data:/data xizozhe/calends:latestKeep the original ports, environment variables and restart policy when recreating the container. Removing the container preserves the named volume; do not delete the volume. For a pinned deployment, replace latest in both commands with your chosen version. With the prebuilt-image compose.yaml above, run docker compose pull followed by docker compose up -d in its directory; keep the same Compose project and volume settings.
Keep the same volume, ports and environment settings when upgrading. Numeric TRUST_PROXY values mean automatic detection; review Custom domain and HTTPS.
For source-build upgrades and verification, see Upgrading.
When running on a remote host, keep the published port on loopback. Use ssh -L 8787:localhost:8787 user@server for the initial http://localhost:8787 login, or configure HTTPS first. If the proxy runs in another container, use a shared private Docker network instead of publishing the port to the Internet.
File content is stored under /data/files. Persist and back up the entire /data volume along with the database.