Diffinery

homeflare/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

diffinery/HOMEFLARE.md
84 lines · 4.1 KBRaw History
1# Diffinery on Homeflare
2
3A fork of [codician-team/diffinery](https://github.com/codician-team/diffinery)
4whose deploy scripts also work against Homeflare. `main` is upstream's `main`
5plus a few commits, each one droppable or fit to send upstream on its own:
6
7- `CLOUDFLARE_API_BASE_URL` and `CLOUDFLARE_CONTAINER_REGISTRY` in the scripts,
8 with Cloudflare's API and registry as the defaults.
9- The Homeflare deploy described below, skipping the steps that need Cloudflare
10 itself.
11- `scripts/setup.sh` reading the `/login` page before matching it: `curl | grep -q`
12 fails under `pipefail` when grep stops early.
13- `CONTAINER_MAX_INSTANCE_TYPE` in `scripts/render-config.mjs`, for a machine smaller than Cloudflare's
14 ([Container sizes](#container-sizes)).
15
16Rebase onto upstream when it moves:
17
18```sh
19git remote add upstream https://github.com/codician-team/diffinery.git
20git fetch upstream && git rebase upstream/main
21```
22
23## How it works
24
25[Homeflare](https://github.com/jason-s13r/homeflare) runs Workers on your own machines (celld) behind a
26Cloudflare-compatible API. These scripts deploy to it when `CLOUDFLARE_API_BASE_URL` points at that API,
27which `homeflare-wrangler run` sets, along with `CLOUDFLARE_CONTAINER_REGISTRY` (Homeflare's registry) and a
28`docker` command on your Podman.
29
30On another API than Cloudflare's, `scripts/setup.sh` and `scripts/bootstrap.sh` skip what needs Cloudflare
31itself:
32
33| Skipped | What it means |
34| --- | --- |
35| Zone check | The hostname is a Homeflare custom domain, not a route in a Cloudflare zone. |
36| R2 lifecycle rules | Logs, artifacts, archives and exports don't age out by themselves. |
37| Email Sending setup and its event subscription | Onboard the sending domain in Cloudflare yourself (Homeflare relays email through it with `HOMEFLARE_EMAIL=cloudflare`). Bounces and complaints don't reach the suppression list. |
38| Turnstile widget | Make one in the Cloudflare dashboard and pass its keys: `TURNSTILE_SITE_KEY` and `TURNSTILE_SECRET`. Without them open sign-up and anonymous security reports stay off. |
39| Cloudflare Access | Email recovery and the `/auth/access` first sign-in stay off. Passkeys work. |
40
41## Deploy
42
43Put the settings in a file outside the repository (it holds the Turnstile secret), for example
44`~/.config/homeflare/diffinery.env`, readable by you only:
45
46```sh
47CLOUDFLARE_ACCOUNT_ID=<Homeflare's account id>
48DIFFINERY_DOMAIN=git.homeflare.example.com
49MAIL_DOMAIN=example.com
50[email protected]
51TURNSTILE_SITE_KEY=0x4AAA...
52TURNSTILE_SECRET=0x4AAA...
53```
54
55`MAIL_DOMAIN` is a domain onboarded to Email Sending in your Cloudflare account. Homeflare's account id is
56in the Dashboard, or from `GET /client/v4/accounts`. Then, from the repository:
57
58```sh
59homeflare-wrangler --env-file ~/.config/homeflare/diffinery.env run scripts/setup.sh --yes
60```
61
62`homeflare-wrangler` reads the Homeflare API token from `~/.config/homeflare/wrangler.env` and sets
63`CLOUDFLARE_API_BASE_URL` itself. Run it again to update.
64
65### Container sizes
66
67celld reserves each running container's whole instance type: a large runner (`standard-4`) books 12 GiB
68and 4 vCPUs, so a few at once fill a home machine. celld starts a container only while the running ones'
69reservations fit its container budget (`CELLD_CONTAINER_MEMORY_MB` in Homeflare's `homeflare.env`; 80% of
70the machine's memory by default); past it, a job waits for one to finish. For more jobs at once, raise that
71budget (reservations are caps, rarely all used), or make the containers smaller:
72
73```sh
74CONTAINER_MAX_INSTANCE_TYPE=standard-3 # in diffinery.env: no container above 2 vCPUs / 8 GiB
75```
76
77Every container class above it (large and medium runners, imports) then runs on it, with its vCPUs too:
78`standard-2` is 1 vCPU and 6 GiB, so builds slow down. Unset, each class keeps `wrangler.jsonc`'s type.
79
80## The first administrator
81
82Without Access, the first account comes from open sign-up, which needs Turnstile and email. Deploy once with
83`"SIGNUP": "open"` under `vars` in `apps/diffinery/wrangler.jsonc`, sign up at `https://<host>/signup` with an
84address in `BOOTSTRAP_ADMINS`, add a passkey, then remove `SIGNUP` and deploy again.