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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Inject workspace display name into hosted tenant runtime env
rcourtmancbd0311055c5
diff --git a/docs/MSP.md b/docs/MSP.mdindex be5c37c8fe..34e27c3b4d 100644--- a/docs/MSP.md+++ b/docs/MSP.md@@ -109,10 +109,12 @@ For ticket bridges (ConnectWise and similar), use the delivery contract —stable severity/type fields, `X-Pulse-Event-ID` deduplication, and HMAC-signeddeliveries via `signingSecret` — documented in [WEBHOOKS.md](WEBHOOKS.md).-In the provider-hosted model, client runtimes receive `PULSE_TENANT_ID` from-the control plane; set `PULSE_TENANT_NAME` alongside it for a human-readable-client label in payloads. Shared-process organizations stamp the org ID and-display name automatically.+In the provider-hosted model, client runtimes receive `PULSE_TENANT_ID` and+`PULSE_TENANT_NAME` (the workspace display name) from the control plane, so+payloads carry a human-readable client label automatically. A display-name+change applies on the client runtime's next rollout, which recreates the+container. Shared-process organizations stamp the org ID and display name+automatically.## Per-client reportsdiff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 515173c985..22e9d4f44b 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -189,6 +189,14 @@ Stripe-free and avoids a cloud-control-plane report data path across clients.Hosted tenant container creation must also bound Docker `json-file` logsthrough the control-plane Docker manager so tenant runtime logging cannotfill the live Pulse Cloud host independently of tenant data quotas.+ Hosted tenant container creation must also stamp tenant identity into the+ runtime environment: the Docker manager resolves the workspace display name+ from the tenant registry at container-create time and injects+ `PULSE_TENANT_NAME` alongside `PULSE_TENANT_ID`, so alert webhook payloads+ from hosted client runtimes carry a human-readable workspace label instead+ of falling back to the tenant ID. Display-name changes after creation apply+ on the next tenant runtime rollout, which recreates the container with+ freshly resolved environment.Provider-hosted MSP and Pulse-hosted tenant creation must also prepare orfail closed on the configured tenant runtime image before mutating theworkspace into a state that expects a live runtime container; readinessdiff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex cf1f0cab3c..4327c16fa3 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -138,6 +138,11 @@ TLS floor in the dynamic config.Tenant runtime containers must use bounded Docker `json-file`logging so rollout and canary fleets cannot consume unbounded productionhost storage while they remain running.+ Tenant runtime creation and rollout must also resolve the workspace display+ name from the tenant registry and inject it as `PULSE_TENANT_NAME` next to+ `PULSE_TENANT_ID`; the rollout path is the canonical way a display-name+ change reaches a running client container, because rollout recreates the+ container with freshly resolved environment.Provider-hosted MSP workspace creation and preflight must prepare or reportthe configured tenant runtime image, configured Docker network, Dockerdaemon reachability, and storage-admission guardrails before the providerdiff --git a/internal/cloudcp/docker/manager.go b/internal/cloudcp/docker/manager.goindex 3e58e2470f..9ec45bc199 100644--- a/internal/cloudcp/docker/manager.go+++ b/internal/cloudcp/docker/manager.go@@ -30,14 +30,21 @@ type ManagerConfig struct {BaseDomain stringTrialActivationPublicKey stringTrustedProxyCIDRs []string- TenantReportBrand TenantReportBrandConfig- TenantRuntimeUID int- TenantRuntimeGID int- MemoryLimit int64 // bytes- CPUShares int64- TenantLogMaxSize string- TenantLogMaxFile int- ContainerPort int // port inside the container (default 7655)+ // TenantDisplayName resolves a tenant's workspace display name at+ // container-create time; the value is injected as PULSE_TENANT_NAME so+ // alert webhook payloads carry a human-readable workspace label instead+ // of falling back to the tenant ID. Display-name changes after creation+ // apply on the next runtime rollout, which recreates the container with+ // freshly resolved env. May be nil.+ TenantDisplayName func(tenantID string) string+ TenantReportBrand TenantReportBrandConfig+ TenantRuntimeUID int+ TenantRuntimeGID int+ MemoryLimit int64 // bytes+ CPUShares int64+ TenantLogMaxSize string+ TenantLogMaxFile int+ ContainerPort int // port inside the container (default 7655)}type TenantReportBrandConfig struct {@@ -547,10 +554,17 @@ func tenantRuntimeContainerConfig(tenantID string, cfg ManagerConfig, labels mapImage: cfg.Image,User: tenantRuntimeUserFor(cfg),Labels: labels,- Env: tenantEnvForRuntime(tenantID, cfg.BaseDomain, cfg.TrialActivationPublicKey, trustedProxyCIDRs, tenantRuntimeUIDFor(cfg), tenantRuntimeGIDFor(cfg), cfg.TenantReportBrand),+ Env: tenantEnvForRuntime(tenantID, tenantDisplayNameFor(cfg, tenantID), cfg.BaseDomain, cfg.TrialActivationPublicKey, trustedProxyCIDRs, tenantRuntimeUIDFor(cfg), tenantRuntimeGIDFor(cfg), cfg.TenantReportBrand),}}+func tenantDisplayNameFor(cfg ManagerConfig, tenantID string) string {+ if cfg.TenantDisplayName == nil {+ return ""+ }+ return strings.TrimSpace(cfg.TenantDisplayName(tenantID))+}+func tenantRuntimeUserFor(cfg ManagerConfig) string {return fmt.Sprintf("%d:%d", tenantRuntimeUIDFor(cfg), tenantRuntimeGIDFor(cfg))}@@ -626,11 +640,11 @@ func tenantRuntimeOwnershipPaths() []string {}}-func tenantEnv(tenantID, baseDomain, trialActivationPublicKey string, trustedProxyCIDRs []string, reportBrand TenantReportBrandConfig) []string {- return tenantEnvForRuntime(tenantID, baseDomain, trialActivationPublicKey, trustedProxyCIDRs, tenantRuntimeUID, tenantRuntimeGID, reportBrand)+func tenantEnv(tenantID, tenantName, baseDomain, trialActivationPublicKey string, trustedProxyCIDRs []string, reportBrand TenantReportBrandConfig) []string {+ return tenantEnvForRuntime(tenantID, tenantName, baseDomain, trialActivationPublicKey, trustedProxyCIDRs, tenantRuntimeUID, tenantRuntimeGID, reportBrand)}-func tenantEnvForRuntime(tenantID, baseDomain, trialActivationPublicKey string, trustedProxyCIDRs []string, runtimeUID, runtimeGID int, reportBrand TenantReportBrandConfig) []string {+func tenantEnvForRuntime(tenantID, tenantName, baseDomain, trialActivationPublicKey string, trustedProxyCIDRs []string, runtimeUID, runtimeGID int, reportBrand TenantReportBrandConfig) []string {routing := CanonicalTenantRuntimeRouting(tenantID, baseDomain)tenantID = strings.TrimSpace(tenantID)@@ -643,6 +657,9 @@ func tenantEnvForRuntime(tenantID, baseDomain, trialActivationPublicKey string,fmt.Sprintf("PGID=%d", runtimeGID),fmt.Sprintf("%s=%s", immutableOwnershipPathsEnv, strings.Join(tenantImmutableOwnershipPaths(), ":")),}+ if name := strings.TrimSpace(tenantName); name != "" {+ env = append(env, "PULSE_TENANT_NAME="+name)+ }if routing.PublicURL != "" {env = append(env, "PULSE_PUBLIC_URL="+routing.PublicURL)}diff --git a/internal/cloudcp/docker/manager_test.go b/internal/cloudcp/docker/manager_test.goindex edd736d288..d7046afe30 100644--- a/internal/cloudcp/docker/manager_test.go+++ b/internal/cloudcp/docker/manager_test.go@@ -73,7 +73,7 @@ func TestTenantMountsKeepImmutableFilesReadOnly(t *testing.T) {func TestTenantEnvIncludesImmutableOwnershipContract(t *testing.T) {t.Parallel()- env := tenantEnv("t-example", "cloud.pulserelay.pro", "pubkey-123", []string{"172.18.0.0/16", "127.0.0.1/32"}, TenantReportBrandConfig{})+ env := tenantEnv("t-example", "", "cloud.pulserelay.pro", "pubkey-123", []string{"172.18.0.0/16", "127.0.0.1/32"}, TenantReportBrandConfig{})want := map[string]bool{"PULSE_DATA_DIR=/etc/pulse": true,"PULSE_HOSTED_MODE=true": true,@@ -181,7 +181,7 @@ func TestHealthCheckPrefersProviderMSPIsolatedTenantNetwork(t *testing.T) {func TestTenantEnvLowercasesPublicURLHost(t *testing.T) {t.Parallel()- env := tenantEnv("T-AbCd123", "Cloud.PulseRelay.Pro", "", nil, TenantReportBrandConfig{})+ env := tenantEnv("T-AbCd123", "", "Cloud.PulseRelay.Pro", "", nil, TenantReportBrandConfig{})want := "PULSE_PUBLIC_URL=https://t-abcd123.cloud.pulserelay.pro"for _, item := range env {if item == want {@@ -194,7 +194,7 @@ func TestTenantEnvLowercasesPublicURLHost(t *testing.T) {func TestTenantEnvOmitsPublicURLWithoutTenantContext(t *testing.T) {t.Parallel()- env := tenantEnv("", "", "", nil, TenantReportBrandConfig{})+ env := tenantEnv("", "", "", "", nil, TenantReportBrandConfig{})sawTenantID := falsefor _, item := range env {if strings.HasPrefix(item, "PULSE_PUBLIC_URL=") {@@ -209,10 +209,60 @@ func TestTenantEnvOmitsPublicURLWithoutTenantContext(t *testing.T) {}}+func TestTenantEnvStampsWorkspaceDisplayName(t *testing.T) {+ t.Parallel()++ env := tenantEnv("t-acme", " Acme Rentals ", "cloud.pulserelay.pro", "", nil, TenantReportBrandConfig{})+ want := "PULSE_TENANT_NAME=Acme Rentals"+ for _, item := range env {+ if item == want {+ return+ }+ }+ t.Fatalf("tenantEnv() missing %q in %v", want, env)+}++func TestTenantEnvOmitsTenantNameWhenUnresolved(t *testing.T) {+ t.Parallel()++ env := tenantEnv("t-acme", "", "cloud.pulserelay.pro", "", nil, TenantReportBrandConfig{})+ for _, item := range env {+ if strings.HasPrefix(item, "PULSE_TENANT_NAME=") {+ t.Fatalf("unexpected tenant name env item %q; name must be omitted so payloads fall back to the tenant ID", item)+ }+ }+}++func TestTenantRuntimeContainerConfigResolvesTenantDisplayName(t *testing.T) {+ t.Parallel()++ cfg := ManagerConfig{+ Image: "pulse:test",+ BaseDomain: "cloud.pulserelay.pro",+ TenantDisplayName: func(tenantID string) string {+ if tenantID != "t-acme" {+ t.Fatalf("resolver received tenant id %q, want t-acme", tenantID)+ }+ return "Acme Rentals"+ },+ }+ containerCfg := tenantRuntimeContainerConfig("t-acme", cfg, nil, nil)+ if got := envValue(containerCfg.Env, "PULSE_TENANT_NAME"); got != "Acme Rentals" {+ t.Fatalf("PULSE_TENANT_NAME = %q, want %q; env=%v", got, "Acme Rentals", containerCfg.Env)+ }++ withoutResolver := tenantRuntimeContainerConfig("t-acme", ManagerConfig{Image: "pulse:test", BaseDomain: "cloud.pulserelay.pro"}, nil, nil)+ for _, item := range withoutResolver.Env {+ if strings.HasPrefix(item, "PULSE_TENANT_NAME=") {+ t.Fatalf("unexpected tenant name env item %q without a resolver", item)+ }+ }+}+func TestTenantEnvIncludesProviderReportBrandDefaults(t *testing.T) {t.Parallel()- env := tenantEnv("t-acme", "msp.example.com", "", nil, TenantReportBrandConfig{+ env := tenantEnv("t-acme", "", "msp.example.com", "", nil, TenantReportBrandConfig{DisplayName: "Acme Managed IT",LogoBase64: "iVBORw0KGgo=",LogoFormat: "png",diff --git a/internal/cloudcp/server.go b/internal/cloudcp/server.goindex c826ac5732..aaddcef802 100644--- a/internal/cloudcp/server.go+++ b/internal/cloudcp/server.go@@ -6,6 +6,7 @@ import ("net/http""os""os/signal"+ "strings""syscall""time"@@ -59,6 +60,7 @@ func Run(ctx context.Context, version string) error {BaseDomain: baseDomainFromURL(cfg.BaseURL),TrialActivationPublicKey: cfg.TrialActivationPublicKey,TrustedProxyCIDRs: cfg.TrustedProxyCIDRs,+ TenantDisplayName: tenantDisplayNameResolver(reg),TenantReportBrand: cpDocker.TenantReportBrandConfig{DisplayName: cfg.ReportBrandDisplayName,LogoPath: cfg.ReportBrandLogoPath,@@ -206,6 +208,20 @@ func Run(ctx context.Context, version string) error {return nil}+// tenantDisplayNameResolver resolves the workspace display name stamped into+// tenant runtime env (PULSE_TENANT_NAME) from the tenant registry. The lookup+// happens at container-create time, so display-name changes after creation+// apply on the next runtime rollout, which recreates the container.+func tenantDisplayNameResolver(reg *registry.TenantRegistry) func(string) string {+ return func(tenantID string) string {+ tenant, err := reg.Get(tenantID)+ if err != nil || tenant == nil {+ return ""+ }+ return strings.TrimSpace(tenant.DisplayName)+ }+}+// baseDomainFromURL extracts a base domain from a URL like "https://cloud.pulserelay.pro".func baseDomainFromURL(baseURL string) string {// Strip schemediff --git a/internal/cloudcp/tenant_runtime_rollout.go b/internal/cloudcp/tenant_runtime_rollout.goindex 6bb3a051b9..51290449d4 100644--- a/internal/cloudcp/tenant_runtime_rollout.go+++ b/internal/cloudcp/tenant_runtime_rollout.go@@ -222,6 +222,7 @@ func newTenantRuntimeRolloutServiceFromConfig(BaseDomain: baseDomainFromURL(cfg.BaseURL),TrialActivationPublicKey: cfg.TrialActivationPublicKey,TrustedProxyCIDRs: cfg.TrustedProxyCIDRs,+ TenantDisplayName: tenantDisplayNameResolver(reg),TenantReportBrand: cpDocker.TenantReportBrandConfig{DisplayName: cfg.ReportBrandDisplayName,LogoPath: cfg.ReportBrandLogoPath,