Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

feat: add containerization detection to version endpoint

rcourtman8194ce9e7a4c
diff --git a/internal/api/router.go b/internal/api/router.go
index 989cce6886..ac29b059c3 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -2264,6 +2264,22 @@ func (r *Router) handleVersion(w http.ResponseWriter, req *http.Request) {
DeploymentType: versionInfo.DeploymentType,
}
+ // Detect containerization (LXC/Docker)
+ if containerType, err := os.ReadFile("/run/systemd/container"); err == nil {
+ response.Containerized = true
+
+ // Try to get container ID from hostname (LXC containers often use CTID as hostname)
+ if hostname, err := os.Hostname(); err == nil {
+ // For LXC, try to extract numeric ID from hostname or use full hostname
+ response.ContainerId = hostname
+ }
+
+ // Add container type to deployment type if not already set
+ if response.DeploymentType == "" {
+ response.DeploymentType = string(containerType)
+ }
+ }
+
// Add cached update info if available
if cachedUpdate := r.updateManager.GetCachedUpdateInfo(); cachedUpdate != nil {
response.UpdateAvailable = cachedUpdate.Available
diff --git a/internal/api/types.go b/internal/api/types.go
index bc191d281b..622ec8904e 100644
--- a/internal/api/types.go
+++ b/internal/api/types.go
@@ -33,6 +33,8 @@ type VersionResponse struct {
DeploymentType string `json:"deploymentType,omitempty"`
UpdateAvailable bool `json:"updateAvailable"`
LatestVersion string `json:"latestVersion,omitempty"`
+ Containerized bool `json:"containerized"`
+ ContainerId string `json:"containerId,omitempty"`
}
// ErrorResponse represents an error response