Repository navigation
feat(compose): run the public gateway under a gateway profile, behind your own TLS proxy - #190
Merged
Merged
Conversation
… your own TLS proxy
- compose.yaml: decdn-gateway, the node image's decdn CLI (DECDN_IMAGE_DIGEST, so
no fourth decdn digest) with the role's command: both listeners on loopback, the
wallet named, SIGINT stop, as the decdn-gateway account. gateway.toml reads
rpc_url as ${DECDN_GATEWAY_RPC_URL} (the CLI expands it), the URL itself in the
root-only gateway.env. No nginx: stock nginx cannot bind 80/443 as non-root on
the host network, and root_allowed is not extended for it, so TLS and the
PUT /_pointer limit are the operator's proxy's (README documents both, pointing
at the role's site and lego unit).
- decdn-compose: the gateway profile (init gateway --gateway-domain: account,
directories, password, the gateway's own wallet via key-gen without the node's
mounts, gateway.toml from the decdn_gateway mirror, the env template), its
problems, ports, health (GET / and /metrics on loopback) and backup (wallet,
config, env file, pointers). Unit tests.
- compose/tests/*.jq: the service's keys, mounts, SIGINT, exact command, inline
env and fail-closed domain; lint-compose renders its env template; negative
variants in test-scripts.
- Alloy's Compose render scrapes it under the gateway profile; compose/alloy/
config.alloy regenerated.
Closes #176
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The script generates a new password when an existing keystore’s password file is missing, allowing preflight to pass and the gateway to start with a wallet it cannot unlock.
1 open issue
What changed in this PR
Adds a Compose deployment path for the public gateway, complementing the existing Ansible role and monitoring support. The gateway runs on loopback behind an operator-managed TLS proxy.
Changes:
- Adds the
gatewayprofile and wrapper support for initialization, validation, health checks, and backups. - Connects gateway metrics and logs to Alloy.
- Extends security checks, regression tests, and operator documentation.
| File | Description |
|---|---|
tests/scripts-test.sh |
Adds negative tests for gateway security invariants. |
Makefile |
Includes the gateway environment template in Compose linting. |
docs/requirements.md |
Documents Compose gateway networking requirements. |
docs/publishers.md |
Lists the gateway Compose deployment option. |
compose/tests/test_decdn_compose.py |
Tests gateway initialization, validation, backups, and scrape selection. |
compose/tests/invariants.jq |
Enforces gateway commands, mounts, identity, and shutdown settings. |
compose/tests/inline-env.jq |
Restricts inline gateway environment variables. |
compose/tests/fail-closed.jq |
Checks that an unset gateway domain produces an invalid URL. |
compose/README.md |
Documents gateway setup, proxy requirements, and operations. |
compose/decdn-gateway.env.example |
Adds the RPC URL and logging environment template. |
compose/decdn-compose |
Implements gateway lifecycle support. |
compose/compose.yaml |
Defines the hardened, loopback-only gateway service. |
compose/alloy/config.alloy |
Adds gateway metric scraping and log processing. |
compose/.env.example |
Adds gateway account, domain, allowance, and environment settings. |
ansible/tests/alloy-config/validate.sh |
Validates gateway scrape gating and container mapping. |
ansible/tests/alloy-config/render.yml |
Enables gateway support in the Compose Alloy render. |
AGENTS.md |
Documents the new profile and deployment constraints. |
Review effort: Balanced
init gateway generated a new password beside a restored keystore whose own was missing, so check passed and the gateway could not unlock its wallet (Copilot review on #190). It now refuses that state and asks for the original password. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Third of three PRs for #176, after #187 and #188. It adds a Compose
gatewayprofile that runs the public gateway behind the operator's own TLS proxy.Why there is no nginx on Compose:
bind() … (13: Permission denied)even withcap_add: NET_BIND_SERVICE, because the binary carries no file capability. Caddy's does, which is why Caddy works.root_allowedstays the iroh services only, as AGENTS.md requires.compose.yaml:
decdn-gatewaydecdnCLI onDECDN_IMAGE_DIGEST, so there is no fourth decdn digest to bump.127.0.0.1:8484, metrics on127.0.0.1:9094;stop_signal: SIGINT;decdn-gatewayaccount.gateway.tomlholds the chain addresses andrpc_url = "${DECDN_GATEWAY_RPC_URL}"; the CLI expands it at start. The URL itself lives in the root-only/etc/decdn-gateway/gateway.env, like the node'sdecdn.env.--public-urlthe gateway refuses.decdn-compose
init gateway --gateway-domaincreates:key-genfrom the node image without the node's mounts;gateway.tomlfrom thedecdn_gatewaymirror;checkcovers the wallet and password (private, the account's), the env file (root-only),DECDN_GATEWAY_RPC_URL, the domain (not the example) and the image digest.8484and9094go in the preflight.healthasks loopback/and/metrics.backuptakes the wallet, password, config, env file and namespace pointers.Lints
compose/tests/*.jqgain the service's keys, mounts, SIGINT, exact command, inline env and the fail-closed domain.lint-composerenders the env template.test-scripts.Alloy
gatewayprofile, and maps its container todecdn-gateway.service.compose/alloy/config.alloyis regenerated.validate.shgains anode,gateway,alloyruntime case.Docs:
compose/README.md(a section, the profile table, accounts, secrets),.env.example, AGENTS.md,docs/publishers.md,docs/requirements.md.Test plan
docker:27-dind:decdn-compose init gateway --gateway-domain gw.decdn.testgenerated a real wallet with the v0.3.0 node image'skey-gen, and wrotegateway.tomland the env file.uppassed its preflight and started the gateway.healthreportedokfor/and/metrics, and the gateway answered 200 for the bare host.stopexited 0 on SIGINT, andbackuparchived the wallet, password, config and env file.make lint-compose,make lint-alloy(seven Compose runtime cases, includingnode,gateway,alloy),make test-scripts,make lint, and thedecdn-composeunit tests (153)Closes #176
🤖 Generated with Claude Code