OXYGENHUB
# 5436f0dd9429 oxygenhub / docs / deploy.md
4.8 KiB · Markdown · last changed Outbound requests only to public addresses 20 days ago renderedsource blame history raw
93be9ce4 Andy McCall 1
# Deploying the developer edition on Earth
2
baebdd18 Andy McCall ↶ 3
Companion to `spec.md` §17.5. Status: **installed and running** since 2026-09-27 as the systemd service `oxygenhub` under the `oxygenhub` system user, data in `/home/oxygenhub/data`, HTTP on 7300 and HTTPS on 7343 with a self-signed certificate. `oxygen`, `oxygen-vscode` and `oxygenhub` are hosted under `andymccall/` and each checkout has an `earth` remote.
93be9ce4 Andy McCall 4
5
## The host
6
7
| | |
8
|---|---|
9
| Name | `earth` (`earth.andymccall.xyz`, IPv6 ULA; `192.168.1.6` on the LAN) |
10
| OS | Ubuntu 26.04.1 LTS, x86_64, 4 cores, 31 GiB RAM |
11
| Disk | `/` 251 GB (95 GB free), `/home` 1 TB (944 GB free) |
12
| Already running | sshd :22, a Python service :6400, `wren-nest` :7842, retroplay-manager in Docker (:8080, :6670) with Postgres and a tetriblox server, two GitHub Actions runners (`doomsdayonecom`), Docker, containerd |
13
| Not installed | Rust toolchain, sqlite3 CLI, nginx or caddy, certbot |
14
| Access | `ssh -i ~/.ssh/earth_claude claude@earth`; `claude` has passwordless sudo |
15
16
Ports 7300 (HTTP) and 7343 (HTTPS) are free and are the hub's.
17
18
## Steps
19
20
1. **Toolchain** (as `claude`): `curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal`, then `sudo apt-get install -y build-essential pkg-config git`.
21
2. **Source**: from the development machine, `rsync -a --delete --exclude target --exclude node_modules ~/development/oxygen ~/development/oxygenhub claude@earth:~/src/`. Oxygen is never pushed to Git; rsync is the bootstrap, and after the hub runs, `oxy push` to the hub itself is the ongoing path.
22
3. **Build**: `cd ~/src/oxygenhub && cargo build --release`.
23
4. **System user and data**: `sudo useradd --system --home /home/oxygenhub --create-home oxygenhub`, `sudo install -o oxygenhub -g oxygenhub -m 0755 target/release/oxygenhub /usr/local/bin/`, `sudo -u oxygenhub oxygenhub init --data /home/oxygenhub/data --admin andymccall` (prints the first admin's one-time password).
24
5. **Service**: `/etc/systemd/system/oxygenhub.service` running `oxygenhub serve --data /home/oxygenhub/data` as `oxygenhub`, `Restart=on-failure`, `ProtectSystem=strict`, `ReadWritePaths=/home/oxygenhub/data`, `NoNewPrivileges=yes`; `sudo systemctl enable --now oxygenhub`.
8f3d2ccf Andy McCall ↶ 25
6. **TLS**: the developer edition generates a self-signed certificate at `init`. Download the certificate from `https://earth.andymccall.xyz:7343/.well-known/oxyhub-ca.pem` (or over plain HTTP on port 7300) and point clients at it with `oxy config remote.<name>.ca <file>` or `OXY_CA`.
93be9ce4 Andy McCall 26
7. **First repositories**: on the development machine, `oxy remote add earth https://earth.andymccall.xyz:7343/andymccall/oxygen` in each of `oxygen`, `oxygen-vscode`, `oxygenhub`, then `oxy push earth`.
baebdd18 Andy McCall ↶ 27
8. **Updates**: rsync, build, `sudo install`, `sudo systemctl restart oxygenhub`. `make deploy` in the hub wraps steps 2, 3 and 8.
28
29
## Where things are on Earth
30
31
| | |
32
|---|---|
33
| Binaries | `/usr/local/bin/oxygenhub`, `/usr/local/bin/oxy` |
34
| Sources | `/home/claude/src/oxygen`, `/home/claude/src/oxygenhub` (rsync targets; the hub itself is the canonical remote) |
35
| Data | `/home/oxygenhub/data` (`hub.toml`, `hub.db`, `keys/`, `repos/andymccall/*`) |
36
| Push token | `/home/oxygenhub/push-token` (also in `hub.toml`); each local checkout has it as `remote.earth.token` |
37
| Certificate | `/home/oxygenhub/data/keys/tls.crt`, served at `/.well-known/oxyhub-ca.pem`; local copy `~/.config/oxy/earth-ca.pem` set as `remote.earth.ca` |
38
| Service | `sudo systemctl status oxygenhub`, `sudo journalctl -u oxygenhub` |
9a8e3b44 Andy McCall ↶ 39
40
## HTTPS only (oxygenhub#218)
41
42
When `base_url` is `https://…`, the hub takes nothing over plain http
43
through a proxy: a request that `X-Forwarded-Proto` (or Cloudflare's
44
`CF-Visitor`) reports as http is redirected to the same path on
45
`base_url` (GET and HEAD) or refused with 400 (anything else), and every
46
cookie it sets is `Secure`. Requests made to the hub directly, such as a
47
runner on the same host using `http://127.0.0.1:7300`, carry no such
48
header and are served as before. In front, Cloudflare's Always Use HTTPS
49
is on (2026-10-15). Strict-Transport-Security is not sent yet: it waits
50
for the security headers (#222) and the site owner's decision, because
51
browsers remember it for months.
9a777fec Andy McCall ↶ 52
53
## Outbound requests (oxygenhub#219)
54
55
Webhooks and AI assistants call addresses people give, so the hub only
56
calls **public** addresses: it resolves the host, refuses if any address
57
it resolves to is loopback, private, shared (CGNAT), link-local (the
58
cloud metadata address among them), multicast or an IPv6 local range,
59
pins the connection to the addresses it checked, and follows no
60
redirects. A refused webhook delivery records "not sent: …" with the
61
reason; an assistant says why it cannot be reached. To use a service on
62
your own network on purpose (a local Ollama), a site administrator lists
63
it in `hub.toml`:
64
65
```toml
66
[outbound]
67
allow = ["http://127.0.0.1:11434"]   # scheme://host (any port) or scheme://host:port
68
```