update docs
This commit is contained in:
197
docs/API.md
Normal file
197
docs/API.md
Normal file
@@ -0,0 +1,197 @@
|
||||
# API Reference
|
||||
|
||||
ACC Server Manager provides a RESTful API for managing ACC dedicated servers.
|
||||
|
||||
## Interactive Documentation
|
||||
|
||||
**Swagger UI is available at: http://localhost:3000/swagger/**
|
||||
|
||||
The Swagger UI provides:
|
||||
- Interactive API testing
|
||||
- Request/response examples
|
||||
- Schema definitions
|
||||
- Authentication testing
|
||||
|
||||
For detailed Swagger usage, see [SWAGGER.md](SWAGGER.md).
|
||||
|
||||
## Base URL
|
||||
|
||||
```
|
||||
http://localhost:3000/api/v1
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
The API uses JWT (JSON Web Token) authentication. Include the token in the Authorization header:
|
||||
|
||||
```
|
||||
Authorization: Bearer <your-jwt-token>
|
||||
```
|
||||
|
||||
### Getting a Token
|
||||
|
||||
```http
|
||||
POST /auth/login
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "your-password"
|
||||
}
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"token": "eyJhbGciOiJIUzI1NiIs...",
|
||||
"user": {
|
||||
"id": "uuid",
|
||||
"username": "admin",
|
||||
"role": "admin"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Core Endpoints
|
||||
|
||||
### Authentication
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| POST | `/auth/login` | Login |
|
||||
| POST | `/auth/register` | Register new user |
|
||||
| GET | `/auth/me` | Get current user |
|
||||
| POST | `/auth/refresh` | Refresh token |
|
||||
|
||||
### Server Management
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| GET | `/servers` | List all servers |
|
||||
| POST | `/servers` | Create new server |
|
||||
| GET | `/servers/{id}` | Get server details |
|
||||
| PUT | `/servers/{id}` | Update server |
|
||||
| DELETE | `/servers/{id}` | Delete server |
|
||||
|
||||
### Server Operations
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| POST | `/servers/{id}/service/start` | Start server |
|
||||
| POST | `/servers/{id}/service/stop` | Stop server |
|
||||
| POST | `/servers/{id}/service/restart` | Restart server |
|
||||
| GET | `/servers/{id}/service/status` | Get server status |
|
||||
|
||||
### Configuration
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| GET | `/servers/{id}/config/{file}` | Get config file |
|
||||
| PUT | `/servers/{id}/config/{file}` | Update config file |
|
||||
|
||||
Available config files:
|
||||
- `configuration.json`
|
||||
- `settings.json`
|
||||
- `event.json`
|
||||
- `eventRules.json`
|
||||
- `assistRules.json`
|
||||
|
||||
### System
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| GET | `/system/health` | Health check
|
||||
|
||||
## Request Examples
|
||||
|
||||
### Create Server
|
||||
|
||||
```http
|
||||
POST /api/v1/servers
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer <token>
|
||||
|
||||
{
|
||||
"name": "My ACC Server",
|
||||
"track": "monza",
|
||||
"maxClients": 30
|
||||
}
|
||||
```
|
||||
|
||||
### Update Configuration
|
||||
|
||||
```http
|
||||
PUT /api/v1/servers/123/config/settings.json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer <token>
|
||||
|
||||
{
|
||||
"serverName": "My Updated Server",
|
||||
"adminPassword": "secret",
|
||||
"trackMedalsRequirement": 0,
|
||||
"safetyRatingRequirement": -1
|
||||
}
|
||||
```
|
||||
|
||||
### Start Server
|
||||
|
||||
```http
|
||||
POST /api/v1/servers/123/start
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
## Response Formats
|
||||
|
||||
### Success Response
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
### Error Response
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"error": "Error message",
|
||||
"code": "ERROR_CODE"
|
||||
}
|
||||
```
|
||||
|
||||
## Status Codes
|
||||
|
||||
- `200` - Success
|
||||
- `201` - Created
|
||||
- `400` - Bad Request
|
||||
- `401` - Unauthorized
|
||||
- `403` - Forbidden
|
||||
- `404` - Not Found
|
||||
- `500` - Internal Server Error
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
- 100 requests per minute per IP
|
||||
- 1000 requests per hour per user
|
||||
|
||||
## Additional Resources
|
||||
|
||||
### Swagger Documentation
|
||||
|
||||
For comprehensive interactive API documentation:
|
||||
- **Swagger UI**: http://localhost:3000/swagger/
|
||||
- **OpenAPI Spec**: http://localhost:3000/swagger/doc.json
|
||||
- **Usage Guide**: [SWAGGER.md](SWAGGER.md)
|
||||
|
||||
### Client Libraries
|
||||
|
||||
Generate client libraries using the OpenAPI spec:
|
||||
```bash
|
||||
# Download spec
|
||||
curl http://localhost:3000/swagger/doc.json -o swagger.json
|
||||
|
||||
# Generate client (example for JavaScript)
|
||||
openapi-generator generate -i swagger.json -g javascript -o ./client
|
||||
```
|
||||
140
docs/CONFIG.md
Normal file
140
docs/CONFIG.md
Normal file
@@ -0,0 +1,140 @@
|
||||
# Configuration Guide
|
||||
|
||||
This guide covers the configuration options for ACC Server Manager.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Required Variables (Auto-generated)
|
||||
|
||||
These are automatically created by the setup script:
|
||||
|
||||
- `JWT_SECRET` - Authentication token secret
|
||||
- `APP_SECRET` - Application encryption key
|
||||
- `ENCRYPTION_KEY` - Database encryption key
|
||||
|
||||
### Optional Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `PORT` | Web server port | `3000` |
|
||||
| `DB_NAME` | Database filename | `acc.db` |
|
||||
| `STEAMCMD_PATH` | Path to SteamCMD | `c:\steamcmd\steamcmd.exe` |
|
||||
| `NSSM_PATH` | Path to NSSM | `.\nssm.exe` |
|
||||
| `CORS_ALLOWED_ORIGIN` | Allowed CORS origins | `http://localhost:5173` |
|
||||
|
||||
## Setting Environment Variables
|
||||
|
||||
### Temporary (Current Session)
|
||||
|
||||
```powershell
|
||||
# PowerShell
|
||||
$env:PORT = "8080"
|
||||
$env:STEAMCMD_PATH = "D:\tools\steamcmd\steamcmd.exe"
|
||||
```
|
||||
|
||||
### Permanent (System-wide)
|
||||
|
||||
1. Open System Properties → Advanced → Environment Variables
|
||||
2. Add new system variables with desired values
|
||||
3. Restart the application
|
||||
|
||||
## Server Configuration
|
||||
|
||||
### ACC Server Settings
|
||||
|
||||
Each ACC server instance has its own configuration managed through the web interface:
|
||||
|
||||
- **Server Name** - Display name in the manager
|
||||
- **Port Settings** - TCP/UDP ports (auto-assigned or manual)
|
||||
- **Configuration Files** - Edit `configuration.json`, `settings.json`, etc.
|
||||
|
||||
### Firewall Rules
|
||||
|
||||
The application automatically manages Windows Firewall rules for ACC servers:
|
||||
|
||||
- Creates inbound rules for TCP and UDP ports
|
||||
- Names rules as "ACC Server - [ServerName]"
|
||||
- Removes rules when server is deleted
|
||||
|
||||
## Security Configuration
|
||||
|
||||
### Password Requirements
|
||||
|
||||
- Minimum 8 characters
|
||||
- Mix of uppercase, lowercase, numbers
|
||||
- Special characters recommended
|
||||
|
||||
### Session Management
|
||||
|
||||
- JWT tokens expire after 24 hours
|
||||
- Refresh tokens available for extended sessions
|
||||
- Configurable timeout in future releases
|
||||
|
||||
## Database
|
||||
|
||||
### SQLite Configuration
|
||||
|
||||
- Database file: `acc.db` (configurable via `DB_NAME`)
|
||||
- Automatic backups: Not yet implemented
|
||||
- Location: Application root directory
|
||||
|
||||
### Data Encryption
|
||||
|
||||
Sensitive data is encrypted using AES-256:
|
||||
|
||||
- Steam credentials
|
||||
- User passwords (bcrypt)
|
||||
- API keys
|
||||
|
||||
## Logging
|
||||
|
||||
### Log Files
|
||||
|
||||
Located in `logs/` directory:
|
||||
|
||||
- `app.log` - General application logs
|
||||
- `error.log` - Error messages
|
||||
- `access.log` - HTTP access logs
|
||||
|
||||
### Log Rotation
|
||||
|
||||
Currently manual - delete old logs periodically.
|
||||
|
||||
## Performance Tuning
|
||||
|
||||
### Database Optimization
|
||||
|
||||
- Use SSD for database location
|
||||
- Regular VACUUM operations recommended
|
||||
- Keep database size under 1GB
|
||||
|
||||
### Memory Usage
|
||||
|
||||
- Base usage: ~50MB
|
||||
- Per server instance: ~10MB
|
||||
- Caching: ~100MB
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Custom Ports
|
||||
|
||||
To use custom port ranges for ACC servers:
|
||||
|
||||
1. Log into web interface
|
||||
2. Go to Settings → Server Defaults
|
||||
3. Set port range (e.g., 9600-9700)
|
||||
|
||||
### Multiple IPs
|
||||
|
||||
If your server has multiple network interfaces:
|
||||
|
||||
1. ACC servers will bind to all interfaces by default
|
||||
2. Configure specific IPs in ACC server settings files
|
||||
|
||||
## Configuration Best Practices
|
||||
|
||||
1. **Backup your `.env` file** - Contains encryption keys
|
||||
2. **Use strong passwords** - Especially for admin account
|
||||
3. **Regular updates** - Keep ACC Server Manager updated
|
||||
4. **Monitor logs** - Check for errors or warnings
|
||||
5. **Test changes** - Verify configuration changes work as expected
|
||||
178
docs/DEPLOYMENT.md
Normal file
178
docs/DEPLOYMENT.md
Normal file
@@ -0,0 +1,178 @@
|
||||
# Deployment Guide
|
||||
|
||||
This guide covers deploying ACC Server Manager to a production Windows server.
|
||||
|
||||
## Production Requirements
|
||||
|
||||
- Windows Server 2016+ or Windows 10/11
|
||||
- 4GB+ RAM
|
||||
- 20GB+ free disk space
|
||||
- Administrator access
|
||||
- SteamCMD and NSSM installed
|
||||
|
||||
## Deployment Steps
|
||||
|
||||
### 1. Prepare the Server
|
||||
|
||||
Install required tools:
|
||||
```powershell
|
||||
# Create directories
|
||||
New-Item -ItemType Directory -Path "C:\ACCServerManager"
|
||||
New-Item -ItemType Directory -Path "C:\steamcmd"
|
||||
New-Item -ItemType Directory -Path "C:\tools\nssm"
|
||||
|
||||
# Download and extract SteamCMD
|
||||
# Download and extract NSSM
|
||||
```
|
||||
|
||||
### 2. Build for Production
|
||||
|
||||
On your development machine:
|
||||
```bash
|
||||
# Build optimized binary
|
||||
go build -ldflags="-w -s" -o acc-server-manager.exe cmd/api/main.go
|
||||
```
|
||||
|
||||
### 3. Deploy Files
|
||||
|
||||
Copy to server:
|
||||
- `acc-server-manager.exe`
|
||||
- `.env` file (with production secrets)
|
||||
- `nssm.exe` (if not in PATH)
|
||||
|
||||
### 4. Configure Production Environment
|
||||
|
||||
Generate production secrets:
|
||||
```powershell
|
||||
# On the server
|
||||
.\scripts\generate-secrets.ps1
|
||||
```
|
||||
|
||||
Edit `.env` for production:
|
||||
```env
|
||||
PORT=80
|
||||
CORS_ALLOWED_ORIGIN=https://yourdomain.com
|
||||
```
|
||||
|
||||
### 5. Install as Windows Service
|
||||
|
||||
```powershell
|
||||
# Using NSSM
|
||||
nssm install "ACC Server Manager" "C:\ACCServerManager\acc-server-manager.exe"
|
||||
nssm set "ACC Server Manager" DisplayName "ACC Server Manager"
|
||||
nssm set "ACC Server Manager" Description "Web management for ACC servers"
|
||||
nssm set "ACC Server Manager" Start SERVICE_AUTO_START
|
||||
nssm set "ACC Server Manager" AppDirectory "C:\ACCServerManager"
|
||||
|
||||
# Start the service
|
||||
nssm start "ACC Server Manager"
|
||||
```
|
||||
|
||||
### 6. Configure Firewall
|
||||
|
||||
```powershell
|
||||
# Allow HTTP traffic
|
||||
New-NetFirewallRule -DisplayName "ACC Server Manager" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
|
||||
```
|
||||
|
||||
### 7. Set Up Reverse Proxy (Optional)
|
||||
|
||||
If using IIS as reverse proxy:
|
||||
1. Install URL Rewrite and ARR modules
|
||||
2. Configure reverse proxy to localhost:3000
|
||||
3. Enable HTTPS with valid certificate
|
||||
|
||||
## Security Checklist
|
||||
|
||||
- [ ] Generated unique production secrets
|
||||
- [ ] Changed default admin password
|
||||
- [ ] Configured HTTPS (via reverse proxy)
|
||||
- [ ] Restricted database file permissions
|
||||
- [ ] Enabled Windows Firewall
|
||||
- [ ] Disabled unnecessary ports
|
||||
- [ ] Set up backup schedule
|
||||
|
||||
## Monitoring
|
||||
|
||||
### Service Health
|
||||
```powershell
|
||||
# Check service status
|
||||
Get-Service "ACC Server Manager"
|
||||
|
||||
# View recent logs
|
||||
Get-EventLog -LogName Application -Source "ACC Server Manager" -Newest 20
|
||||
```
|
||||
|
||||
### Application Logs
|
||||
- Check `logs/app.log` for application events
|
||||
- Check `logs/error.log` for errors
|
||||
- Monitor disk space for log growth
|
||||
|
||||
## Backup Strategy
|
||||
|
||||
### Automated Backups
|
||||
|
||||
Create scheduled task for daily backups:
|
||||
```powershell
|
||||
# Backup script (save as backup.ps1)
|
||||
$date = Get-Date -Format "yyyy-MM-dd"
|
||||
$backupDir = "C:\Backups\ACCServerManager"
|
||||
New-Item -ItemType Directory -Force -Path $backupDir
|
||||
|
||||
# Backup database and config
|
||||
Copy-Item "C:\ACCServerManager\acc.db" "$backupDir\acc_$date.db"
|
||||
Copy-Item "C:\ACCServerManager\.env" "$backupDir\env_$date"
|
||||
|
||||
# Keep only last 7 days
|
||||
Get-ChildItem $backupDir -File | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-7)} | Remove-Item
|
||||
```
|
||||
|
||||
## Updates
|
||||
|
||||
### Update Process
|
||||
|
||||
1. **Backup current deployment**
|
||||
2. **Build new version**
|
||||
3. **Stop service**: `nssm stop "ACC Server Manager"`
|
||||
4. **Replace binary**
|
||||
5. **Start service**: `nssm start "ACC Server Manager"`
|
||||
6. **Verify**: Check logs and web interface
|
||||
|
||||
### Rollback
|
||||
|
||||
If update fails:
|
||||
1. Stop service
|
||||
2. Restore previous binary
|
||||
3. Restore database if needed
|
||||
4. Start service
|
||||
|
||||
## Troubleshooting Deployment
|
||||
|
||||
### Service Won't Start
|
||||
- Check Event Viewer for errors
|
||||
- Verify .env file exists and is valid
|
||||
- Run manually to see console output
|
||||
|
||||
### Can't Access Web Interface
|
||||
- Check firewall rules
|
||||
- Verify service is running
|
||||
- Check port binding in .env
|
||||
|
||||
### Permission Errors
|
||||
- Run service as Administrator (not recommended)
|
||||
- Or grant specific permissions to service account
|
||||
|
||||
## Performance Tuning
|
||||
|
||||
### For Large Deployments
|
||||
- Use SSD for database storage
|
||||
- Increase Windows TCP connection limits
|
||||
- Consider load balancing for 50+ servers
|
||||
- Monitor memory usage and adjust if needed
|
||||
|
||||
### Database Maintenance
|
||||
```sql
|
||||
-- Run monthly via SQLite
|
||||
VACUUM;
|
||||
ANALYZE;
|
||||
```
|
||||
125
docs/MIGRATION.md
Normal file
125
docs/MIGRATION.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# Migration Guide
|
||||
|
||||
This guide covers database migrations and version upgrades for ACC Server Manager.
|
||||
|
||||
## Database Migrations
|
||||
|
||||
The application handles database migrations automatically on startup. No manual intervention is required for most upgrades.
|
||||
|
||||
### Automatic Migrations
|
||||
|
||||
When you start the application:
|
||||
1. It checks the current database schema
|
||||
2. Applies any pending migrations
|
||||
3. Updates the schema version
|
||||
|
||||
### Manual Migration (if needed)
|
||||
|
||||
If automatic migration fails:
|
||||
|
||||
```bash
|
||||
# Backup your database first
|
||||
copy acc.db acc_backup.db
|
||||
|
||||
# Delete the database and let it recreate
|
||||
del acc.db
|
||||
|
||||
# Start the application - it will create a fresh database
|
||||
./api.exe
|
||||
```
|
||||
|
||||
## Upgrading ACC Server Manager
|
||||
|
||||
### From v1.x to v2.x
|
||||
|
||||
1. **Backup your data**
|
||||
```bash
|
||||
copy acc.db acc_backup.db
|
||||
copy .env .env.backup
|
||||
```
|
||||
|
||||
2. **Stop the application**
|
||||
```bash
|
||||
# If running as service
|
||||
nssm stop "ACC Server Manager"
|
||||
```
|
||||
|
||||
3. **Update the code**
|
||||
```bash
|
||||
git pull
|
||||
go build -o api.exe cmd/api/main.go
|
||||
```
|
||||
|
||||
4. **Update configuration**
|
||||
- Check `.env.example` for new required variables
|
||||
- Run `.\scripts\generate-secrets.ps1` if needed
|
||||
|
||||
5. **Start the application**
|
||||
```bash
|
||||
./api.exe
|
||||
# Or restart service
|
||||
nssm start "ACC Server Manager"
|
||||
```
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
### v2.0
|
||||
- Changed from system_configs table to environment variables
|
||||
- Now use `STEAMCMD_PATH` and `NSSM_PATH` environment variables
|
||||
- UUID fields added to all tables (automatic migration)
|
||||
|
||||
### v1.5
|
||||
- Authentication system overhaul
|
||||
- New permission system
|
||||
- Password requirements enforced
|
||||
|
||||
## Data Backup
|
||||
|
||||
### Regular Backups
|
||||
|
||||
Create a scheduled task to backup your database:
|
||||
|
||||
```powershell
|
||||
# PowerShell backup script
|
||||
$date = Get-Date -Format "yyyy-MM-dd"
|
||||
Copy-Item "acc.db" "backups\acc_$date.db"
|
||||
```
|
||||
|
||||
### What to Backup
|
||||
|
||||
- `acc.db` - Main database
|
||||
- `.env` - Configuration and secrets
|
||||
- `logs/` - Application logs (optional)
|
||||
- Server configuration files in each server directory
|
||||
|
||||
## Rollback Procedure
|
||||
|
||||
If an upgrade fails:
|
||||
|
||||
1. Stop the application
|
||||
2. Restore the database: `copy acc_backup.db acc.db`
|
||||
3. Restore the configuration: `copy .env.backup .env`
|
||||
4. Use the previous binary version
|
||||
5. Start the application
|
||||
|
||||
## Common Migration Issues
|
||||
|
||||
### "Database locked"
|
||||
- Stop all instances of the application
|
||||
- Check for stuck processes
|
||||
|
||||
### "Schema version mismatch"
|
||||
- Let automatic migration complete
|
||||
- Don't interrupt during migration
|
||||
|
||||
### "Missing columns"
|
||||
- Database migration was interrupted
|
||||
- Restore from backup and retry
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always backup before upgrading**
|
||||
2. **Test upgrades in a non-production environment first**
|
||||
3. **Read release notes for breaking changes**
|
||||
4. **Keep the last working version's binary**
|
||||
5. **Monitor logs during first startup after upgrade**
|
||||
121
docs/SETUP.md
Normal file
121
docs/SETUP.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Setup Guide
|
||||
|
||||
This guide covers the complete setup process for ACC Server Manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Required Software
|
||||
|
||||
1. **Windows OS**: Windows 10/11 or Windows Server 2016+
|
||||
2. **Go**: Version 1.23.0+ ([Download](https://golang.org/dl/))
|
||||
3. **SteamCMD**: For ACC server installation ([Download](https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip))
|
||||
4. **NSSM**: For Windows service management ([Download](https://nssm.cc/release/nssm-2.24.zip))
|
||||
|
||||
### System Requirements
|
||||
|
||||
- Administrator privileges (for service and firewall management)
|
||||
- At least 4GB RAM
|
||||
- 10GB+ free disk space for ACC servers
|
||||
|
||||
## Installation Steps
|
||||
|
||||
### 1. Install SteamCMD
|
||||
|
||||
1. Download SteamCMD from the link above
|
||||
2. Extract to `C:\steamcmd\`
|
||||
3. Run `steamcmd.exe` once to complete setup
|
||||
|
||||
### 2. Install NSSM
|
||||
|
||||
1. Download NSSM from the link above
|
||||
2. Extract the appropriate version (32-bit or 64-bit)
|
||||
3. Copy `nssm.exe` to the ACC Server Manager directory or add to PATH
|
||||
|
||||
### 3. Build ACC Server Manager
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone <repository-url>
|
||||
cd acc-server-manager
|
||||
|
||||
# Build the application
|
||||
go build -o api.exe cmd/api/main.go
|
||||
```
|
||||
|
||||
### 4. Configure Environment
|
||||
|
||||
Run the setup script to generate secure configuration:
|
||||
|
||||
```powershell
|
||||
# PowerShell
|
||||
.\scripts\generate-secrets.ps1
|
||||
```
|
||||
|
||||
This creates a `.env` file with secure random keys.
|
||||
|
||||
### 5. Set Tool Paths (Optional)
|
||||
|
||||
If your tools are not in the default locations:
|
||||
|
||||
```powershell
|
||||
# PowerShell
|
||||
$env:STEAMCMD_PATH = "D:\tools\steamcmd\steamcmd.exe"
|
||||
$env:NSSM_PATH = "D:\tools\nssm\nssm.exe"
|
||||
```
|
||||
|
||||
### 6. First Run
|
||||
|
||||
```bash
|
||||
# Start the server
|
||||
./api.exe
|
||||
```
|
||||
|
||||
The server will start on http://localhost:3000
|
||||
|
||||
### 7. Initial Login
|
||||
|
||||
1. Open http://localhost:3000 in your browser
|
||||
2. Default credentials:
|
||||
- Username: `admin`
|
||||
- Password: Set in `.env` file or use default (change immediately)
|
||||
|
||||
## Post-Installation
|
||||
|
||||
### Configure Steam Credentials
|
||||
|
||||
1. Log into the web interface
|
||||
2. Go to Settings → Steam Configuration
|
||||
3. Enter your Steam credentials (encrypted storage)
|
||||
|
||||
### Create Your First Server
|
||||
|
||||
1. Click "Add Server"
|
||||
2. Enter server details
|
||||
3. Click "Install" to download ACC server files via Steam
|
||||
4. Configure and start your server
|
||||
|
||||
## Running as a Service
|
||||
|
||||
To run ACC Server Manager as a Windows service:
|
||||
|
||||
```bash
|
||||
# Install service
|
||||
nssm install "ACC Server Manager" "C:\path\to\api.exe"
|
||||
|
||||
# Start service
|
||||
nssm start "ACC Server Manager"
|
||||
```
|
||||
|
||||
## Verify Installation
|
||||
|
||||
Check that everything is working:
|
||||
|
||||
1. Access http://localhost:3000
|
||||
2. Check logs in `logs/` directory
|
||||
3. Try creating a test server
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Configure your servers](CONFIG.md)
|
||||
- [Review API documentation](API.md)
|
||||
- [Troubleshooting guide](TROUBLESHOOTING.md)
|
||||
161
docs/SWAGGER.md
Normal file
161
docs/SWAGGER.md
Normal file
@@ -0,0 +1,161 @@
|
||||
# Swagger API Documentation
|
||||
|
||||
This guide explains how to use the interactive API documentation for ACC Server Manager.
|
||||
|
||||
## Accessing Swagger UI
|
||||
|
||||
The Swagger UI is available at:
|
||||
```
|
||||
http://localhost:3000/swagger/
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
Most API endpoints require JWT authentication. To use authenticated endpoints:
|
||||
|
||||
1. **Get a token**: Use the `/auth/login` endpoint with valid credentials
|
||||
2. **Authorize**: Click the "Authorize" button in Swagger UI
|
||||
3. **Enter token**: Type `Bearer <your-token>` (include the word "Bearer")
|
||||
4. **Test endpoints**: Now you can test protected endpoints
|
||||
|
||||
## API Overview
|
||||
|
||||
### Authentication Endpoints
|
||||
- `POST /auth/login` - Login and get JWT token
|
||||
- `GET /auth/me` - Get current user information
|
||||
|
||||
### Server Management
|
||||
- `GET /v1/server` - List all servers
|
||||
- `POST /v1/server` - Create new server
|
||||
- `GET /v1/server/{id}` - Get server details
|
||||
- `PUT /v1/server/{id}` - Update server
|
||||
- `DELETE /v1/server/{id}` - Delete server
|
||||
|
||||
### Server Configuration
|
||||
- `GET /v1/server/{id}/config` - List config files
|
||||
- `GET /v1/server/{id}/config/{file}` - Get config file
|
||||
- `PUT /v1/server/{id}/config/{file}` - Update config file
|
||||
|
||||
### Service Control
|
||||
- `GET /v1/service-control/{service}` - Get service status
|
||||
- `POST /v1/service-control/start` - Start service
|
||||
- `POST /v1/service-control/stop` - Stop service
|
||||
- `POST /v1/service-control/restart` - Restart service
|
||||
|
||||
### Lookups
|
||||
- `GET /v1/lookup/tracks` - Available tracks
|
||||
- `GET /v1/lookup/car-models` - Available cars
|
||||
- `GET /v1/lookup/driver-categories` - Driver categories
|
||||
- `GET /v1/lookup/cup-categories` - Cup categories
|
||||
- `GET /v1/lookup/session-types` - Session types
|
||||
|
||||
### User Management
|
||||
- `GET /v1/membership` - List users
|
||||
- `POST /v1/membership` - Create user
|
||||
- `GET /v1/membership/{id}` - Get user details
|
||||
- `PUT /v1/membership/{id}` - Update user
|
||||
- `DELETE /v1/membership/{id}` - Delete user
|
||||
|
||||
## Common Operations
|
||||
|
||||
### Login Example
|
||||
```json
|
||||
POST /auth/login
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "your-password"
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"token": "eyJhbGciOiJIUzI1NiIs..."
|
||||
}
|
||||
```
|
||||
|
||||
### Create Server Example
|
||||
```json
|
||||
POST /v1/server
|
||||
Authorization: Bearer <token>
|
||||
{
|
||||
"name": "My ACC Server",
|
||||
"track": "monza",
|
||||
"maxClients": 30,
|
||||
"tcpPort": 9201,
|
||||
"udpPort": 9201
|
||||
}
|
||||
```
|
||||
|
||||
### Update Configuration Example
|
||||
```json
|
||||
PUT /v1/server/{id}/config/settings.json
|
||||
Authorization: Bearer <token>
|
||||
{
|
||||
"serverName": "My Updated Server",
|
||||
"adminPassword": "secret",
|
||||
"trackMedalsRequirement": 0,
|
||||
"safetyRatingRequirement": -1
|
||||
}
|
||||
```
|
||||
|
||||
## Response Codes
|
||||
|
||||
- `200` - Success
|
||||
- `201` - Created
|
||||
- `400` - Bad Request (invalid input)
|
||||
- `401` - Unauthorized (missing/invalid token)
|
||||
- `403` - Forbidden (insufficient permissions)
|
||||
- `404` - Not Found
|
||||
- `409` - Conflict (duplicate resource)
|
||||
- `500` - Internal Server Error
|
||||
|
||||
## Testing Tips
|
||||
|
||||
1. **Start with login** - Get your token first
|
||||
2. **Use "Try it out"** - Click this button to test endpoints
|
||||
3. **Check examples** - Swagger shows request/response examples
|
||||
4. **View schemas** - Click "Schema" to see data structures
|
||||
5. **Download spec** - Get the OpenAPI spec at `/swagger/doc.json`
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Unauthorized" errors
|
||||
- Ensure you've logged in and added the token
|
||||
- Check token hasn't expired (24 hour expiry)
|
||||
- Include "Bearer " prefix with token
|
||||
|
||||
### "Invalid JSON" errors
|
||||
- Use the schema examples provided
|
||||
- Validate JSON syntax
|
||||
- Check required fields
|
||||
|
||||
### Can't see Swagger UI
|
||||
- Ensure server is running
|
||||
- Check correct URL and port
|
||||
- Verify no firewall blocking
|
||||
|
||||
## Generating API Clients
|
||||
|
||||
You can generate client libraries from the OpenAPI spec:
|
||||
|
||||
1. Download spec from `/swagger/doc.json`
|
||||
2. Use [OpenAPI Generator](https://openapi-generator.tech/)
|
||||
3. Generate clients for your language:
|
||||
```bash
|
||||
openapi-generator generate -i swagger.json -g javascript -o ./client
|
||||
```
|
||||
|
||||
## API Rate Limits
|
||||
|
||||
- 100 requests per minute per IP
|
||||
- 1000 requests per hour per user
|
||||
- Rate limit headers included in responses
|
||||
|
||||
## For Developers
|
||||
|
||||
To update Swagger documentation:
|
||||
|
||||
1. Edit controller annotations
|
||||
2. Run: `swag init -g cmd/api/swagger.go -o docs/`
|
||||
3. Restart the server
|
||||
|
||||
See controller files for annotation examples.
|
||||
173
docs/TROUBLESHOOTING.md
Normal file
173
docs/TROUBLESHOOTING.md
Normal file
@@ -0,0 +1,173 @@
|
||||
# Troubleshooting Guide
|
||||
|
||||
Common issues and solutions for ACC Server Manager.
|
||||
|
||||
## Installation Issues
|
||||
|
||||
### "go: command not found"
|
||||
|
||||
**Solution**: Install Go from https://golang.org/dl/ and add to PATH.
|
||||
|
||||
### "steamcmd.exe not found"
|
||||
|
||||
**Solution**:
|
||||
1. Download SteamCMD from https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip
|
||||
2. Extract to `C:\steamcmd\`
|
||||
3. Or set `STEAMCMD_PATH` environment variable to your location
|
||||
|
||||
### "nssm.exe not found"
|
||||
|
||||
**Solution**:
|
||||
1. Download NSSM from https://nssm.cc/download
|
||||
2. Place `nssm.exe` in application directory
|
||||
3. Or set `NSSM_PATH` environment variable
|
||||
|
||||
## Startup Issues
|
||||
|
||||
### "JWT_SECRET environment variable is required"
|
||||
|
||||
**Solution**: Run the setup script:
|
||||
```powershell
|
||||
.\scripts\generate-secrets.ps1
|
||||
```
|
||||
|
||||
### "Failed to connect database"
|
||||
|
||||
**Solution**:
|
||||
1. Check write permissions in application directory
|
||||
2. Delete `acc.db` if corrupted and restart
|
||||
3. Ensure no other instance is running
|
||||
|
||||
### Port already in use
|
||||
|
||||
**Solution**:
|
||||
1. Change port in `.env` file: `PORT=8080`
|
||||
2. Or stop the application using port 3000
|
||||
|
||||
## Server Management Issues
|
||||
|
||||
### "Failed to create firewall rule"
|
||||
|
||||
**Solution**: Run ACC Server Manager as Administrator.
|
||||
|
||||
### ACC server won't start
|
||||
|
||||
**Solutions**:
|
||||
1. Check ACC server logs in server directory
|
||||
2. Verify ports are not in use
|
||||
3. Ensure Steam credentials are correct
|
||||
4. Check Windows Event Viewer
|
||||
|
||||
### "Steam authentication failed"
|
||||
|
||||
**Solutions**:
|
||||
1. Verify Steam credentials in Settings
|
||||
2. Check if Steam Guard is enabled
|
||||
3. Try logging into Steam manually first
|
||||
|
||||
## Performance Issues
|
||||
|
||||
### High CPU usage
|
||||
|
||||
**Solutions**:
|
||||
1. Reduce number of active servers
|
||||
2. Check for runaway ACC server processes
|
||||
3. Restart ACC Server Manager
|
||||
|
||||
### High memory usage
|
||||
|
||||
**Solutions**:
|
||||
1. Check database size (should be < 1GB)
|
||||
2. Restart application to clear caches
|
||||
3. Reduce log retention
|
||||
|
||||
## Authentication Issues
|
||||
|
||||
### Can't login
|
||||
|
||||
**Solutions**:
|
||||
1. Check username and password
|
||||
2. Clear browser cookies
|
||||
3. Check logs for specific errors
|
||||
|
||||
### "Token expired"
|
||||
|
||||
**Solution**: Login again to get a new token.
|
||||
|
||||
## Configuration Issues
|
||||
|
||||
### Changes not saving
|
||||
|
||||
**Solutions**:
|
||||
1. Check file permissions
|
||||
2. Ensure valid JSON format
|
||||
3. Check logs for validation errors
|
||||
|
||||
### Can't edit server config
|
||||
|
||||
**Solutions**:
|
||||
1. Stop the server first
|
||||
2. Check user permissions
|
||||
3. Verify file isn't locked
|
||||
|
||||
## Network Issues
|
||||
|
||||
### Can't connect to server
|
||||
|
||||
**Solutions**:
|
||||
1. Check Windows Firewall rules
|
||||
2. Verify port forwarding on router
|
||||
3. Ensure server is actually running
|
||||
|
||||
### API requests failing
|
||||
|
||||
**Solutions**:
|
||||
1. Check CORS settings if using custom frontend
|
||||
2. Verify authentication token
|
||||
3. Check API endpoint URL
|
||||
|
||||
## Logging & Debugging
|
||||
|
||||
### Enable debug logging
|
||||
|
||||
Add to `.env` file:
|
||||
```
|
||||
LOG_LEVEL=debug
|
||||
```
|
||||
|
||||
### Log locations
|
||||
|
||||
- Application logs: `logs/app.log`
|
||||
- Error logs: `logs/error.log`
|
||||
- ACC server logs: In each server's directory
|
||||
|
||||
## Common Error Messages
|
||||
|
||||
### "Permission denied"
|
||||
- Run as Administrator
|
||||
- Check file/folder permissions
|
||||
|
||||
### "Invalid configuration"
|
||||
- Validate JSON syntax
|
||||
- Check required fields
|
||||
|
||||
### "Database locked"
|
||||
- Close other instances
|
||||
- Restart application
|
||||
|
||||
### "Service installation failed"
|
||||
- Ensure NSSM is available
|
||||
- Run as Administrator
|
||||
- Check service name conflicts
|
||||
|
||||
## Getting Help
|
||||
|
||||
If these solutions don't work:
|
||||
|
||||
1. Check the logs in `logs/` directory
|
||||
2. Search existing GitHub issues
|
||||
3. Create a new issue with:
|
||||
- Error message
|
||||
- Steps to reproduce
|
||||
- System information
|
||||
- Relevant log entries
|
||||
407
docs/docs.go
407
docs/docs.go
@@ -1,407 +0,0 @@
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/v1/api": {
|
||||
"get": {
|
||||
"description": "Return API",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Return API",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/restart": {
|
||||
"post": {
|
||||
"description": "Restarts service",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Restart service",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "required",
|
||||
"name": "name",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/start": {
|
||||
"post": {
|
||||
"description": "Starts service",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Start service",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "required",
|
||||
"name": "name",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/stop": {
|
||||
"post": {
|
||||
"description": "Stops service",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Stop service",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "required",
|
||||
"name": "name",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/{service}": {
|
||||
"get": {
|
||||
"description": "Returns service status",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Return service status",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "required",
|
||||
"name": "service",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/car-models": {
|
||||
"get": {
|
||||
"description": "Return CarModels Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return CarModels Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/cup-categories": {
|
||||
"get": {
|
||||
"description": "Return CupCategories Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return CupCategories Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/driver-categories": {
|
||||
"get": {
|
||||
"description": "Return DriverCategories Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return DriverCategories Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/session-types": {
|
||||
"get": {
|
||||
"description": "Return SessionTypes Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return SessionTypes Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/tracks": {
|
||||
"get": {
|
||||
"description": "Return Tracks Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return Tracks Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/server": {
|
||||
"get": {
|
||||
"description": "Return Servers",
|
||||
"tags": [
|
||||
"Server"
|
||||
],
|
||||
"summary": "Return Servers",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/server/{id}/config": {
|
||||
"get": {
|
||||
"description": "Return Config files",
|
||||
"tags": [
|
||||
"Config"
|
||||
],
|
||||
"summary": "Return Configs",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "number",
|
||||
"description": "required",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/server/{id}/config/{file}": {
|
||||
"get": {
|
||||
"description": "Returns Config file",
|
||||
"tags": [
|
||||
"Config"
|
||||
],
|
||||
"summary": "Return Config file",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "number",
|
||||
"description": "required",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "required",
|
||||
"name": "file",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "Updates config",
|
||||
"tags": [
|
||||
"Config"
|
||||
],
|
||||
"summary": "Update config",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "number",
|
||||
"description": "required",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "required",
|
||||
"name": "file",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "required",
|
||||
"name": "content",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "",
|
||||
Host: "",
|
||||
BasePath: "",
|
||||
Schemes: []string{},
|
||||
Title: "",
|
||||
Description: "",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
@@ -1,378 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"contact": {}
|
||||
},
|
||||
"paths": {
|
||||
"/v1/api": {
|
||||
"get": {
|
||||
"description": "Return API",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Return API",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/restart": {
|
||||
"post": {
|
||||
"description": "Restarts service",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Restart service",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "required",
|
||||
"name": "name",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/start": {
|
||||
"post": {
|
||||
"description": "Starts service",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Start service",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "required",
|
||||
"name": "name",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/stop": {
|
||||
"post": {
|
||||
"description": "Stops service",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Stop service",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "required",
|
||||
"name": "name",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/api/{service}": {
|
||||
"get": {
|
||||
"description": "Returns service status",
|
||||
"tags": [
|
||||
"api"
|
||||
],
|
||||
"summary": "Return service status",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "required",
|
||||
"name": "service",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/car-models": {
|
||||
"get": {
|
||||
"description": "Return CarModels Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return CarModels Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/cup-categories": {
|
||||
"get": {
|
||||
"description": "Return CupCategories Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return CupCategories Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/driver-categories": {
|
||||
"get": {
|
||||
"description": "Return DriverCategories Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return DriverCategories Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/session-types": {
|
||||
"get": {
|
||||
"description": "Return SessionTypes Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return SessionTypes Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/lookup/tracks": {
|
||||
"get": {
|
||||
"description": "Return Tracks Lookup",
|
||||
"tags": [
|
||||
"Lookup"
|
||||
],
|
||||
"summary": "Return Tracks Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/server": {
|
||||
"get": {
|
||||
"description": "Return Servers",
|
||||
"tags": [
|
||||
"Server"
|
||||
],
|
||||
"summary": "Return Servers",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/server/{id}/config": {
|
||||
"get": {
|
||||
"description": "Return Config files",
|
||||
"tags": [
|
||||
"Config"
|
||||
],
|
||||
"summary": "Return Configs",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "number",
|
||||
"description": "required",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/server/{id}/config/{file}": {
|
||||
"get": {
|
||||
"description": "Returns Config file",
|
||||
"tags": [
|
||||
"Config"
|
||||
],
|
||||
"summary": "Return Config file",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "number",
|
||||
"description": "required",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "required",
|
||||
"name": "file",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "Updates config",
|
||||
"tags": [
|
||||
"Config"
|
||||
],
|
||||
"summary": "Update config",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "number",
|
||||
"description": "required",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "required",
|
||||
"name": "file",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "required",
|
||||
"name": "content",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
info:
|
||||
contact: {}
|
||||
paths:
|
||||
/v1/api:
|
||||
get:
|
||||
description: Return API
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return API
|
||||
tags:
|
||||
- api
|
||||
/v1/api/{service}:
|
||||
get:
|
||||
description: Returns service status
|
||||
parameters:
|
||||
- description: required
|
||||
in: path
|
||||
name: service
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return service status
|
||||
tags:
|
||||
- api
|
||||
/v1/api/restart:
|
||||
post:
|
||||
description: Restarts service
|
||||
parameters:
|
||||
- description: required
|
||||
in: body
|
||||
name: name
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Restart service
|
||||
tags:
|
||||
- api
|
||||
/v1/api/start:
|
||||
post:
|
||||
description: Starts service
|
||||
parameters:
|
||||
- description: required
|
||||
in: body
|
||||
name: name
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Start service
|
||||
tags:
|
||||
- api
|
||||
/v1/api/stop:
|
||||
post:
|
||||
description: Stops service
|
||||
parameters:
|
||||
- description: required
|
||||
in: body
|
||||
name: name
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Stop service
|
||||
tags:
|
||||
- api
|
||||
/v1/lookup/car-models:
|
||||
get:
|
||||
description: Return CarModels Lookup
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return CarModels Lookup
|
||||
tags:
|
||||
- Lookup
|
||||
/v1/lookup/cup-categories:
|
||||
get:
|
||||
description: Return CupCategories Lookup
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return CupCategories Lookup
|
||||
tags:
|
||||
- Lookup
|
||||
/v1/lookup/driver-categories:
|
||||
get:
|
||||
description: Return DriverCategories Lookup
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return DriverCategories Lookup
|
||||
tags:
|
||||
- Lookup
|
||||
/v1/lookup/session-types:
|
||||
get:
|
||||
description: Return SessionTypes Lookup
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return SessionTypes Lookup
|
||||
tags:
|
||||
- Lookup
|
||||
/v1/lookup/tracks:
|
||||
get:
|
||||
description: Return Tracks Lookup
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return Tracks Lookup
|
||||
tags:
|
||||
- Lookup
|
||||
/v1/server:
|
||||
get:
|
||||
description: Return Servers
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return Servers
|
||||
tags:
|
||||
- Server
|
||||
/v1/server/{id}/config:
|
||||
get:
|
||||
description: Return Config files
|
||||
parameters:
|
||||
- description: required
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: number
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return Configs
|
||||
tags:
|
||||
- Config
|
||||
/v1/server/{id}/config/{file}:
|
||||
get:
|
||||
description: Returns Config file
|
||||
parameters:
|
||||
- description: required
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: number
|
||||
- description: required
|
||||
in: path
|
||||
name: file
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Return Config file
|
||||
tags:
|
||||
- Config
|
||||
put:
|
||||
description: Updates config
|
||||
parameters:
|
||||
- description: required
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: number
|
||||
- description: required
|
||||
in: path
|
||||
name: file
|
||||
required: true
|
||||
type: string
|
||||
- description: required
|
||||
in: body
|
||||
name: content
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
summary: Update config
|
||||
tags:
|
||||
- Config
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user