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.

Restore Apprise Telegram topic delivery

[email protected]4ff4b61ccc02
diff --git a/Dockerfile b/Dockerfile
index c2e54fb352..7b9e5ba62b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,6 @@
# syntax=docker/dockerfile:1.7-labs
ARG BUILD_AGENT=1
+ARG APPRISE_VERSION=1.12.0
# Build stage for frontend (must be built first for embedding)
# Force amd64 platform to avoid slow QEMU emulation during multi-arch builds
@@ -251,13 +252,29 @@ VOLUME ["/var/lib/pulse-agent"]
ENTRYPOINT ["/usr/local/bin/pulse-agent"]
+# Build the pinned Apprise CLI separately so release runtimes only retain the
+# Python interpreter and installed notification dependencies, not pip.
+FROM alpine:3.20@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc AS apprise-builder
+
+ARG APPRISE_VERSION
+
+RUN apk --no-cache add python3 py3-pip && \
+ python3 -m venv /opt/apprise && \
+ /opt/apprise/bin/pip install --no-cache-dir "apprise==${APPRISE_VERSION}" && \
+ /opt/apprise/bin/apprise --version | grep -F "Apprise v${APPRISE_VERSION}"
+
# Base Pulse server runtime shared by self-hosted and hosted tenant images.
FROM alpine:3.20@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc AS pulse-runtime-base
# Use TARGETARCH to select the correct binary for the build platform
ARG TARGETARCH
+ARG APPRISE_VERSION
+
+RUN apk --no-cache add ca-certificates tzdata su-exec openssh-client python3
-RUN apk --no-cache add ca-certificates tzdata su-exec openssh-client
+COPY --from=apprise-builder /opt/apprise /opt/apprise
+RUN ln -s /opt/apprise/bin/apprise /usr/local/bin/apprise && \
+ apprise --version | grep -F "Apprise v${APPRISE_VERSION}"
WORKDIR /app
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 5a282fe384..ed0d42421c 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -1250,10 +1250,14 @@ Future config cleanup should extend the
config transport hook, the config model, the override-projection hook, or the
shared `frontend-modern/src/utils/alertDestinationsPresentation.ts` helper for
customer-facing destinations copy instead of reviving inline retry, test, and
-error text across the feature tabs.
-destinations runtime hook based on which subsystem actually owns the behavior
-instead of letting the broader configuration hook absorb all four concerns
-again.
+error text across the feature tabs. Runtime cleanup should extend the
+destinations hook owned by the subsystem that carries the behavior instead of
+letting the broader configuration hook absorb all four concerns again.
+Local Apprise delivery is a shipped server-runtime capability, not an
+operator-installed optional. The shared presentation helper must show the
+Telegram `chat_id:topic` form, the notification backend must preserve each
+target as one CLI argument, and the deployment-installability contract must
+keep the pinned `apprise` executable available in every Pulse server image.
The email destination provider picker now follows that same split:
`frontend-modern/src/components/Alerts/useEmailProviderSelectState.ts` owns
provider-catalog loading and provider-default application, while
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 243c809921..0c5ecb4aca 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -1448,6 +1448,15 @@ jointly stage the canonical shipped docs set into the container build context
before `npm run build` runs, rather than relying on a workstation-local
checkout layout or leaving hosted runtime image builds unable to resolve
`/app/docs/*.md`, `SECURITY.md`, or `TERMS.md`.
+The shared Pulse server runtime must also ship the local Apprise notification
+CLI promised by the alert destinations surface. `Dockerfile` must install an
+explicitly pinned Apprise release in a separate builder stage, copy that
+environment into `pulse-runtime-base`, retain only the runtime Python
+interpreter there, and verify the exact CLI version in both stages. Because
+hosted, E2E, and self-hosted server images all derive from that base, local
+Apprise delivery—including Telegram `chat_id:topic` targets—must not depend on
+an operator modifying a running container or on a mutable Alpine package
+version.
That same Docker build graph must keep hosted tenant runtime images separate
from release-installer assembly. `Dockerfile` must expose a `hosted_runtime`
target derived from the shared Pulse server runtime base that copies only the
diff --git a/frontend-modern/src/utils/__tests__/alertDestinationsPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertDestinationsPresentation.test.ts
index e045d0d759..fbe2ec565e 100644
--- a/frontend-modern/src/utils/__tests__/alertDestinationsPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertDestinationsPresentation.test.ts
@@ -77,11 +77,14 @@ describe('alertDestinationsPresentation', () => {
'Choose how Pulse should execute Apprise notifications.',
);
expect(getAlertDestinationsAppriseTargetsHelp('cli')).toBe(
- 'Enter one Apprise URL per line. Commas are also supported.',
+ 'Enter one Apprise URL per line. Commas are also supported. For Telegram forum topics, append :topic to the chat ID.',
);
expect(getAlertDestinationsAppriseTargetsHelp('http')).toBe(
'Optional: override the URLs defined on your Apprise API instance. Leave blank to use the server defaults.',
);
+ expect(ALERT_DESTINATIONS_APPRISE_TARGETS_PLACEHOLDER).toContain(
+ 'tgram://bot-token/-1001234567890:42',
+ );
expect(ALERT_DESTINATIONS_APPRISE_TARGETS_PLACEHOLDER).toContain('discord://token');
expect(ALERT_DESTINATIONS_APPRISE_API_KEY_HEADER_HELP).toBe(
'Defaults to X-API-KEY for Apprise API deployments.',
diff --git a/frontend-modern/src/utils/alertDestinationsPresentation.ts b/frontend-modern/src/utils/alertDestinationsPresentation.ts
index e439280186..ea132f9987 100644
--- a/frontend-modern/src/utils/alertDestinationsPresentation.ts
+++ b/frontend-modern/src/utils/alertDestinationsPresentation.ts
@@ -21,10 +21,11 @@ export const ALERT_DESTINATIONS_APPRISE_MODE_HTTP_LABEL = 'Remote Apprise API';
export const ALERT_DESTINATIONS_APPRISE_MODE_HELP =
'Choose how Pulse should execute Apprise notifications.';
export const ALERT_DESTINATIONS_APPRISE_TARGETS_LABEL = 'Delivery targets';
-export const ALERT_DESTINATIONS_APPRISE_TARGETS_PLACEHOLDER = `discord://token
+export const ALERT_DESTINATIONS_APPRISE_TARGETS_PLACEHOLDER = `tgram://bot-token/-1001234567890:42
+discord://token
mailto://[email protected]`;
export const ALERT_DESTINATIONS_APPRISE_TARGETS_HELP_CLI =
- 'Enter one Apprise URL per line. Commas are also supported.';
+ 'Enter one Apprise URL per line. Commas are also supported. For Telegram forum topics, append :topic to the chat ID.';
export const ALERT_DESTINATIONS_APPRISE_TARGETS_HELP_HTTP =
'Optional: override the URLs defined on your Apprise API instance. Leave blank to use the server defaults.';
export const ALERT_DESTINATIONS_APPRISE_CLI_PATH_LABEL = 'CLI path';
diff --git a/internal/notifications/notifications_security_cli_test.go b/internal/notifications/notifications_security_cli_test.go
index 54bc1655d0..08110d66a2 100644
--- a/internal/notifications/notifications_security_cli_test.go
+++ b/internal/notifications/notifications_security_cli_test.go
@@ -3,6 +3,7 @@ package notifications
import (
"context"
"errors"
+ "slices"
"testing"
)
@@ -72,3 +73,27 @@ func TestSendAppriseViaCLISuccessNoOutput(t *testing.T) {
t.Fatalf("expected success, got %v", err)
}
}
+
+func TestSendAppriseViaCLIPreservesTelegramTopicTarget(t *testing.T) {
+ nm := NewNotificationManager("")
+ defer nm.Stop()
+
+ const topicTarget = "tgram://bot-token/-1001234567890:42"
+ var receivedArgs []string
+ nm.appriseExec = func(ctx context.Context, args []string) ([]byte, error) {
+ receivedArgs = slices.Clone(args)
+ return nil, nil
+ }
+
+ err := nm.sendAppriseViaCLI(AppriseConfig{
+ CLIPath: "apprise",
+ TimeoutSeconds: 1,
+ Targets: []string{topicTarget},
+ }, "title", "body")
+ if err != nil {
+ t.Fatalf("expected Telegram topic target delivery to succeed, got %v", err)
+ }
+ if len(receivedArgs) == 0 || receivedArgs[len(receivedArgs)-1] != topicTarget {
+ t.Fatalf("expected Telegram topic target to be preserved as one CLI argument, got %#v", receivedArgs)
+ }
+}
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index a803c872cc..cfe26acd3e 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -766,6 +766,31 @@ func TestDockerAndDemoBuildsUseCanonicalReleaseLdflags(t *testing.T) {
}
}
+func TestDockerRuntimeShipsPinnedAppriseCLI(t *testing.T) {
+ dockerfileBytes, err := os.ReadFile(repoFile("Dockerfile"))
+ if err != nil {
+ t.Fatalf("read Dockerfile: %v", err)
+ }
+ dockerfile := string(dockerfileBytes)
+ required := []string{
+ `ARG APPRISE_VERSION=1.12.0`,
+ `AS apprise-builder`,
+ `python3 -m venv /opt/apprise`,
+ `/opt/apprise/bin/pip install --no-cache-dir "apprise==${APPRISE_VERSION}"`,
+ `COPY --from=apprise-builder /opt/apprise /opt/apprise`,
+ `ln -s /opt/apprise/bin/apprise /usr/local/bin/apprise`,
+ `apprise --version | grep -F "Apprise v${APPRISE_VERSION}"`,
+ }
+ for _, needle := range required {
+ if !strings.Contains(dockerfile, needle) {
+ t.Fatalf("Dockerfile missing pinned Apprise runtime contract: %s", needle)
+ }
+ }
+ if strings.Count(dockerfile, `apprise --version | grep -F "Apprise v${APPRISE_VERSION}"`) < 2 {
+ t.Fatal("Dockerfile must verify the pinned Apprise CLI in both its build and runtime stages")
+ }
+}
+
func TestAgentRuntimeImageDefaultsToUnifiedHostAndDockerMonitoring(t *testing.T) {
dockerfileBytes, err := os.ReadFile(repoFile("Dockerfile"))
if err != nil {