π’ Frontend Deploy
Service:
funday-frontend.serviceruns Node SSR on the production host (server.json:3000). Ingress is Nginx β Traefik β:3000. This is a host-level systemd service, not a Kubernetes Deployment.
Use the atomic deploy script from the Funday repository root. Never run raw vite build, npm run build:vite, npm run build --no-restart, or any build while vite dev :5173 is active on the production host.
Preconditions
| Check | Command / action |
|---|---|
| Local Git only | Ensure you are on a committed branch; the platform is never pushed to GitHub or any external remote. |
| Memory gate | grep MemAvailable /proc/meminfo must show β₯ 5 GB before starting. |
| No dev server orphans | pgrep -af 'vite dev.*5173' must be empty. If an orphan is present and no active dev session owns it, terminate it. |
| Top RSS offenders | Audit `ps -eo rss,comm,pid βsort=-rss |
Steps
-
Run the atomic deploy script. The supported entry point is from the frontend directory:
cd /home/usr/funday/frontend npm run deployThis invokes
scripts/build-atomic.sh, which performs: backup of the currentbuild/to.build-backup/,vite build, artifact verification, atomic service restart, and rollback on failure. -
Verify the artifact gate. Before the restart is accepted, confirm both exist:
ls -l /home/usr/funday/frontend/build/server/index.js ls -l /home/usr/funday/frontend/build/client/_app/immutable/ -
Confirm service readiness.
curl -sf http://127.0.0.1:3000/health sudo systemctl status funday-frontend.service -
If health fails, inspect logs:
sudo journalctl -u funday-frontend.service -n 100 --no-pager
Flags and edge cases
| Scenario | Correct action |
|---|---|
| Stage a build without restarting the service | cd /home/usr/funday/frontend && bash ../scripts/build-atomic.sh --no-restart |
| Memory below 5 GB available | Do not pass --force. Free memory or wait; an OOM during vite build can destroy build/client/_app/ and leave the site unstyled. |
| CSS/assets 404 after an OOM kill | Roll back the client assets without a full redeploy: cp -a /home/usr/funday/frontend/.build-backup/client/_app /home/usr/funday/frontend/build/client/ |
| Stale backup directories | Prune build.bak.*, build-backup-*, and frontend-deploy/ after a successful deploy; keep only build/ and .build-backup/. |
Prohibited
- Raw
vite build npm run build:vitenpm run buildornpm run build --no-restartagainst production while the service is active- Passing
--forcebelow the memory gate - Running
vite dev :5173on the production host during or alongside a deploy
Sources
funday/AGENTS.mdΒ§01.2 Frontend Production Deploy Manifestfunday/frontend/package.jsondeploy scriptfunday/scripts/build-atomic.shfunday/funday-codex.ymlservices.frontendfunday/funday-bible.mdservices quick reference