Repository navigation
Build the web client in CI instead of on EC2 - #21
Merged
Merged
Conversation
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]>
3 of 4 tasks
Serve the web client with nginx and proxy the API
2 of 5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
dist/to EC2. The instance (908 MB RAM) runs out of heap duringvite build. Even with 2 GB of swap, the build only succeeded after settingNODE_OPTIONS=--max-old-space-size=1536by hand, and the deploy action doesn't set it.vite previewstill serves the files, so EC2 still pulls web-client and runsnpm ci, but it no longer builds.WEB_API_BASE_URLsets the API URL baked into the bundle. When it is unset,web-client/.env.productionapplies as before (https://api.cornellhyperloop.com).Before merging this on its own
The test instance at
98.93.47.19currently relies on a hand-madeweb-client/.env.production.local, which CI builds don't see. If this merges without #22, set the repository variableWEB_API_BASE_URL=http://98.93.47.19:8080(Settings > Secrets and variables > Actions > Variables). Otherwise the deployed bundle goes back to callingapi.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
api.cornellhyperloop.comVITE_API_BASE_URL=http://98.93.47.19:8080: it contains that URL insteadsystemctl is-active frontendreports active, and the GUI loads on :4173🤖 Generated with Claude Code