Turn on the runner's cache server, for actions/cache #4

Merged
matchu merged 1 commit from armin-bot/openneo-code:claude/runner-cache into main 2026-11-08 20:19:40 -08:00
Contributor

On its first real run, CI's Install gems step took about 5 minutes on this machine's single vCPU, and Forgejo was sluggish (5–10 second page loads) while it ran. 21 of impress's gems compile native extensions on install; sassc alone builds all of libsass. vendor/cache saves downloading the gems, but not compiling them.

This turns on the runner's cache server, so impress's workflow can cache installed gems and node_modules with actions/cache. Gems only compile again when Gemfile.lock changes.

Changes

  • Runner config: cache.enabled: true, with the cache proxy on a fixed port (4000) instead of a random one.
  • ufw: job containers reach the proxy at this host's IP, which goes through ufw's incoming rules. Those deny everything except SSH, HTTP and HTTPS. So this allows port 4000 from Docker's container networks only (172.16.0.0/12); the rest of the internet still can't reach it. (I left out 192.168.0.0/16, Docker's other default range, because it overlaps Linode's private network.)

Security

The runner isolates cache writes from pull requests (getWriteIsolationKey in internal/app/run/runner.go):

  • A PR's run can read the shared cache, but its writes are only visible to later runs of that same PR.
  • Only pushes and merged PRs write the shared cache, so a fork PR can't poison what main restores.

Rollout

ansible-playbook setup-actions.yml

That restarts the runner with the new config. The impress side (caching steps in test.yml) is ready to push to OpenNeo/impress#16 once this is live.

Testing

ansible-playbook --syntax-check passes, using the full ansible package so community.general.ufw resolves. Not yet run against the box.

🤖 Generated with Claude Code

https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ

On its first real run, CI's **Install gems** step took about 5 minutes on this machine's single vCPU, and Forgejo was sluggish (5–10 second page loads) while it ran. 21 of impress's gems compile native extensions on install; `sassc` alone builds all of libsass. `vendor/cache` saves downloading the gems, but not compiling them. This turns on the runner's cache server, so impress's workflow can cache installed gems and `node_modules` with `actions/cache`. Gems only compile again when `Gemfile.lock` changes. ## Changes - **Runner config:** `cache.enabled: true`, with the cache proxy on a fixed port (4000) instead of a random one. - **ufw:** job containers reach the proxy at this host's IP, which goes through ufw's incoming rules. Those deny everything except SSH, HTTP and HTTPS. So this allows port 4000 **from Docker's container networks only** (`172.16.0.0/12`); the rest of the internet still can't reach it. (I left out `192.168.0.0/16`, Docker's other default range, because it overlaps Linode's private network.) ## Security The runner isolates cache writes from pull requests (`getWriteIsolationKey` in `internal/app/run/runner.go`): - A PR's run can read the shared cache, but its writes are only visible to later runs of that same PR. - Only pushes and merged PRs write the shared cache, so a fork PR can't poison what `main` restores. ## Rollout ```bash ansible-playbook setup-actions.yml ``` That restarts the runner with the new config. The impress side (caching steps in `test.yml`) is ready to push to OpenNeo/impress#16 once this is live. ## Testing `ansible-playbook --syntax-check` passes, using the full `ansible` package so `community.general.ufw` resolves. Not yet run against the box. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ
CI compiles 21 native gems on every run (sassc alone builds all of
libsass), which takes about 5 minutes on this machine's single vCPU and
slows Forgejo down while it runs. Caching the installed gems between
runs avoids that.

- Enable the runner's cache, with its proxy on a fixed port (4000).
- Job containers reach the proxy at this host's IP, which goes through
  ufw's incoming rules, so allow that port from Docker's container
  networks (172.16.0.0/12) only.

The runner isolates PR cache writes: a PR's run can read the shared
cache, but what it writes is only visible to that PR's later runs. Only
pushes and merged PRs write the shared cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ
matchu merged commit dd8a279dc1 into main 2026-11-08 20:19:40 -08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
OpenNeo/openneo-code!4
No description provided.