Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ deploys are triggered by SSHing into the VPS and running this script.
| `/opt/muzix/` | Git checkout of `kcolbchain/muzix` (the `main` branch is prod) |
| `/opt/muzix/web/.next/standalone/` | Next.js standalone build (`server.js`) — what systemd runs |
| `/opt/muzix/web/.next/standalone/public/` | **Hand-wired** — Next.js does not copy `public/` into standalone output |
| `/opt/muzix/web/.next/standalone/web/.next/static/` | **Hand-wired** — Next.js does not copy `.next/static` into standalone output |
| `/opt/muzix/web/.next/standalone/.next/static/` | **Hand-wired** — Next.js does not copy `.next/static` into standalone output. Note: this lives at `standalone/.next/static`, **not** `standalone/web/.next/static` — the source dir-layout is misleading. |
| `/etc/systemd/system/muzix-web.service` | systemd unit — `node /opt/muzix/web/.next/standalone/server.js` on `127.0.0.1:3700` |
| `/etc/caddy/conf.d/muzix.caddy` | Caddy reverse-proxy to `127.0.0.1:3700` |

Expand All @@ -26,7 +26,7 @@ The script:
1. `git fetch && git reset --hard origin/main` in `/opt/muzix`
2. `npm install` + `npm run build` in `/opt/muzix/web`
3. Copies `web/public/` → `web/.next/standalone/public/`
4. Copies `web/.next/static/` → `web/.next/standalone/web/.next/static/`
4. Copies `web/.next/static/` → `web/.next/standalone/.next/static/`
5. `systemctl restart muzix-web`
6. Verifies the service is active; on failure prints the last 30 journal lines and exits non-zero

Expand Down
11 changes: 8 additions & 3 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ npm run build > /dev/null
# Next.js standalone output does NOT copy these by design — the docs
# explicitly tell you to wire them in for production. See:
# https://nextjs.org/docs/app/api-reference/config/next-config-js/output
# Both destinations are RELATIVE TO THE STANDALONE ROOT — NOT under web/.
# server.js does process.chdir(__dirname) where __dirname is the standalone
# root, then looks for `./.next/static` and `./public`. Writing them under
# `standalone/web/.next/static` (a mirror of the source layout) is wrong:
# the homepage will render but every /_next/static/* request will 404,
# silently breaking all styling.
echo "==> wiring public/ and .next/static into standalone..."
rm -rf "$STANDALONE/public"
mkdir -p "$STANDALONE/public"
cp -r "$REPO/web/public/." "$STANDALONE/public/"

rm -rf "$STANDALONE/web/.next/static"
mkdir -p "$STANDALONE/web/.next"
cp -r "$REPO/web/.next/static" "$STANDALONE/web/.next/static"
rm -rf "$STANDALONE/.next/static"
cp -r "$REPO/web/.next/static" "$STANDALONE/.next/static"

echo "==> systemctl restart ${SERVICE}..."
sudo systemctl restart "$SERVICE"
Expand Down
Loading