43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# New App Checklist (Vite + Bun + PM2)
|
|
|
|
## 1) Local Repo Changes
|
|
- Add `serve` script:
|
|
- `"serve": "serve -s dist -l tcp://0.0.0.0:$PORT"`
|
|
- Add dependency:
|
|
- `serve` (run `bun add serve`)
|
|
|
|
## 2) CI Workflow
|
|
- Use the template file in `ci-template.yaml`.
|
|
- Replace placeholders:
|
|
- `<APP_NAME>`
|
|
- `<APP_PORT>`
|
|
- `<DEPLOY_PATH>`
|
|
|
|
## 3) Server One-Time Setup
|
|
- Create deploy directory:
|
|
- `mkdir -p <DEPLOY_PATH>`
|
|
- First PM2 start:
|
|
- `cd <DEPLOY_PATH>`
|
|
- `PORT=<APP_PORT> pm2 start "bun run serve" --name <APP_NAME>`
|
|
- `pm2 save`
|
|
|
|
## 4) Deploy + Restart (CI will do this)
|
|
- Files copied to server:
|
|
- `dist/`, `package.json`, `bun.lock` (or `bun.lockb`)
|
|
- On server:
|
|
- `bun install --production`
|
|
- `PORT=<APP_PORT> pm2 restart <APP_NAME> --update-env`
|
|
|
|
## 5) Verification
|
|
- PM2 process:
|
|
- `pm2 show <APP_NAME>`
|
|
- Port:
|
|
- `pm2 env <ID> | grep PORT`
|
|
- Bind:
|
|
- `pm2 logs <APP_NAME> --lines 20`
|
|
- Expect: `Accepting connections at http://0.0.0.0:<APP_PORT>`
|
|
- Files:
|
|
- `ls -la <DEPLOY_PATH>`
|
|
- `ls -la <DEPLOY_PATH>/dist | head -20`
|
|
- HTTP:
|
|
- `curl -I http://<SERVER_IP>:<APP_PORT>` |