Skip to content

Build the web client in CI instead of on EC2 - #21

Merged
hyperloop-cornell merged 3 commits into
mainfrom
feat/ci-built-web-client
Oct 1, 2026
Merged

hyperloop-cornell merged 3 commits into
mainfrom
feat/ci-built-web-client

Conversation

@WesP10

@WesP10 WesP10 commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The deploy action now builds the web-client on the GitHub runner and copies dist/ to EC2. The instance (908 MB RAM) runs out of heap during vite build. Even with 2 GB of swap, the build only succeeded after setting NODE_OPTIONS=--max-old-space-size=1536 by hand, and the deploy action doesn't set it.
  • A failed build now stops the deploy before anything on EC2 changes.
  • vite preview still serves the files, so EC2 still pulls web-client and runs npm ci, but it no longer builds.
  • New optional repository variable WEB_API_BASE_URL sets the API URL baked into the bundle. When it is unset, web-client/.env.production applies as before (https://api.cornellhyperloop.com).

Before merging this on its own

The test instance at 98.93.47.19 currently relies on a hand-made web-client/.env.production.local, which CI builds don't see. If this merges without #22, set the repository variable WEB_API_BASE_URL=http://98.93.47.19:8080 (Settings > Secrets and variables > Actions > Variables). Otherwise the deployed bundle goes back to calling api.cornellhyperloop.com. You don't need the variable if #22 is merged into this branch first.

Stack

#22 (nginx frontend) is based on this branch. Merging this PR deploys to EC2.

Test plan

  • actionlint passes
  • Built the web-client three ways and checked the bundle:
    • no variable: it contains api.cornellhyperloop.com
    • VITE_API_BASE_URL=http://98.93.47.19:8080: it contains that URL instead
    • empty variable: it contains neither, so it uses the page origin
  • After merge: the deploy job succeeds, systemctl is-active frontend reports active, and the GUI loads on :4173

🤖 Generated with Claude Code

WesP10 and others added 2 commits October 1, 2026 16:56
The EC2 instance (908 MB RAM) runs out of heap during `vite build`. The deploy
action now builds on the GitHub runner and copies dist/ over, so the instance
only unpacks it. A failed build stops the deploy before EC2 is touched.

The optional WEB_API_BASE_URL repository variable sets the API URL baked into
the bundle; when unset, web-client/.env.production applies as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rigin

`vite preview` is not meant for production and kept a ~90 MB Node process plus
a full web-client checkout and node_modules on the instance. nginx now serves
the CI-built files on port 4173 and proxies /auth, /api, /ws, /hub and /health
to cloud-services, so the browser makes same-origin requests: no CORS, and
port 8080 no longer has to be open to the internet.

The bundle is now built with an empty API URL (the page origin) unless the
WEB_API_BASE_URL repository variable is set. The first deploy installs nginx
if it is missing and disables the old `frontend` service.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 21:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Serve the web client with nginx and proxy the API
@hyperloop-cornell
hyperloop-cornell merged commit 9e4ee9b into main Oct 1, 2026
4 of 5 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