Docker

Run Calends anywhere with the official image — docker run and compose, the setup token, data directory, scheduled jobs, HTTPS and backups.

On this page

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.

  1. Start the container using either method below, always mounting /data.
  2. Read the setup token from the logs and set a password at /login.
  3. Configure HTTPS and SITE_URL before public use.
  4. Add a subscription and notification channel, test reminders and arrange backups.

Run a prebuilt image

Terminal window
docker run -d --name calends -p 127.0.0.1:8787:8787 -v calends-data:/data xizozhe/calends:latest
docker logs calends

Create compose.yaml in a deployment directory of your choice (the repository’s docker/docker-compose.yml builds from source by default):

name: calends
services:
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-data
Terminal window
docker compose up -d
docker compose logs calends

Open 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

  1. Migrations are applied to the database in the data directory (idempotent; checked on every start).

  2. The setup token is prepared: SETUP_TOKEN from the environment if set; otherwise a random one is generated on first start, saved as setup-token in the data directory and reused after that.

  3. The Worker starts and listens on PORT (8787 by default).

  4. 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>
  5. 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 calends
    docker 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:

Terminal window
git clone https://github.com/imetn/calends && cd calends
cd docker && docker compose up -d --build
docker compose logs calends

The 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:

Terminal window
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:local
docker logs calends

Without Docker (systemd)

On Debian or Ubuntu, install Calends with its own copy of Node and start it on 127.0.0.1:8787:

Terminal window
curl -fsSL https://calends.date/install.sh | sudo bash

Run 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.

Terminal window
VERSION=1.84.0
curl -fLO https://github.com/imetn/calends/releases/download/v$VERSION/calends-$VERSION.tar.gz
curl -fLO https://github.com/imetn/calends/releases/download/v$VERSION/calends-$VERSION.tar.gz.sha256
sha256sum -c calends-$VERSION.tar.gz.sha256
sudo mkdir -p /opt/calends
sudo tar -xzf calends-$VERSION.tar.gz -C /opt/calends --strip-components=1 --no-same-owner
sudo cp /opt/calends/calends.service /etc/systemd/system/
sudo systemctl daemon-reload

If 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:

Terminal window
sudo docker stop calends
sudo mkdir -p -m 700 /var/lib/private
sudo docker cp calends:/data/. /var/lib/private/calends/

Then start the service:

Terminal window
sudo systemctl enable --now calends
sudo journalctl -u calends -n 20

Don’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:

Terminal window
sudo systemctl stop calends
sudo rm -rf /opt/calends
sudo mkdir -p /opt/calends
sudo tar -xzf calends-$VERSION.tar.gz -C /opt/calends --strip-components=1 --no-same-owner
sudo cp /opt/calends/calends.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start calends

Image 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:

Terminal window
docker pull xizozhe/calends:latest
docker stop calends
docker rm calends
docker run -d --name calends -p 127.0.0.1:8787:8787 -v calends-data:/data xizozhe/calends:latest

Keep 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.