Skip to content

Add Control Plane GitHub flow#35

Open
justin808 wants to merge 6 commits intomainfrom
add-cpflow-github-flow
Open

Add Control Plane GitHub flow#35
justin808 wants to merge 6 commits intomainfrom
add-cpflow-github-flow

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 15, 2026

Summary

  • add the shared cpflow review app, staging deploy, and promote workflows to this demo repo
  • make the root Dockerfile production-ready for SSR by compiling React on Rails bundles and keeping Node available for ExecJS at runtime
  • tailor the Control Plane config and docs for the repo's SQLite-backed storage layout

Testing

  • docker build -t ror-v16-cpflow-portcheck .
  • docker run -d --name ror-v16-portcheck -p 38080:80 -e SECRET_KEY_BASE=test123 ror-v16-cpflow-portcheck
  • curl -I http://127.0.0.1:38080/up
  • curl -D - http://127.0.0.1:38080/
  • ruby /Users/justin/codex/control-plane-flow/cpflow config -a react-on-rails-demo-v16-ssr-staging
  • ruby -e 'Dir[".github/actions//.yml", ".github/workflows/.yml", ".controlplane//*.yml"].each { |path| YAML.load_file(path, aliases: true) }' -r yaml
  • git diff --check

Note

Medium Risk
Adds new deployment automation and changes the production Docker build/runtime (Node/SSR bundle generation), which can impact deploy reliability and runtime behavior if misconfigured.

Overview
Adds Control Plane (cpflow) scaffolding and GitHub Actions to support opt-in review apps, automatic staging deploys, scheduled cleanup of stale review apps, and manual promotion from staging to production (including basic health-check/rollback logic).

Updates the production Dockerfile to install Node in build+runtime, run a new bin/build-production step to regenerate and compile React on Rails client+SSR bundles before assets:precompile, and keep Node available for ExecJS SSR at runtime.

Tightens supporting tooling/config: adds Control Plane templates (GVC, workload, persistent /rails/storage volume, db:prepare release script), updates CI to build JS packs during tests, bumps brakeman, pins react-on-rails in npm, and refreshes README/docs for the new flow.

Reviewed by Cursor Bugbot for commit 288dd05. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread bin/build-production

export RAILS_ENV="${RAILS_ENV:-production}"
export NODE_ENV="${NODE_ENV:-production}"
export SECRET_KEY_BASE="${SECRET_KEY_BASE:-${SECRET_KEY_BASE_DUMMY:-test-secret-key-base}}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SECRET_KEY_BASE fallback uses boolean flag as secret value

Low Severity

The nested parameter expansion ${SECRET_KEY_BASE:-${SECRET_KEY_BASE_DUMMY:-test-secret-key-base}} conflates the SECRET_KEY_BASE_DUMMY boolean flag with an actual secret key value. When the Dockerfile invokes SECRET_KEY_BASE_DUMMY=1 ./bin/build-production, this line sets SECRET_KEY_BASE to the literal string "1" — the flag's value, not a proper key. While Rails' SECRET_KEY_BASE_DUMMY mechanism generates a real dummy key internally (so the build succeeds), exporting SECRET_KEY_BASE=1 into the environment is semantically incorrect and could cause subtle issues if any code reads ENV["SECRET_KEY_BASE"] directly rather than going through Rails.application.secret_key_base.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc397aa. Configure here.

Comment thread .github/workflows/cpflow-deploy-staging.yml
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 3 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 3 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c74559b4-9aec-46cb-aea6-610caeeb60a9

📥 Commits

Reviewing files that changed from the base of the PR and between 623c9f5 and 288dd05.

⛔ Files ignored due to path filters (2)
  • Gemfile.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (24)
  • .controlplane/controlplane.yml
  • .controlplane/readme.md
  • .controlplane/release_script.sh
  • .controlplane/templates/app.yml
  • .controlplane/templates/rails.yml
  • .controlplane/templates/storage.yml
  • .github/actions/cpflow-build-docker-image/action.yml
  • .github/actions/cpflow-delete-control-plane-app/action.yml
  • .github/actions/cpflow-delete-control-plane-app/delete-app.sh
  • .github/actions/cpflow-setup-environment/action.yml
  • .github/workflows/ci.yml
  • .github/workflows/cpflow-cleanup-stale-review-apps.yml
  • .github/workflows/cpflow-delete-review-app.yml
  • .github/workflows/cpflow-deploy-review-app.yml
  • .github/workflows/cpflow-deploy-staging.yml
  • .github/workflows/cpflow-help-command.yml
  • .github/workflows/cpflow-promote-staging-to-production.yml
  • .github/workflows/cpflow-review-app-help.yml
  • .ruby-version
  • Dockerfile
  • README.md
  • bin/build-production
  • db/schema.rb
  • package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-cpflow-github-flow

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/cpflow-delete-review-app.yml
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because on-demand usage is turned off. To enable Bugbot Autofix, turn on on-demand usage and set a spend limit in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0910a27. Configure here.

ruby -e 'require "yaml"; app = ARGV.fetch(0); data = YAML.load_file(".controlplane/controlplane.yml", aliases: true); app_config = data.fetch("apps").fetch(app); workloads = Array(app_config["app_workloads"]); workloads = ["rails"] if workloads.empty?; puts workloads.join(",")' "${{ vars.PRODUCTION_APP_NAME }}"
)"

echo "names=${workloads}" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workload resolution uses Ruby before setup-ruby runs

Medium Severity

The Resolve production app workloads step calls ruby -e with YAML.load_file(..., aliases: true) before the Setup production environment step runs ruby/setup-ruby. This relies on the system Ruby pre-installed on the GitHub runner. The aliases: keyword argument requires Psych 4+ (Ruby 3.1+). While current ubuntu-latest (24.04) ships Ruby 3.2+, this creates a fragile implicit dependency on the runner's system Ruby version and feature set, separate from the explicitly declared Ruby 3.4.6 in the setup action.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0910a27. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant