Add server health endpoint and status page
Backend: - New /api/server/health endpoint returning server, paths, disk, mods, steamcmd, and frontend status - Health endpoint checks directory existence/writability, disk usage, server binary, and frontend dist availability Frontend: - New Status page (route /status) with sections for Server, SteamCMD, Mods, Frontend, Directories (with exists/writable badges), and Disk Usage (with size formatting and used-percent coloring) - Paths are clickable to copy and use start-truncation (ellipsis on the left) with native hover tooltip - Health API client integration with 10s auto-refresh Misc: - Update .gitignore and Makefile, minor Layout nav addition
This commit is contained in:
@@ -17,11 +17,12 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
dataDir := mustAbs(getEnv("DATA_DIR", filepath.Join("data")))
|
||||
serverfileDir := mustAbs(getEnv("SERVERFILE_DIR", "serverfiles"))
|
||||
modsDir := mustAbs(getEnv("MODS_DIR", "serverfiles/mods"))
|
||||
cfgDir := mustAbs(getEnv("CFG_DIR", "serverfiles/cfg"))
|
||||
profilesDir := mustAbs(getEnv("PROFILES_DIR", "serverfiles/profiles"))
|
||||
devDeploy := getEnv("DEV_DEPLOY_DIR", filepath.Join("..", "dev-deploy"))
|
||||
dataDir := mustAbs(getEnv("DATA_DIR", filepath.Join(devDeploy, "data")))
|
||||
serverfileDir := mustAbs(getEnv("SERVERFILE_DIR", filepath.Join(devDeploy, "serverfiles")))
|
||||
modsDir := mustAbs(getEnv("MODS_DIR", filepath.Join(devDeploy, "serverfiles", "mods")))
|
||||
cfgDir := mustAbs(getEnv("CFG_DIR", filepath.Join(devDeploy, "serverfiles", "cfg")))
|
||||
profilesDir := mustAbs(getEnv("PROFILES_DIR", filepath.Join(devDeploy, "serverfiles", "profiles")))
|
||||
listen := getEnv("LISTEN", ":8080")
|
||||
frontendDir := mustAbs(getEnv("FRONTEND_DIR", filepath.Join("..", "frontend", "dist")))
|
||||
|
||||
@@ -63,7 +64,7 @@ func main() {
|
||||
log.Printf("serving frontend from %s", frontendDir)
|
||||
}
|
||||
|
||||
handler := api.New(settings, configMgr, modlistMgr, process, steamcmd, scheduler, streamer, serverfileDir, modsDir, cfgDir, profilesDir)
|
||||
handler := api.New(settings, configMgr, modlistMgr, process, steamcmd, scheduler, streamer, dataDir, serverfileDir, modsDir, cfgDir, profilesDir, frontendDir)
|
||||
handler.SetupRoutes(r)
|
||||
|
||||
// Startup auto-tasks
|
||||
|
||||
Reference in New Issue
Block a user