fix(deploy): sync static assets and nginx CSS route

Copy .next/static and public into standalone after build; serve
/_next/static from nginx; verify CSS in install.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Андрей Бобырев
2026-05-24 23:19:03 +03:00
parent 35c677eede
commit 1196bc3d11
5 changed files with 66 additions and 5 deletions

View File

@@ -13,13 +13,15 @@ docker compose exec web npx prisma db push
curl -fsSL https://raw.githubusercontent.com/andrey271192/Domain_web/main/install.sh | sudo bash
```
Install path: `/opt/domain_web`
Service: Docker Compose (`web`, `postgres`, `redis`)
Nginx site: `domain-scanner` on port 80 → app `:3000`
Install path: `/opt/domain-scanner` (lite VPS install via `install.sh`)
Service: `domain-scanner.service``npm start` from repo root (not standalone `server.js` alone)
Nginx site: `domain-scanner` on port 80 → app `:3000`, with `/_next/static/` served from disk
**CSS / static assets:** After `next build`, run `scripts/sync-standalone-assets.sh` (also via `postbuild`) so `.next/static` and `public` exist under `.next/standalone` for Docker. Host deploy must keep `${INSTALL_DIR}/.next/static` — never run `node .next/standalone/server.js` without that copy.
## Environment on server
Edit `/opt/domain_web/.env`:
Edit `/opt/domain-scanner/.env`:
- `NEXTAUTH_SECRET` — auto-generated on first install
- `NEXTAUTH_URL` / `NEXT_PUBLIC_APP_URL` — public IP or domain
@@ -39,5 +41,5 @@ Place certbot in front of nginx or terminate TLS at a reverse proxy.
## Upgrades
```bash
cd /opt/domain_web && git pull && docker compose up -d --build
cd /opt/domain-scanner && git pull && npm ci && npm run build && systemctl restart domain-scanner nginx
```