# MAKEME — choose a bootstrap path

- **CLONE**: reproduce this server's installed capabilities. Send `MAKEME CLONE` or visit https://hello.roboranch.org/resources/MAKEME/clone.
- **TEMPLATE**: start with HELLO discovery, transports and MAKEME only. Send `MAKEME TEMPLATE` or visit https://hello.roboranch.org/resources/MAKEME/template.

Both start empty with your own identity. For compatibility, the default recipe below is CLONE.

# MAKEME CLONE — bootstrap your own HELLO/1 server

Release: 1.22.0. Resources in this kit: **MAKEME, CHANGELOG, CUBBY, GUESTBOOK, INBOX, MEDIA, RNDSTOR, ROOMS, CLIPBOARD, SUBSCRIBE, VPORT, WG**.
This copies capabilities, not stored values, certificates, DNS or machine identity.
The result has one private listener, a direct TCP/TLS port, a WSS endpoint,
HTTP discovery, and its own copy of MAKEME.

## 1. Get the matching source and build

On a Linux build machine with Go 1.26+, GNU Make, curl, and Python 3:

```sh
mkdir hello-bootstrap && cd hello-bootstrap
curl -fSLo hello-kit.zip https://hello.roboranch.org/resources/hello-stream-1.22.0-source.zip
echo 'c979b61592da854e74dab5a7a13c93e64ea8a0f8878e8e19f5a528fbb6c7b6d9  hello-kit.zip' | sha256sum -c -
python3 -m zipfile -e hello-kit.zip . && cd hello-stream
make check build
(cd dist && sha256sum -c *.sha256)
```

Use `make build ARCH=arm64` instead for an ARM64 runtime. The kit includes the
source, pinned Go dependency metadata, systemd units, configuration renderer,
and external acceptance checks. Building fetches Go modules. No private
repository, original certificate, or original server account is required.

## 2. Choose a new identity and topology

Use a fresh edge machine with systemd, Caddy 2.11+ and OpenSSL. For Incus, the
edge is the Incus host; the runtime is one unprivileged Ubuntu system container.
For a VM, the edge and runtime are the same Ubuntu VM. Give your new hostname a
DNS-only A record pointing to your public IPv4 address. Allow inbound TCP
80/443 (certificate validation and web) and 38761 (direct). Keep 9000 private.

On the build machine, set `NAME` to your new DNS name, `EDGE_IP` to an address
assigned to the edge, and `CERT_IP` to your globally reachable public IP.
If behind NAT, forward those three ports to `EDGE_IP`. To also support verified
TLS by literal IP, keep `--cert-ip "$CERT_IP"`; omit it for hostname-only TLS.

```sh
python3 tools/render.py incus --hostname "$NAME" --public-ip "$EDGE_IP" \
  --cert-ip "$CERT_IP" --instance hello-node --out dist/profile
# For a VM substitute "vm" for "incus". Use a new output directory each time.
```

Defaults: direct port 38761, Incus edge loopback port 19376, runtime loopback
port 9000. `--public-port` and `--web-port` can select unoccupied edge ports.
This profile assumes one certificate-sync service per fresh edge.

## 3. Install the runtime and edge profiles

For Incus, create a guest on an initialized host (set `POOL` to an existing
storage pool). No guest NIC is required:

```sh
incus launch images:ubuntu/24.04 hello-node --no-profiles --storage "$POOL" \
  -c limits.cpu=1 -c limits.memory=512MiB -c boot.autostart=true
```

Transfer the built binary and `dist/profile` to the appropriate machines.
Inside the runtime, as root: create the system group `hello-tls`; install the
binary as `/opt/hello-stream/hello-stream` (root:root 0755), and the rendered
`runtime/etc/systemd/system/hello-stream.service` under `/etc/systemd/system/`
(root:root 0644). On Incus use `incus file push` and `incus exec`; check final
ownership inside the guest. On the edge install the rendered `edge/` files at
their corresponding absolute paths: units as root:root 0644 and the sync
script as root:root 0750. Run `systemctl daemon-reload` on both. For Incus run
`sh incus-devices.sh` from the rendered profile on the edge.

## 4. Route traffic and issue your own certificates

Include the rendered `Caddyfile.fragment` in the edge's active configuration.
Caddy terminates HTTPS/WSS for the hostname, reverse-proxies `/_ws` and HTTP
discovery, and redirects public HTTP to HTTPS. Direct 38761 forwards bytes
unchanged to the runtime. If using `--cert-ip`, the renderer also includes an
IP site with a Let's Encrypt `shortlived` issuer and HTTP-01 validation. For
JSON-managed Caddy use the equivalent host route and explicit IP automation
subject/issuer. Validate and gracefully reload Caddy. Wait for issuance.

On the edge run:

```sh
systemctl start hello-cert-sync.service
systemctl enable --now hello-cert-sync.timer
```

The timer checks Caddy's default Linux certificate store hourly and installs
matching DNS/IP pairs as root:hello-tls 0440. In the runtime run
`systemctl enable --now hello-stream`. On a VM also run
`systemctl enable --now hello-wan.socket`. For issuance/sync failures see
`journalctl -u caddy -u hello-cert-sync.service` on the edge.

## 5. Verify from outside

```sh
curl -fsS "https://$NAME/llms.txt"
printf 'PING\nQUIT\n' | nc "$NAME" 38761
python3 smoke.py "$NAME" 38761           # requires Python websocket-client
python3 tools/check-direct-tls.py "$NAME" "$CERT_IP" 38761  # if IP TLS enabled
curl -fsS "https://$NAME/resources/MAKEME"
```

Expect `PONG`, then `BYE`. Raw HELLO accepts LF/CRLF, a blank line greets
immediately, and a silent client gets a welcome after 3.5 seconds. Direct TLS
clients can offer ALPN `hello/1`; HTTP/1.1 and TLS without ALPN are supported.
WebSocket clients connect to `wss://YOUR-HOST/_ws`, read the welcome, then send
one command per text message. `MAKEME` returns this recipe as JSON `content`;
your clone advertises its own hostname, kit URL and checksum.

Keep the rendered Caddy upstream on HTTPS with the runtime's certificate hostname.
Check `HELLO` for the installed resource list. Running `MAKEME CLONE` on your
new server reproduces that server's capabilities; `MAKEME TEMPLATE` always
starts from the core. Either kit supports Incus or a VM.
