Commit 9fedd96
docs(pro): document CI pattern for renderer-backed Rails tests (#3612)
## Summary
Documents the CI pattern for running Rails tests that depend on a live
React on Rails Pro Node Renderer, closing #3603.
Apps that prerender React components or generate RSC payloads through
the Node Renderer have Rails integration tests that need a running
renderer. The failure mode is confusing: Rails reports a generic
*server-rendering error*, but the real cause is that the renderer was
unavailable (or reached on the wrong host) when Rails connected to
`REACT_RENDERER_URL`. The safe GitHub Actions shape is easy to get
subtly wrong.
## Changes
**`docs/pro/node-renderer.md`** — new section **"Running Rails Tests
Against the Node Renderer in CI"**:
- Copy-pastable GitHub Actions snippet that starts the renderer, waits
for its port, runs the Rails tests, and cleans up — all in **one step**
(so the renderer stays alive for the whole test process).
- `trap cleanup EXIT` to kill the renderer on pass/fail/timeout.
- `TCPSocket` readiness polling instead of a fixed `sleep`.
- Prints `/tmp/node-renderer.log` when readiness fails, so the real
startup error is diagnosable.
- A "Use `127.0.0.1`, not `localhost`" subsection explaining the
IPv4/IPv6 resolution ambiguity (`RENDERER_HOST` defaults to
`localhost`).
- A note that `test` env needs no renderer password, and what to do for
production-like `RAILS_ENV`.
**`docs/pro/troubleshooting.md`** — "Connection refused to renderer" now
notes that a generic server-rendering error in tests is often a renderer
connection failure (not a webpack/bundle issue), flags the
localhost-vs-127.0.0.1 gotcha, and cross-links the new CI section.
## Acceptance criteria (from #3603)
- [x] Docs include a copy-pastable GitHub Actions snippet
- [x] Snippet keeps the renderer alive for the Rails test process
(single-step lifetime + EXIT trap)
- [x] Snippet avoids `localhost` vs `127.0.0.1` ambiguity (both sides +
readiness probe use `127.0.0.1`)
- [x] Troubleshooting section notes "server rendering error" can be a
renderer connection failure, not only webpack/bundle config
## Verification
- Env var names (`RENDERER_HOST`, `RENDERER_PORT`,
`RENDERER_WORKERS_COUNT`, `RENDERER_PASSWORD`) and the `localhost`
default verified against
`packages/react-on-rails-pro-node-renderer/src/shared/configBuilder.ts`.
- Snippet mirrors the pattern verified in the demo PR linked from the
issue (shakacode/react_on_rails-demo-octochangelog-on-rails-pro#14).
- Pre-commit `markdown-links`, `prettier`, and `trailing-newlines` hooks
pass; all internal cross-link anchors resolve.
Docs-only — no CHANGELOG entry per the project's changelog guidelines.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation-only changes with no runtime, security, or data-handling
impact.
>
> **Overview**
> Adds Pro documentation for running **Rails integration tests that need
a live Node Renderer in CI**, aimed at the confusing failure where tests
report a generic server-rendering error when the real issue is renderer
connectivity.
>
> **`node-renderer.md`** introduces a copy-pastable **GitHub Actions**
step that starts the renderer in the background, polls **`127.0.0.1`**
with a **`TCPSocket`** readiness check (with early exit if the process
dies), runs **`bin/rails test`** / **`bundle exec rspec`**, and tears
down via **`trap cleanup EXIT`**, plus notes on single-step lifetime,
logs on failure, and aligning **`REACT_RENDERER_URL`** /
**`RENDERER_HOST`**.
>
> **`troubleshooting.md`** expands **Connection refused to renderer** to
call out that symptom in tests, prefers **`127.0.0.1`** over
**`localhost`** (IPv4/IPv6 mismatch with default **`RENDERER_HOST`**),
and links to the new CI section.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
eba5b88. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Added a Pro CI guide for running Rails tests with a live Node
renderer: shows how to start the renderer within the same CI step, wait
for readiness, capture logs, perform cleanup on exit, and surface
failure diagnostics.
* Expanded troubleshooting for renderer connection failures with clearer
symptoms, configuration checks (prefer 127.0.0.1 over localhost),
guidance to keep the renderer alive for test duration, and notes on
expected renderer entrypoint and when a password is required.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 634a326 commit 9fedd96
2 files changed
Lines changed: 82 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
211 | 289 | | |
212 | 290 | | |
213 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
0 commit comments