# Self-Hosting

The Liso v2 sync server (`server/sync`, AGPL-3.0-only) is completely zero-knowledge: it stores
opaque ciphertext blobs, verifies Ed25519 request signatures, and never has access to vault keys
or item contents.

All deployment manifests live in `selfhost/`.

## Option 1: Cloudflare Workers (Serverless)

A personal or family sync server fits comfortably on the Cloudflare Workers Free plan using D1
and Durable Objects.

```sh
pnpm install
pnpm --dir server/sync exec wrangler login
selfhost/deploy.sh
```

`deploy.sh` provisions the D1 database, applies migrations, deploys the Worker, and prints your
server URL along with a one-time **setup code** (and QR code). Register your first account in
the Liso app using that setup code to become the server admin.

For manual setup, custom domains, CORS, and enabling R2 encrypted file attachments, see
`selfhost/deploy-cloudflare.md`.

## Option 2: Docker Compose (VPS / Homelab)

`selfhost/docker/` packages `server/sync` inside a hardened Node 24 / `workerd` container with a
read-only root filesystem, a persistent `/data` SQLite volume, and an optional Caddy reverse
proxy for automatic HTTPS and WebSocket upgrades.

```sh
export TOKEN_SECRET="$(openssl rand -base64 48)"
export SETUP_CODE="$(openssl rand -hex 12)"
export LISO_DOMAIN="sync.example.com"
export CADDY_EMAIL="admin@example.com"

# Start liso-sync + Caddy automatic HTTPS proxy
docker compose -f selfhost/docker/docker-compose.yml --profile proxy up -d --build

# Verify server metadata
curl -fsS "https://${LISO_DOMAIN}/health"
```

### Backup & Restore

```sh
./selfhost/docker/backup.sh ./backups
./selfhost/docker/restore.sh ./backups/liso-sync-backup-20260101T000000Z.tar.gz
```

## Option 3: Kubernetes (Helm)

Deploy on any Kubernetes cluster with the Helm chart in `selfhost/helm/liso-sync/`:

```sh
kubectl create secret generic liso-sync-secret \
  --from-literal=TOKEN_SECRET="$(openssl rand -base64 48)" \
  --from-literal=SETUP_CODE="$(openssl rand -hex 12)"

helm upgrade --install liso-sync ./selfhost/helm/liso-sync \
  --set secrets.existingSecret=liso-sync-secret \
  --set ingress.enabled=true \
  --set ingress.hosts[0].host=sync.example.com
```

Keep `replicaCount: 1` with the default `Recreate` strategy because SQLite/Durable Object state
is stored on a `ReadWriteOnce` PersistentVolumeClaim.

## Registration Modes

Control who can create accounts via `REGISTRATION_MODE`:

- `owner` (default): First account uses `SETUP_CODE` to become admin; subsequent accounts require
  an admin-minted invite code.
- `invite`: Any existing member can mint invite codes.
- `open`: Anyone with the URL can register (not recommended for personal servers).

---
Source: https://docs.lisovault.com/guide/self-hosting · Canonical site: https://lisovault.com/
