Skip to content

feat: implement ssr#66

Merged
LambdaDigamma merged 5 commits into
masterfrom
feature/ssr
Mar 22, 2026
Merged

feat: implement ssr#66
LambdaDigamma merged 5 commits into
masterfrom
feature/ssr

Conversation

@LambdaDigamma

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 22, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces Inertia SSR support and adds infrastructure needed to run an SSR rendering service alongside the Laravel app.

Changes:

  • Add an Inertia SSR entry (resources/js/ssr.tsx) and wire it into deployment via a dedicated SSR Docker image/service.
  • Add an SEO canonical link tag to the main Blade app shell.
  • Update deployment/compose configs and lockfiles to support the SSR runtime and dependency updates.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
resources/views/app.blade.php Adds canonical link tag for SEO.
resources/js/ssr.tsx Implements Inertia SSR server entry and wraps the app in TooltipProvider.
public/build/manifest.json Updates Vite build manifest (large generated diff).
package-lock.json Dependency updates (incl. Inertia beta bump and transitive updates).
docker-compose.yml Adds base ssr service definition.
docker-compose.dev.yml Adds ssr service for development.
docker-compose.prod.yml Adds ssr service for production swarm deployment.
Dockerfile.ssr Adds a dedicated multi-stage SSR Docker image build.
Dockerfile.ssr.dockerignore Adds ignore rules intended for SSR builds.
Dockerfile.node Fixes indentation for the ci stage line.
.github/workflows/action_deploy-production.yml Adds SSR image build job and passes SSR image tag into deploy.
.env.example Adds SSR env vars (URL + bundle existence check flag).
Comments suppressed due to low confidence (1)

docker-compose.dev.yml:78

  • In docker-compose.dev.yml, the Traefik labels for the Vite dev server (traefik.http.routers.vite.* / port 5173) are attached to the new ssr service. Since ssr runs node bootstrap/ssr/ssr.js and does not expose 5173, this will break routing to the Vite dev server. Move these labels back to the node service (or remove them from ssr).
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vite.rule=HostRegexp(`vite.dev.test`)"
      - "traefik.http.routers.vite.entrypoints=websecure"
      - "traefik.http.routers.vite.tls=true"
      - "traefik.http.services.vite.loadbalancer.server.port=5173"
      - "traefik.http.services.vite.loadbalancer.server.scheme=https"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/build/manifest.json Outdated
Comment on lines 1 to 5
{
"_app-layout-DV6zawK2.js": {
"file": "assets/app-layout-DV6zawK2.js",
"_app-layout-Dm23TAYF.js": {
"file": "assets/app-layout-Dm23TAYF.js",
"name": "app-layout",
"imports": [

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

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

This PR updates public/build/manifest.json, but /public/build is listed in .gitignore. Committing build artifacts tends to create noisy diffs/merge conflicts and can drift from what CI produces. If the runtime image needs these assets, it’s usually better to generate them during CI/Docker build and keep public/build untracked (or remove the ignore rule if the repo intentionally tracks built assets).

Copilot uses AI. Check for mistakes.
Comment thread resources/js/ssr.tsx Outdated
Comment thread resources/js/ssr.tsx
Comment on lines +10 to 19
createServer((page) =>
createInertiaApp({
page,
render: ReactDOMServer.renderToString,
title: (title) => (title ? `${title} - ${appName}` : appName),
pages: './pages',
setup: ({ App, props }) => {

/* eslint-disable */
// @ts-expect-error
global.route<RouteName> = (name, params, absolute) =>
route(name, params as any, absolute, {
// @ts-expect-error
...page.props.ziggy,
// @ts-expect-error
location: new URL(page.props.ziggy.location),
});
/* eslint-enable */
const page = props.initialPage;

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

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

createServer((page) => ...) introduces a page parameter, and inside setup another const page = props.initialPage is declared. This shadowing makes it easy to accidentally reference the wrong page and is especially risky in SSR code. Rename one of them (e.g., initialPage) to avoid ambiguity.

Copilot uses AI. Check for mistakes.
Comment thread docker-compose.yml
Comment on lines +48 to +55
ssr:
command: node bootstrap/ssr/ssr.js
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:13714/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

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

ssr is defined without either an image or build section. This works only if another compose file always augments it, but the CI compose merge (docker-compose.yml + docker-compose.ci.yml) currently does not define ssr, so docker compose config validation is likely to fail. Add a minimal build/image for ssr in docker-compose.ci.yml, or move the ssr service definition out of the base compose and into the env-specific compose files only.

Copilot uses AI. Check for mistakes.
Comment thread docker-compose.dev.yml Outdated
Comment on lines +61 to +62
volumes:
- .:/app/

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

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

The ssr service bind-mounts the entire repo to /app, but the image build produces bootstrap/ssr/ssr.js inside the image. The bind mount will hide that built bundle, so node bootstrap/ssr/ssr.js will fail unless the host has already generated the bundle. Consider removing the bind mount, or changing the command/entrypoint to build the SSR bundle at container start (or mounting only what’s needed).

Suggested change
volumes:
- .:/app/

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +10
node_modules
vendor
public/build
bootstrap/ssr
bootstrap/cache
storage
.git
.github
.infrastructure
*.md

Copilot AI Mar 22, 2026

Copy link

Choose a reason for hiding this comment

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

Dockerfile.ssr.dockerignore won’t be picked up automatically by Docker/Compose (they only read .dockerignore in the build context unless the build tooling explicitly sets an alternate ignore file). I couldn’t find any build command/workflow referencing --ignorefile, so this file likely has no effect. Either configure the build to use it, or document/rename the approach so the intended ignore rules are actually applied.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@LambdaDigamma

Copy link
Copy Markdown
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copilot AI commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

@LambdaDigamma I've opened a new pull request, #67, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 22, 2026 12:48
- Untrack public/build/manifest.json (build artifact in .gitignore)
- Rename inner `page` to `initialPage` in ssr.tsx to avoid shadowing
- Add ssr service build definition to docker-compose.ci.yml
- Remove bind-mount from ssr service in docker-compose.dev.yml
- Document BuildKit requirement in Dockerfile.ssr.dockerignore

Co-authored-by: LambdaDigamma <19361610+LambdaDigamma@users.noreply.github.com>
Agent-Logs-Url: https://github.com/LambdaDigamma/moers-web/sessions/eff12651-d417-4d01-9701-98856e15a333
fix: address SSR implementation review comments
@LambdaDigamma LambdaDigamma merged commit a237370 into master Mar 22, 2026
2 checks passed
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.

3 participants