SystemApplication/docs/superpowers/specs/2026-06-18-deploy-design.md

40 lines
1.5 KiB
Markdown
Raw Normal View History

# Deployment Design: InternetProject to 8.130.143.54
## Summary
Deploy a React (Vite) frontend + Rust (Axum) backend to a remote Ubuntu 22.04 server. The Rust binary serves both the API and the static frontend files. Port 8548, manual start via nohup.
## Architecture
Single-binary deployment. Rust binary at `/opt/internet-project/RustServer` serves:
- `GET /api/web/stats` — system metrics for the React frontend
- `GET /api/client/health` — health check for future .NET client
- All other paths → static files from `/opt/internet-project/static/` (SPA fallback to index.html)
Access: `http://8.130.143.54:8548`
## Server Info
- OS: Ubuntu 22.04.5 LTS, x86_64
- RAM: 1.6 GB, Disk: 35 GB free
- Tools pre-installed: git only (no Rust, no Node)
## Build Strategy
Cross-compile locally via WSL (mirrored network mode + autoProxy=true — no manual proxy config needed).
- **React**: `npm run build` in Windows PowerShell or WSL → `Client/dist/`
- **Rust**: `cargo build --release` in WSL → `Server/target/release/RustServer`
- Port is read from `PORT` env var (default 8080); code change already applied to `main.rs`
## Deploy Steps
1. Build React frontend (`npm run build`)
2. Build Rust binary in WSL (`cargo build --release`)
3. Upload via scp: binary + `Client/dist/*``/opt/internet-project/`
4. Start: `nohup PORT=8548 ./RustServer > server.log 2>&1 &`
## Process Management
Manual start (nohup). Stop with `pkill RustServer`. Logs at `/opt/internet-project/server.log`.