docs: rewrite PLAN.md and update CODEBASE.md, README.md
- Full rewrite of PLAN.md to reflect current architecture (27 REST + 3 WS endpoints, embedded frontend, automation, scheduler, health check, GoReleaser CI) - Added health.go, mods.go, scheduler.go, robfig/cron dep to CODEBASE.md - Added Gitea Actions CI/CD section to CODEBASE.md - Added conventional commits to code style section - Added missing API routes and embed/ to README.md
This commit is contained in:
+43
-12
@@ -4,20 +4,32 @@
|
||||
- **Language / runtime**: Go 1.25 (backend), TypeScript 6 + React 19 (frontend)
|
||||
- **Framework(s)**: Gin v1.12 (HTTP router), gorilla/websocket (WS), TanStack Query v5 (data fetching), Tailwind CSS 4 (styling), Vite 8 (bundler)
|
||||
- **Build system**: Go toolchain (`go build`), Vite/Rollup for frontend, multi-stage Docker build
|
||||
- **Test framework**: None detected
|
||||
- **Test framework**: Go `testing` + Vitest + React Testing Library
|
||||
|
||||
## Code Style
|
||||
|
||||
- **Commits**: [Conventional Commits](https://www.conventionalcommits.org/) — format: `type(scope): description`
|
||||
- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `ci`, `perf`
|
||||
- Scopes: `backend`, `frontend`, `ci`, `docker`, or omit for project-wide changes
|
||||
- Examples: `feat(backend): add mod cleanup endpoint`, `fix(frontend): resolve race in modlist editor`, `docs: update PLAN.md to reflect current architecture`
|
||||
|
||||
## Directory map
|
||||
|
||||
```
|
||||
arma3-web-server/
|
||||
├── backend/ # Go backend
|
||||
│ ├── cmd/server/main.go # Entry point, env parsing, dir creation, wiring
|
||||
│ ├── cmd/server/main.go # Entry point, env parsing, dir creation, startup auto-tasks, wiring
|
||||
│ ├── embed/
|
||||
│ │ ├── embed.go # //go:embed dist — embeds frontend into Go binary
|
||||
│ │ └── dist/ # Pre-built frontend SPA assets
|
||||
│ ├── internal/
|
||||
│ │ ├── api/ # Gin HTTP handlers + WebSocket endpoints
|
||||
│ │ │ ├── router.go # Route registration, Handler struct + New()
|
||||
│ │ │ ├── settings.go # Settings CRUD + server start/stop/restart + steamcmd
|
||||
│ │ │ ├── configs.go # .cfg file CRUD handlers
|
||||
│ │ │ ├── modlists.go # Modlist CRUD + import + check/download-missing/update-all
|
||||
│ │ │ ├── modlists.go # Modlist CRUD + import + export + check/download-missing/update-all
|
||||
│ │ │ ├── mods.go # Mod listing, deletion, bulk cleanup
|
||||
│ │ │ ├── health.go # Comprehensive health check endpoint
|
||||
│ │ │ └── logs.go # WS streaming (server, steamcmd, rpt) + log file listing
|
||||
│ │ ├── models/ # Data structs
|
||||
│ │ │ ├── settings.go # ServerSettings (singleton)
|
||||
@@ -26,9 +38,11 @@ arma3-web-server/
|
||||
│ │ ├── settings.go # JSON load/save from data/settings.json
|
||||
│ │ ├── config_manager.go # .cfg file I/O in $CFG_DIR
|
||||
│ │ ├── modlist_manager.go # Modlist CRUD against data/modlists/*.json
|
||||
│ │ ├── modlist_parser.go # HTML Arma Launcher preset parser
|
||||
│ │ ├── modlist_parser.go # HTML Arma Launcher preset parser + renderer
|
||||
│ │ ├── mod_manager.go # Workshop + local mod discovery + usage map
|
||||
│ │ ├── server_process.go # Process lifecycle, arg builder, mod path resolver
|
||||
│ │ ├── steamcmd.go # SteamCMD manager (UpdateGame, DownloadMod, DownloadMods)
|
||||
│ │ ├── scheduler.go # Cron-based scheduled updates
|
||||
│ │ └── log_streamer.go # Pub/sub fan-out for stdout/stderr via channels
|
||||
│ ├── go.mod / go.sum
|
||||
│ └── serverfiles/ # Default SERVERFILE_DIR (created at startup)
|
||||
@@ -41,12 +55,14 @@ arma3-web-server/
|
||||
│ │ ├── types/index.ts # ServerSettings, Modlist, ModEntry, ConfigInfo, ServerPaths
|
||||
│ │ ├── pages/ # 7 route-level page components
|
||||
│ │ │ ├── Dashboard.tsx # Overview cards (status, configs, modlists)
|
||||
│ │ │ ├── Settings.tsx # Main settings tab + userconfig tabs + SteamCMD section
|
||||
│ │ │ ├── Settings.tsx # Main settings tab + userconfig tabs + SteamCMD + automation
|
||||
│ │ │ ├── Configs.tsx # List/create/duplicate/delete configs
|
||||
│ │ │ ├── ConfigEditor.tsx # Full-page Monaco editor for a single config
|
||||
│ │ │ ├── Modlists.tsx # List/create/duplicate/delete + HTML import
|
||||
│ │ │ ├── ModlistEditor.tsx # Mod list reorder + enable/disable + check/download-missing/update-all
|
||||
│ │ │ └── Logs.tsx # Tabbed LiveTerminal (Server Console / RPT / SteamCMD) + file browser
|
||||
│ │ │ ├── Mods.tsx # Installed mods table + search + delete + cleanup
|
||||
│ │ │ ├── Logs.tsx # Tabbed LiveTerminal (Server Console / RPT / SteamCMD) + file browser
|
||||
│ │ │ └── Status.tsx # Health check / deploy status dashboard
|
||||
│ │ └── components/
|
||||
│ │ ├── ConfigEditor.tsx # Monaco editor wrapper
|
||||
│ │ ├── LiveTerminal.tsx # xterm.js + auto-reconnect WebSocket
|
||||
@@ -58,7 +74,13 @@ arma3-web-server/
|
||||
├── data/ # Runtime data (mounted volume in Docker)
|
||||
│ ├── presets/ # (unused)
|
||||
│ └── servers/ # (unused)
|
||||
├── dev-deploy/ # Local development runtime data (git-ignored)
|
||||
├── .gitea/workflows/
|
||||
│ ├── ci.yml # Build-only CI (Go + frontend)
|
||||
│ └── release.yml # GoReleaser-based release on tag push
|
||||
├── Dockerfile # Multi-stage: Go build -> npm build -> alpine runtime
|
||||
├── Dockerfile.goreleaser # Single-stage for GoReleaser (pre-built artifacts injected)
|
||||
├── .goreleaser.yaml # GoReleaser v2 config (Gitea release target)
|
||||
├── docker-compose.yml # Single service with volume mounts + env vars
|
||||
└── Makefile # Convenience targets: backend, frontend, build, run, dev, clean
|
||||
```
|
||||
@@ -72,7 +94,7 @@ arma3-web-server/
|
||||
| `github.com/gin-gonic/gin` | framework | v1.12.0 | HTTP routing, middleware, request binding |
|
||||
| `github.com/gorilla/websocket` | library | v1.5.3 | WebSocket upgrade + message I/O |
|
||||
| `github.com/google/uuid` | utility | v1.6.0 | UUID generation for modlists |
|
||||
| `modernc.org/sqlite` | database | v1.53.0 | Declared but **not used** (file-based chosen) |
|
||||
| `github.com/robfig/cron/v3` | scheduler | v3.0.1 | Cron expression parsing and scheduled task execution |
|
||||
| `golang.org/x/net` | stdlib | v0.51.0 | HTML parser for modlist import |
|
||||
|
||||
### Frontend (npm)
|
||||
@@ -149,8 +171,17 @@ User clicks "Start" (Settings.tsx)
|
||||
```
|
||||
|
||||
## CI/CD
|
||||
- **No CI pipeline** -- no `.github/` or `.gitlab-ci.yml` found
|
||||
- **No tests** -- zero test files anywhere in the codebase
|
||||
- **Docker build**: multi-stage Dockerfile at root -- builds Go binary, builds frontend dist, assembles Alpine image with steamcmd, exposes `:8080`, mounts `/data` and `/servers` volumes
|
||||
- **Deployment**: single docker-compose.yml with one service, volume mounts for persistence
|
||||
- **Local dev**: Makefile targets -- `make run` starts backend, `make dev` starts both backend + Vite dev server with hot reload
|
||||
|
||||
### Gitea Actions (`/.gitea/workflows/`)
|
||||
|
||||
- **`ci.yml`** — Triggered on push to any branch or PR. Runs `go build ./...` and `npm ci && npm run build`. Build-only; no tests.
|
||||
- **`release.yml`** — Triggered on `v*` tag push. Runs GoReleaser v2 with `release --clean`, which builds Go binaries (linux/amd64 + windows/amd64), builds frontend via `before.hooks`, creates archives, builds + pushes a Docker image using `Dockerfile.goreleaser`, and publishes a Gitea release.
|
||||
|
||||
### Docker
|
||||
|
||||
- **`Dockerfile`** — Multi-stage build: Go compile → npm build → Debian slim runtime + SteamCMD. Single self-contained image.
|
||||
- **`Dockerfile.goreleaser`** — Single-stage assembly-only Dockerfile for GoReleaser CI. Expects pre-built artifacts injected by GoReleaser.
|
||||
|
||||
### Local dev
|
||||
|
||||
- **Makefile targets** — `make run` starts backend, `make dev` starts both backend + Vite dev server with hot reload.
|
||||
|
||||
Reference in New Issue
Block a user