Skip to main content

max / makenotwork

Add server deploy documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author: Max J. <87768334+MaxJMath@users.noreply.github.com> · 2026-05-10 17:57 UTC
Commit: 58395c62d498ad58aff7faa419adfa03a39a070d
Parent: c402b5b
1 file changed, +54 insertions, -0 deletions
@@ -0,0 +1,54 @@
1 + # MNW Server — Build & Deploy
2 +
3 + See `_meta/docs/deploy.md` for shared infrastructure (machines, git remotes).
4 +
5 + The server is NOT collected into `~/Dist`. It deploys directly to production via `deploy/deploy.sh`.
6 +
7 + ## Target
8 +
9 + | Platform | Artifact | Build Machine | Destination |
10 + |----------|----------|---------------|-------------|
11 + | Linux x86_64 | Binary | local (macbook, cross-compile via cargo-zigbuild) | alpha-west-1 (Hetzner) |
12 +
13 + ## Prerequisites
14 +
15 + - Rust 1.95+, `cargo-zigbuild`, `zig` (via Homebrew)
16 + - `rustup target add x86_64-unknown-linux-gnu`
17 + - SSH access: root@100.120.174.96 port 2200
18 +
19 + ## Deploy Commands
20 +
21 + ```bash
22 + cd ~/Code/MNW/server
23 +
24 + # Full deploy (build + config + static + docs + restart):
25 + ./deploy/deploy.sh
26 +
27 + # Quick deploy (binary + restart only):
28 + ./deploy/deploy.sh --quick
29 +
30 + # Config only (Caddyfile, systemd, error pages):
31 + ./deploy/deploy.sh --config
32 + ```
33 +
34 + ## Build Gate (run before deploying)
35 +
36 + ```bash
37 + ssh pop-os "source ~/.cargo/env && cd ~/Code/MNW && git checkout -- . && git pull && bash build-gate.sh"
38 + ```
39 +
40 + Runs: `cargo check` → `cargo clippy -D warnings` → `cargo test --lib` → `cargo test --test integration`. Deploy blocked if non-flaky tests fail.
41 +
42 + Note: `git checkout -- .` needed because local `.env` (DATABASE_URL for sqlx) isn't committed.
43 +
44 + ## Version Bumping
45 +
46 + **Always ask the user what version to set before deploying.** Edit `server/Cargo.toml`, commit, push, then deploy.
47 +
48 + ## Notes
49 +
50 + - Deploy sends 30s restart warning to connected users before stopping.
51 + - Uploads: binary, Caddyfile, systemd units, error pages, static assets, minified CSS, docs, rustdoc.
52 + - Verify: script checks HTTP 200 from running service.
53 + - Migrations run automatically on server startup.
54 + - Rollback: see `docs/rollback.md`. Previous binary kept at `/opt/makenotwork/makenotwork.prev`.