| 1 | # celld documentation |
| 2 | |
| 3 | celld is a self-hosted distributed system that you program like a database. |
| 4 | Each Durable Object is its own SQLite database with a single writer, addressed |
| 5 | by name and continuously replicated to an S3-compatible bucket you own. A fleet |
| 6 | of celld nodes coordinates through that bucket alone — no control plane, no |
| 7 | membership service, no consensus — running Cloudflare Workers and Durable |
| 8 | Objects on your own machines. |
| 9 | |
| 10 | Because state is partitioned into one small database per object from the first |
| 11 | line of code, applications shard by construction. The contention, hot spots, |
| 12 | and blast-radius failures of a single shared database are designed out rather |
| 13 | than managed: a runaway object can only affect its own cell. |
| 14 | |
| 15 | ## Contents |
| 16 | |
| 17 | - [Install](#install) |
| 18 | - [Configure object storage](#configure-object-storage) |
| 19 | - [Deploy an application](#deploy-an-application) |
| 20 | - [Start a node](#start-a-node) |
| 21 | - [Add nodes](#add-nodes) |
| 22 | - [Diagnose a fleet](#diagnose-a-fleet) |
| 23 | - [Environment variables](#environment-variables) |
| 24 | - [Cloudflare service compatibility](cloudflare-compat.md) |
| 25 | - [Support matrix](support.md) |
| 26 | - [v0.0.1 limitations](limitations.md) |
| 27 | - [Security](security.md) |
| 28 | |
| 29 | ## Install |
| 30 | |
| 31 | The installer downloads the `celld` binary. Running a node also needs |
| 32 | [Litestream](https://litestream.io) on `PATH` (or `LITESTREAM_BIN`), and |
| 33 | Worker projects deployed with `celld deploy` need esbuild. Asset-only |
| 34 | projects do not: |
| 35 | |
| 36 | ```sh |
| 37 | curl -fsSL https://celld.dev/install.sh | sh |
| 38 | ``` |
| 39 | |
| 40 | Put `~/.local/bin` on `PATH` if the installer asks you to. Install an exact |
| 41 | immutable release by setting `CELLD_VERSION` to its tag, such as `v0.0.1`. |
| 42 | Rerun the installer with a previous tag to roll back both binaries. Releases |
| 43 | are published on [GitHub](https://github.com/denoland/celld/releases) with |
| 44 | GitHub Actions build attestations; verify any downloaded asset with |
| 45 | `gh attestation verify <asset> --repo denoland/celld`. |
| 46 | |
| 47 | ## Configure object storage |
| 48 | |
| 49 | celld uses the standard AWS credential chain. For Cloudflare R2, create a |
| 50 | bucket and an S3 API token with access to that bucket, then set: |
| 51 | |
| 52 | ```sh |
| 53 | export AWS_ACCESS_KEY_ID=... |
| 54 | export AWS_SECRET_ACCESS_KEY=... |
| 55 | export AWS_REGION=auto |
| 56 | export S3_ENDPOINT=https://ACCOUNT_ID.r2.cloudflarestorage.com |
| 57 | export CELLD_BUCKET=s3://YOUR-BUCKET |
| 58 | ``` |
| 59 | |
| 60 | Treat access to the fleet bucket and its credentials as fleet-administrator |
| 61 | access. The bucket contains deployments, SQLite replicas, ownership records, |
| 62 | node leases, and the peer-authentication secret. |
| 63 | |
| 64 | ## Deploy an application |
| 65 | |
| 66 | Install `esbuild` on `PATH` when the project includes Worker code, then run |
| 67 | `celld deploy` from a supported Wrangler project: |
| 68 | |
| 69 | ```sh |
| 70 | git clone https://github.com/denoland/celld |
| 71 | cd celld/examples/counter |
| 72 | celld deploy . \ |
| 73 | --bucket "$CELLD_BUCKET" \ |
| 74 | --endpoint "$S3_ENDPOINT" \ |
| 75 | --region "$AWS_REGION" |
| 76 | ``` |
| 77 | |
| 78 | `celld deploy` supports module Workers, Durable Object bindings, and |
| 79 | co-deployed or asset-only static assets. The asset subset includes the assets |
| 80 | binding, HTML and not-found handling, worker-first routes, `_headers`, and |
| 81 | `_redirects`. It refuses unknown Wrangler configuration rather than silently |
| 82 | dropping it. See the [v0.0.1 limitations](limitations.md) for the current |
| 83 | deployment boundary. |
| 84 | |
| 85 | ## Start a node |
| 86 | |
| 87 | For local development, the default listener is enough: |
| 88 | |
| 89 | ```sh |
| 90 | celld \ |
| 91 | --bucket "$CELLD_BUCKET" \ |
| 92 | --endpoint "$S3_ENDPOINT" \ |
| 93 | --region "$AWS_REGION" |
| 94 | ``` |
| 95 | |
| 96 | For a reachable fleet node, bind the service and advertise the address other |
| 97 | nodes and ingress can actually reach: |
| 98 | |
| 99 | ```sh |
| 100 | celld \ |
| 101 | --bucket "$CELLD_BUCKET" \ |
| 102 | --endpoint "$S3_ENDPOINT" \ |
| 103 | --region "$AWS_REGION" \ |
| 104 | --listen 0.0.0.0:8080 \ |
| 105 | --advertise node-a.internal:8080 |
| 106 | ``` |
| 107 | |
| 108 | ## Add nodes |
| 109 | |
| 110 | Start every node with the same bucket settings and a distinct reachable |
| 111 | `--advertise` address. Nodes discover one another through bucket leases; there |
| 112 | is no join command and no fixed membership list. |
| 113 | |
| 114 | The bucket provides discovery and authority, not network reachability. |
| 115 | Peer HTTP is versioned, body-bound, HMAC-authenticated, clock-bounded, and |
| 116 | replay-protected, but v0.0.1 does not terminate TLS. Put advertised addresses |
| 117 | on a trusted private network or an encrypted overlay such as WireGuard or |
| 118 | Tailscale. Do not expose the peer port directly to the public internet. |
| 119 | |
| 120 | ## Diagnose a fleet |
| 121 | |
| 122 | `celld diagnose` reads the bucket's node leases and directly probes every live |
| 123 | peer without acquiring a lease or changing ownership: |
| 124 | |
| 125 | ```sh |
| 126 | celld diagnose \ |
| 127 | --bucket "$CELLD_BUCKET" \ |
| 128 | --endpoint "$S3_ENDPOINT" \ |
| 129 | --region "$AWS_REGION" |
| 130 | ``` |
| 131 | |
| 132 | Use `--peer NODE_ID` one or more times to restrict the probes. The report |
| 133 | distinguishes expired records, unsafe or malformed advertised addresses, |
| 134 | unreachable peers, authentication failures, and protocol incompatibility. |
| 135 | |
| 136 | ## Environment variables |
| 137 | |
| 138 | `celld -h` is the authoritative compact list. The main settings are: |
| 139 | |
| 140 | | variable | purpose | |
| 141 | | --- | --- | |
| 142 | | `CELLD_BUCKET` | Fleet bucket, equivalent to `--bucket` | |
| 143 | | `S3_ENDPOINT` | S3-compatible endpoint, equivalent to `--endpoint` | |
| 144 | | `AWS_REGION`, `AWS_DEFAULT_REGION` | Storage region | |
| 145 | | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` | Explicit AWS credentials; the normal AWS credential chain is also supported | |
| 146 | | `CELLD_ADDR` | Listener, equivalent to `--listen` | |
| 147 | | `CELLD_ADVERTISE` | Peer-reachable address, equivalent to `--advertise` | |
| 148 | | `CELLD_UNSAFE_PUBLIC_ADVERTISE` | Permit a literal public peer IP when set to `on` | |
| 149 | | `CELLD_NODE` | Explicit node-session ID | |
| 150 | | `CELLD_WATCH` | Local SQLite/Litestream working directory | |
| 151 | | `LITESTREAM_BIN` | Litestream executable path | |
| 152 | | `CELLD_ESBUILD` | esbuild executable path | |
| 153 | | `CELLD_WORKERS` | Stateless Worker pool size (default: 16) | |
| 154 | | `CELLD_ACTIVATIONS` | Concurrent cold-cell activation limit (default: the smaller of Worker count and 128) | |
| 155 | | `CELLD_WORKER_LOADER` | Bind a Worker Loader (Code Mode) at this `env` name so a Worker can spawn isolates at runtime; off unless set (experimental) | |
| 156 | | `CELLD_MAX_LOADED_WORKERS` | Cap on concurrent dynamically-loaded workers (default: 256) | |
| 157 | | `CELLD_MAX_RESIDENT_CELLS`, `CELLD_RESIDENT_LOW_WATER` | Resident-cell pressure thresholds | |
| 158 | | `CELLD_MAX_RSS_MB`, `CELLD_MAX_CPU_PERCENT` | Linux process-pressure thresholds | |
| 159 | | `CELLD_VAR_*`, `CELLD_VARS_FILE` | Worker variable overrides | |
| 160 | | `GOMEMLIMIT` | Litestream Go heap limit (default child: `512MiB`) | |
| 161 | | `RUST_LOG` | Runtime log filter | |
| 162 | |
| 163 | The help output also names the advanced runtime tuning switches and their |
| 164 | defaults. |