Repository navigation
Upgrade React on Rails to 17.2.0 with temporary verification #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5b81dc2
Add Control Plane flow to migration example
justin808 9238039
Sync Control Plane flow hardening
justin808 ea290be
Preserve frontend precompile hooks in Dockerfile
justin808 1e769a0
Tighten Docker build action arguments
justin808 e8bc403
docs: clarify review app security
justin808 6783fcf
Merge remote-tracking branch 'origin/main' into add-cpflow-github-flow
justin808 2ceb6b9
Update cpflow deployment flow to v5.3.0
justin808 55270b1
Harden generated deployment defaults
justin808 56c8922
Fix production promotion and rendering
justin808 3cf019b
Document review app secret bootstrap
justin808 87c86aa
Keep Navbar SSR deterministic
justin808 6c3f884
Keep SQLite data separate from migrations
justin808 f4bd700
Address deployment flow review feedback
justin808 037b0f0
Merge remote-tracking branch 'origin/main' into add-cpflow-github-flow
justin808 de57965
Cover migrated routes with SSR regression tests
justin808 0368ee1
Keep preview deployment focused and load hydration bundles
justin808 80503ee
Trim trailing blank lines in deployment configuration
justin808 8a9a5dc
Meet preview volume limits and record the deployed revision
justin808 570364e
Use a stateful SQLite workload and tighten deployment guidance
justin808 2f96b84
Prepare SQLite in the stateful entrypoint instead of a cron runner
justin808 8b5bc03
Keep CI deployment outside secret-policy administration
justin808 0b887a3
Align CI help with maintainer-owned secret bootstrap
justin808 d6e8ea2
Pin Ruby for the deployment runner
justin808 a73baa3
Merge remote-tracking branch 'origin/main' into add-cpflow-github-flow
justin808 b77c2f9
Use temporary verification and upgrade React on Rails to 17.2.0
justin808 0f8ff18
Handle malformed Unicode in the server encoder shim
justin808 2e927f9
Apply server environment overrides before database preparation
justin808 8467bc5
Limit temporary database preparation to direct Rails commands
justin808 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .git | ||
| .github | ||
| .agents | ||
| .bundle | ||
| .env | ||
| .env.* | ||
| config/master.key | ||
| config/credentials/*.key | ||
| db/*.sqlite3 | ||
| log/* | ||
| storage/* | ||
| tmp/* | ||
| node_modules | ||
| vendor/bundle | ||
| app/assets/builds/* | ||
| public/assets | ||
| public/packs | ||
| public/packs-test | ||
| coverage |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.4.6 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| ARG RUBY_VERSION=3.4.6 | ||
|
|
||
| # Node and Ruby base images share the same Debian release so that glibc, libssl, and | ||
| # other system libraries line up between stages. | ||
| FROM docker.io/library/node:22-bookworm-slim AS node | ||
| FROM ruby:$RUBY_VERSION-slim-bookworm | ||
|
|
||
| # Yarn Classic / pnpm fallbacks for projects that haven't adopted corepack via | ||
| # `packageManager` in package.json. Override at build time (`--build-arg=YARN_CLASSIC_VERSION=...`) | ||
| # rather than editing this file so regenerating the Dockerfile keeps your pin. | ||
| ARG YARN_CLASSIC_VERSION=1.22.22 | ||
| ARG PNPM_FALLBACK_VERSION=9.12.3 | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Keep Node.js available both for asset compilation and for SSR runtimes that | ||
| # rely on ExecJS in production. Narrowed to just what the node stage actually | ||
| # ships under /usr/local so we don't drag in unused Debian libs from that image. | ||
| COPY --from=node /usr/local/bin/node /usr/local/bin/node | ||
| COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules | ||
| COPY --from=node /usr/local/include/node /usr/local/include/node | ||
|
|
||
| RUN ln -sf ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ | ||
| ln -sf ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \ | ||
| ln -sf ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \ | ||
| chmod +x /usr/local/lib/node_modules/npm/bin/npm-cli.js \ | ||
| /usr/local/lib/node_modules/npm/bin/npx-cli.js \ | ||
| /usr/local/lib/node_modules/corepack/dist/corepack.js && \ | ||
| node --version && npm --version && corepack --version | ||
|
|
||
| # Expose Corepack-managed shims so later build steps can call yarn/pnpm | ||
| # directly during asset precompilation hooks. | ||
| RUN printf '%s\n' '#!/bin/sh' 'exec corepack yarn "$@"' > /usr/bin/yarn && \ | ||
| chmod +x /usr/bin/yarn && \ | ||
| printf '%s\n' '#!/bin/sh' 'exec corepack pnpm "$@"' > /usr/bin/pnpm && \ | ||
| chmod +x /usr/bin/pnpm | ||
|
|
||
| # install ruby gems | ||
| COPY Gemfile* ./ | ||
|
|
||
| RUN apt-get update -qq && \ | ||
| apt-get install --no-install-recommends -y build-essential && \ | ||
| bundle config set without 'development test' && \ | ||
| bundle config set with 'production' && \ | ||
| bundle install --jobs=3 --retry=3 && \ | ||
| apt-get purge -y --auto-remove build-essential && \ | ||
| rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
|
||
| COPY . ./ | ||
|
|
||
| # Install JavaScript dependencies only when the project actually has them. | ||
| # Pin `packageManager` in package.json to take the corepack path and avoid the | ||
| # YARN_CLASSIC_VERSION / PNPM_FALLBACK_VERSION fallbacks below; the fallbacks exist for | ||
| # projects that haven't adopted corepack and should be reviewed periodically as they go stale. | ||
| RUN if [ -f package.json ]; then \ | ||
| package_manager="$(node -p "require('./package.json').packageManager || ''")"; \ | ||
| if [ -f yarn.lock ]; then \ | ||
| if printf '%s' "$package_manager" | grep -q '^yarn@'; then \ | ||
| corepack prepare "$package_manager" --activate && \ | ||
| (corepack yarn install --immutable || corepack yarn install --frozen-lockfile); \ | ||
| else \ | ||
| npm install -g "yarn@${YARN_CLASSIC_VERSION}" && \ | ||
| (yarn install --immutable || yarn install --frozen-lockfile); \ | ||
| fi; \ | ||
| elif [ -f pnpm-lock.yaml ]; then \ | ||
| if printf '%s' "$package_manager" | grep -q '^pnpm@'; then \ | ||
| corepack prepare "$package_manager" --activate && \ | ||
| corepack pnpm install --frozen-lockfile; \ | ||
| else \ | ||
| corepack prepare "pnpm@${PNPM_FALLBACK_VERSION}" --activate && \ | ||
| corepack pnpm install --frozen-lockfile; \ | ||
| fi; \ | ||
| elif [ -f package-lock.json ]; then \ | ||
| npm ci; \ | ||
| else \ | ||
| npm install; \ | ||
| fi; \ | ||
| fi | ||
|
|
||
| ENV RAILS_ENV=production | ||
| ENV RAILS_SERVE_STATIC_FILES=true | ||
|
|
||
| # Compiling assets requires any non-blank value, but the placeholder must not | ||
| # remain in the final image environment. | ||
| RUN SECRET_KEY_BASE=NOT_USED_NON_BLANK bin/shakapacker-precompile-hook | ||
|
|
||
|
|
||
| RUN SECRET_KEY_BASE=NOT_USED_NON_BLANK rails assets:precompile | ||
|
|
||
| # add entrypoint | ||
| COPY bin/docker-entrypoint /app/entrypoint.sh | ||
| RUN chmod +x /app/entrypoint.sh | ||
| ARG GIT_COMMIT=unknown | ||
| ENV GIT_COMMIT=$GIT_COMMIT | ||
| ENTRYPOINT ["/app/entrypoint.sh"] | ||
|
|
||
| CMD ["rails", "s"] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import Navbar from '../../components/Navbar'; | ||
|
|
||
| export default Navbar; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import Navbar from './Navbar.client'; | ||
|
|
||
| export default Navbar; |
3 changes: 3 additions & 0 deletions
3
app/javascript/src/PostsIndex/ror_components/PostsIndex.client.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import PostsIndex from '../../pages/PostsIndex'; | ||
|
|
||
| export default PostsIndex; |
3 changes: 3 additions & 0 deletions
3
app/javascript/src/PostsIndex/ror_components/PostsIndex.server.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import PostsIndex from './PostsIndex.client'; | ||
|
|
||
| export default PostsIndex; |
3 changes: 3 additions & 0 deletions
3
app/javascript/src/PostsShow/ror_components/PostsShow.client.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import PostsShow from '../../pages/PostsShow'; | ||
|
|
||
| export default PostsShow; |
3 changes: 3 additions & 0 deletions
3
app/javascript/src/PostsShow/ror_components/PostsShow.server.jsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import PostsShow from './PostsShow.client'; | ||
|
|
||
| export default PostsShow; |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <%= | ||
| react_component("PostsIndex", { posts: @posts }, prerender: true) | ||
| react_component("PostsIndex", props: { posts: @posts }, prerender: true) | ||
| %> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <%= | ||
| react_component("PostsShow", {post: @post}, prerender: true) | ||
| react_component("PostsShow", props: { post: @post }, prerender: true) | ||
| %> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # Only direct Rails server commands prepare the temporary database automatically. | ||
| # Pass runtime overrides with docker run --env; wrapped commands prepare explicitly. | ||
| case "${1:-}:${2:-}" in | ||
| rails:s|rails:server|bin/rails:s|bin/rails:server|./bin/rails:s|./bin/rails:server) | ||
| echo " -- Preparing database" | ||
| ./bin/rails db:prepare | ||
| ;; | ||
| esac | ||
|
|
||
| exec "$@" |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.