Files
ArmA-3-web-server/README.md

160 lines
5.7 KiB
Markdown

# Arma 3 Web Server
Web-based management panel for Arma 3 dedicated servers. Start, stop, configure, and monitor your server from a browser.
## Features
- **Server control** — Start, stop, restart, and view status
- **Live console** — WebSocket terminal showing server stdout/stderr and RPT log tailing
- **Config management** — Create, edit, duplicate, and delete `.cfg` configuration files with a Monaco editor
- **Modlist management** — Create modlists with reorderable entries, enable/disable per mod, import from HTML (e.g. ArmA 3 Steam Workshop collections), check download status
- **SteamCMD integration** — Update the server binary, download individual workshop mods, bulk download missing or outdated mods, all streamed live to the UI
- **Settings UI** — Edit server parameters, IP:port, platform, Steam branch/user, CBA/AI/difficulty presets, and select active config/modlist
- **Log viewer** — Browse and read server log files
## Quick Start
### Docker
```bash
docker compose up -d
```
The web UI is served on `http://localhost:8080`.
### Manual
```bash
# Backend
cd backend
go build -o arma3-web-server ./cmd/server
./arma3-web-server
# Frontend (development)
cd frontend
npm install
npm run dev
```
## Configuration
All paths are configurable via environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| `DATA_DIR` | `data` | Server metadata (settings, modlist JSON files) |
| `SERVERFILE_DIR` | `serverfiles` | Arma 3 server installation |
| `MODS_DIR` | `serverfiles/mods` | Local mod symlinks/copies |
| `CFG_DIR` | `serverfiles/cfg` | Server configuration `.cfg` files |
| `PROFILES_DIR` | `serverfiles/profiles` | Arma 3 profile and log directory |
| `FRONTEND_DIR` | `../frontend/dist` | Built frontend assets |
| `LISTEN` | `:8080` | HTTP listen address |
## Automation
The panel can perform automatic operations at startup and on a schedule.
### Startup tasks
Configured in the **Automation** section of the Settings UI:
| Setting | Description |
|---------|-------------|
| **Auto-update server on startup** | Runs `steamcmd +app_update` for the Arma 3 server binary when the web service starts. |
| **Auto-update mods on startup** | Downloads workshop updates for every enabled mod in the active modlist when the web service starts. |
| **Auto-start server on startup** | Restarts the game server if it was running when the web service last stopped. Useful for recovery after host backup cycles or container restarts. |
All startup tasks run asynchronously — the web UI is available immediately.
### Scheduled updates
Set a **cron expression** in the `Scheduled Update` field to run game + mod updates on a recurring schedule (e.g. `"0 4 * * *"` for daily at 4 AM). Leave empty to disable.
The scheduled update runs even if the game server is currently running.
## SteamCMD Authentication
The panel integrates with SteamCMD for server binary updates and workshop mod downloads.
### Anonymous (default)
The `Steam User` field in the settings UI defaults to `anonymous`.
In this mode, **no Steam account is required** — SteamCMD uses `+login anonymous`.
- Workshop mod downloads always use this mode, regardless of the configured user.
- The Arma 3 server binary update is available via `+login anonymous` only if the server files are publicly accessible on that Steam account.
### Authenticated login
To update the Arma 3 server binary (`app_update 233780`) with a real Steam account, set the `Steam User` field to your account name.
The web panel does not pass a password — SteamCMD relies on a **cached session**.
You must authenticate manually once so the login token is persisted:
```bash
# Docker
docker exec -it arma3-web steamcmd +login your_steam_username
```
Enter your password when prompted, including any Steam Guard code if enabled. The session is cached inside the container's filesystem (`~/.steam/`).
> **Note:** SteamCMD sessions may expire. Re-run the login command if the "Update Server" button fails with an authentication error.
### Security
- Steam credentials saved in `data/settings.json` are stored as **plain text**.
- It is recommended to use a **dedicated Steam account** with only the necessary game licenses for automated server management.
## API
REST API at `/api/*` and WebSocket endpoints at `/ws/*`. Key routes:
| Method | Path | Description |
|--------|------|-------------|
| `GET/PUT` | `/api/server/settings` | Read/update server settings |
| `POST` | `/api/server/start\|stop\|restart` | Server lifecycle |
| `GET` | `/api/server/status` | Running state |
| `GET/POST/PUT/DELETE` | `/api/configs` | CRUD for `.cfg` files |
| `GET/POST/PUT/DELETE` | `/api/modlists` | CRUD for modlists |
| `POST` | `/api/modlists/import` | Import HTML workshop list |
| `GET` | `/api/modlists/:id/check` | Check mod download status |
| `POST` | `/api/modlists/:id/download-missing\|update-all` | Bulk workshop operations |
| `POST` | `/api/server/steamcmd/update-game\|download-mod` | SteamCMD operations |
| `GET` | `/api/server/logs` | List log files |
| `GET` | `/api/server/paths` | Show server file paths |
| `WS` | `/ws/server/logs\|rpt\|steamcmd/logs` | Live log streaming |
## Project Structure
```
backend/
cmd/server/ Entry point
internal/
api/ HTTP handlers and routes
models/ Data types
services/ Business logic
frontend/
src/
api/ HTTP and WebSocket client
components/ Shared UI components
pages/ Route-level views
types/ TypeScript interfaces
```
## Development
```bash
# Backend
cd backend && go run ./cmd/server
# Frontend (hot reload)
cd frontend && npm run dev
# Lint
cd frontend && npm run lint
```
## License
MIT