Diffinery

homeflare/celldpublic

celld/HOMEFLARE.md
49 lines · 2.2 KBRaw History
1# celld for Homeflare
2
3A fork of [denoland/celld](https://github.com/denoland/celld) with the
4patches Homeflare's runtimes need. Upstream stopped at v0.6.3 when celld began
5merging into workerd, so fixes for gaps Homeflare apps hit land here.
6
7## Branches
8
9`main` is upstream's v0.6.3 plus the patches below, one commit each, so a patch
10can be dropped once the merged workerd covers it. Rebase onto upstream when it
11moves:
12
13```sh
14git remote add upstream https://github.com/denoland/celld.git
15git fetch upstream && git rebase upstream/main
16```
17
18## Patches
19
20| Patch | Why |
21|---|---|
22| `node:net` `isIP` / `isIPv4` / `isIPv6`; `node:dns` and `node:dns/promises` `lookup()` | Fedify checks a URL's host with both before fetching it, so palm's remote lookups failed with `node:net.isIP is not implemented in celld`. `lookup()` uses the node's resolver through a new `__dns_lookup` op, with `connect()`'s egress rules. |
23| `Response.clone()` on a streaming body | celld threw `Cannot clone a streaming response before consumption`; workerd tees the body, as celld's `Request.clone()` already did. palm's media proxy returns a fetched image and caches `response.clone()`. |
24| `node:url` (all but the legacy `parse` / `resolve`) | celld had no `node:url`; Fedify's WebFinger handler calls `domainToASCII` and `domainToUnicode`. Both run Node's own steps (the input set as a `ws://x` hostname) through new host ops on the `url` crate. |
25
26## Building
27
28Homeflare builds this repo into its runtime image: set
29`HOMEFLARE_CELLD_SOURCE=https://github.com/jason-s13r/celld.git` in
30`homeflare.env` (see Homeflare's README). By hand, with Podman:
31
32```sh
33podman build -t localhost/homeflare-celld:dev \
34 --build-arg CELLD_COMMIT="$(git rev-parse HEAD)" .
35```
36
37The Dockerfile is upstream's: the image builds only if `cargo test` and
38`cargo clippy -D warnings` pass. `--build-arg CELLD_PROFILE=lab` swaps fat LTO
39for thin, which builds much faster.
40
41## Smoke tests
42
43Each folder in `homeflare/smoke/` is a Worker whose `GET /` reports its checks
44as JSON; a `paths.txt` beside it adds requests that must answer 200 with the given text. With a built `celld` and `esbuild` on `PATH`:
45
46```sh
47cargo build -p celld
48homeflare/smoke/run.sh # target/debug/celld
49```