Add Docker deployment guide for Kamal, Kubernetes, and Control Plane#2837
Add Docker deployment guide for Kamal, Kubernetes, and Control Plane#2837
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughRestructured deployment docs: README now links to Docker and Heroku guides and troubleshooting; added a new Docker deployment guide; removed legacy Capistrano and Elastic Beanstalk pages; added a link-checker exclusion; updated two NEWS.md doc URLs. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds a comprehensive Docker deployment guide ( Key findings:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[docker build] --> B[Base stage\nruby:slim, ENV vars]
B --> C[Build stage]
C --> D[Install build deps\napt-get: build-essential, node-gyp]
D --> E[Install Node.js via nodesource\n+ corepack enable]
E --> F[bundle install\nRuby gems]
F --> G[yarn install --frozen-lockfile\nJS dependencies]
G --> H[COPY . .\nFull application]
H --> I[assets:precompile\nBuilds client + server bundles]
I --> |public/webpack/production/\nssr-generated/| J[Runtime stage\nFROM base — no Node]
J --> K[apt-get: curl libpq5 only]
K --> L[COPY gems from build\n/usr/local/bundle]
L --> M[COPY app from build\n/rails — includes node_modules⚠️]
M --> N[Create non-root user\nrails:1000]
N --> O[ENTRYPOINT + CMD\npuma -C config/puma.rb]
style I fill:#90EE90
style M fill:#FFD700
Reviews (1): Last reviewed commit: "Add Docker deployment guide for Kamal, K..." | Re-trigger Greptile |
|
Review: Docker Deployment Guide - solid addition overall. Six issues flagged via inline comments: (1) COPY --from=build /rails /rails inflates runtime image with full source tree - line 72; (2) --frozen-lockfile is Yarn v1, Yarn Berry uses --immutable - line 52; (3) pnpm@latest is non-deterministic, pin the version - line 99; (4) misleading K8s Secrets tip since the manifest already uses secretKeyRef correctly - line 263; (5) :latest tag is an anti-pattern in K8s manifests - lines 186 and 383; (6) curl-pipe-bash nodesource install lacks a supply-chain security note - line 40. Minor: missing namespace in K8s manifest, docker-entrypoint requires Rails 7.1+, ssr-generated/ path is Pro-specific. |
|
Review summary Good addition - Docker deployment docs are genuinely missing from the project. A few issues to fix before merging. Blocking
Non-blocking
|
|
Good documentation addition overall — the multi-stage Dockerfile, Kamal/K8s/Control Plane examples, and Node Renderer sidecar patterns are all useful. A few issues worth addressing: Critical
Notable
Minor
|
|
Review: Docker Deployment Guide Overall this is a solid, well-organized addition with good security practices (non-root user, secrets via secretKeyRef). A few issues worth addressing: Issue 1 - curl-pipe-bash in the Dockerfile (security): The Node.js install step uses curl piped to bash, which executes remotely fetched code directly and is a well-known supply-chain risk. Consider explicit APT pinning or switching to a Node base image for the build stage. At minimum, add a note acknowledging the trade-off. Issue 2 - livenessProbe.initialDelaySeconds 15 is too short for Rails: Puma with Rails + React on Rails commonly takes 30-60 s to start on a cold deploy. A liveness probe firing at 15 s will restart the pod before it is ready, creating a crash loop. Recommend at least 60 s, or suggest startupProbe (Kubernetes 1.18+). Issue 3 - Memory limit of 512 Mi is borderline for SSR workloads: limits.memory 512Mi will cause OOM kills for many real-world apps doing server-side rendering. The guide should note this is a minimal starting point and suggest 1-2 Gi for SSR-enabled apps. Issue 4 - ssr-generated/ path is React on Rails Pro-specific: The Key points section says server bundles land in ssr-generated/. This is specific to the Pro Node Renderer, not the default ExecJS/mini_racer path. OSS users will be confused. Should be qualified with (React on Rails Pro only) or replaced with the OSS-accurate output path. Issue 5 - Missing .dockerignore guidance: The COPY . . step will silently include .git/, node_modules/, log/, tmp/, and local .env files without a .dockerignore. Worth a brief note since this affects build performance and potential secrets exposure. Minor nits: The Kamal config/deploy.yml uses 192.168.0.1 as a placeholder server IP (a private RFC1918 address). 203.0.113.1 (TEST-NET-3, reserved for documentation) would be clearer. Archived-guide commit SHAs in README are partial (9 chars); full 40-char SHAs are more stable for long-term permalink links. The issues above are all actionable and worth fixing before merge. |
Review: Docker Deployment GuideOverall this is a well-structured, thorough guide that fills a real gap in the docs. The multi-stage Dockerfile design is correct (Node only at build time, lean runtime image, non-root user, A few things worth addressing before merge: Correctness / usability
Reproducibility
Minor nits (no blocking issues)
|
Covers multi-stage Dockerfile setup for React on Rails, environment variables, platform-specific configuration for all three deployment targets, Node Renderer sidecar patterns, CDN/static asset strategies, and common troubleshooting scenarios. Also updates the deployment README with a structured index of all deployment and troubleshooting guides. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Both guides referenced very old tooling (Node 6, public/packs, etc.) and are no longer relevant. Links to the last versions are preserved in the deployment README for anyone who still needs them. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Fix cpflow commands: use build-image (build+push) then deploy-image (deploy), not deploy-image then deploy - Fix env var: REACT_ON_RAILS_PRO_NODE_RENDERER_URL -> REACT_RENDERER_URL (matching the canonical Pro template) - Reword K8s Secrets tip to not contradict the manifest which already uses secretKeyRef correctly Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add `RUN rm -rf node_modules` after assets:precompile in the build stage so the broad `COPY --from=build /rails /rails` does not carry JS dependencies into the runtime image unnecessarily. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Fix node-renderer sidecar to use separate Node-enabled image - Add initializer note for REACT_RENDERER_URL env var - Complete initContainers env block with secretKeyRef entries - Add missing Shakapacker/Webpacker troubleshooting links to README Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Wrap config.renderer_url in ReactOnRailsPro.configure block to prevent NoMethodError at boot - Add .dockerignore bullet to Key Points section to prevent host node_modules from overwriting Docker-installed modules Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ion warning - Pin pnpm to major version instead of @latest for reproducible builds - Add Yarn Berry --immutable note alongside --frozen-lockfile - Add language tag to .dockerignore fenced code block (MD040) - Increase livenessProbe initialDelaySeconds to 60s for SSR apps - Add warning about initContainer migrations with replicas > 1 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The Control Plane template omitted initialDelaySeconds and periodSeconds, unlike the Kubernetes example. Without these, the liveness probe fires at t=0 before Rails boots, causing a crash loop. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…re, default to Yarn Berry - Remove curl from runtime stage (only needed in build stage for nodesource) - Expand .dockerignore example with spec, test, .github entries - Default yarn install flag to --immutable (Yarn Berry) since corepack activates the version from packageManager in package.json Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
90e62c6 to
8d2361d
Compare
Review: Docker Deployment GuideOverall this is a well-structured, comprehensive doc addition. The multi-stage Dockerfile, deployment patterns (Kamal/K8s/Control Plane), and troubleshooting sections are solid. A few accuracy and security issues worth addressing: 1. NodeSource curl-pipe-bash installer (security) The build stage installs Node by piping a remote script directly into bash. This is a supply-chain risk. For production Dockerfiles, consider using the official node Docker base image in a separate stage, or verify the script checksum. At minimum, add a note acknowledging this trade-off. 2. Kamal arch: amd64 hardcodes x86_64 The Kamal config example includes 3. Asset path public/webpack/production/ is bundler-specific The Troubleshooting section references 4. ssr-generated/ description could be clearer The guide says server bundles land in Minor: The pnpm section pins |
…g wording - Remove leftover Shakapacker sentence from deployment README that no longer fits the new index format - Reword SSR troubleshooting to acknowledge the multi-stage design and recommend mini_racer or the Pro Node Renderer sidecar instead of vaguely suggesting adding Node to the runtime stage Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Review: Docker Deployment GuideGood addition overall. Well-structured, covers the key deployment targets (Kamal, Kubernetes, Control Plane), and the React on Rails-specific callouts (SSR bundle path, Node Renderer sidecar, SECRET_KEY_BASE_DUMMY) are accurate against the codebase. I left five inline comments with specific fixable issues. 1. Missing mkdir -p before chown (line 80) — log/, tmp/, storage/ are gitignored and typically absent from the image after the multi-stage copy. The chown command will fail. Rails 7.1's own default Dockerfile uses mkdir -p first. 2. COPY . . silently overwrites node_modules (line 55) — without a .dockerignore excluding node_modules, the host's native modules overwrite the container-built ones, causing hard-to-diagnose runtime crashes. This is covered in Key Points, but a comment inline in the Dockerfile would catch it before someone skips ahead. 3. Wrong node-renderer.js path (line 413) — the generator places the file at client/node-renderer.js (per pro_setup.rb); the command as written will error unless the container working directory happens to be client/. 4. pnpm@9 hardcoded (line 113) — silently ignores the packageManager version in package.json; projects on pnpm v8 or v10 get the wrong version installed. 5. :latest tag in Kubernetes manifest (line 222) — using :latest in production prevents reliable rollbacks and makes it impossible to audit exactly what is deployed. Recommend a versioned tag placeholder. Minor (not blocking): The archived git links in README.md use 9-char abbreviated commit hashes — full 40-char SHAs are more future-proof. The Kamal example sets memory: 512m on the web container, which is tight for a Rails + SSR app; a note about typical runtime memory needs would help users avoid OOM kills in production. |
…e-repo * origin/main: Improve create-react-on-rails-app fresh app onboarding (#2849) Add Docker deployment guide for Kamal, Kubernetes, and Control Plane (#2837) Reframe RSC migration docs around React on Rails patterns (#2661) Enforce secure renderer password defaults for production-like envs (#2829)
Add docker-deployment doc and remove deleted capistrano-deployment and elastic-beanstalk entries (archived in PR #2837). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary
docs/oss/deployment/docker-deployment.mdcovering:config/deploy.ymlexamplescpflowand workload templatesdocs/oss/deployment/README.mdwith a structured index linking all deployment and troubleshooting guidesTest plan
🤖 Generated with Claude Code
Note
Low Risk
Low risk documentation-only changes plus a small link-checker exclude regex tweak; no runtime code paths are affected.
Overview
Adds a new Docker deployment guide covering a production multi-stage
Dockerfile, and container-oriented deployment examples for Kamal, Kubernetes, and Control Plane (including SSR/Node Renderer sidecar notes and troubleshooting).Reorganizes
docs/oss/deployment/README.mdinto a structured index, removes the legacy Capistrano and Elastic Beanstalk pages (linking to git history instead), and updates.lychee.tomlto broaden thehvmn.comexclude pattern to match bothhttp/httpsand optionalwww.Written by Cursor Bugbot for commit f8c1ab8. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
Documentation
Chore