feat: Add companion agent one-click deployment + fix frontend TS errors
Go deployment orchestrator with platform-specific SteamCMD install, Rust server download, server.cfg generation, and service registration. Wire deploy command subscription in daemon, make GameServerPath optional, add InstallDir config with OS-aware defaults. Fix unused imports and WebSocket subscribe API in ServerView. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -24,9 +25,12 @@ type Config struct {
|
||||
|
||||
// Game server configuration
|
||||
SteamCMDPath string `envconfig:"STEAMCMD_PATH" default:"/usr/games/steamcmd"`
|
||||
GameServerPath string `envconfig:"GAME_SERVER_PATH" required:"true"`
|
||||
GameServerPath string `envconfig:"GAME_SERVER_PATH" default:""`
|
||||
GameServerArgs string `envconfig:"GAME_SERVER_ARGS" default:"-batchmode"`
|
||||
|
||||
// Install directory for deployment
|
||||
InstallDir string `envconfig:"INSTALL_DIR" default:""`
|
||||
|
||||
// Optional settings
|
||||
HeartbeatInterval int `envconfig:"HEARTBEAT_INTERVAL" default:"60"`
|
||||
LogLevel string `envconfig:"LOG_LEVEL" default:"info"`
|
||||
@@ -44,11 +48,21 @@ func main() {
|
||||
log.Fatalf("Failed to load configuration: %v", err)
|
||||
}
|
||||
|
||||
// Set default InstallDir based on OS if not configured
|
||||
if cfg.InstallDir == "" {
|
||||
if runtime.GOOS == "windows" {
|
||||
cfg.InstallDir = `C:\RustServer`
|
||||
} else {
|
||||
cfg.InstallDir = "/opt/rustserver"
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("Configuration loaded:")
|
||||
log.Printf(" NATS URL: %s", cfg.NATSUrl)
|
||||
log.Printf(" License ID: %s", cfg.LicenseID)
|
||||
log.Printf(" Game Server Path: %s", cfg.GameServerPath)
|
||||
log.Printf(" SteamCMD Path: %s", cfg.SteamCMDPath)
|
||||
log.Printf(" Install Dir: %s", cfg.InstallDir)
|
||||
log.Printf(" Heartbeat Interval: %ds", cfg.HeartbeatInterval)
|
||||
|
||||
// Create context with signal handling for graceful shutdown
|
||||
@@ -73,6 +87,7 @@ func main() {
|
||||
GameServerPath: cfg.GameServerPath,
|
||||
GameServerArgs: cfg.GameServerArgs,
|
||||
Version: version,
|
||||
InstallDir: cfg.InstallDir,
|
||||
}
|
||||
|
||||
// Start daemon
|
||||
|
||||
Reference in New Issue
Block a user