Skip to content

Notifications

Griffen Fargo edited this page Apr 21, 2026 · 1 revision

Notifications

Fire events to Slack, Discord, or a generic webhook when deploys, backups, health checks, and drift detection run. Since v0.9.0.

Providers are configured in notifications.conf at the project root. Each provider subscribes to a list of events (or * for all). Notification failures always warn and never abort the underlying action.

notifications.conf

Shell-style config, sourced at dispatch time. Create it alongside strut.conf:

# Slack
SLACK_WEBHOOK=https://hooks.slack.com/services/T000/B000/XYZ
SLACK_EVENTS=deploy.success,deploy.fail,health.fail

# Discord
DISCORD_WEBHOOK=https://discord.com/api/webhooks/000/XYZ
DISCORD_EVENTS=deploy.fail

# Generic webhook (any JSON POST receiver)
WEBHOOK_URL=https://ops.example.com/strut
WEBHOOK_EVENTS=*

Search order for the config file:

  1. $NOTIFICATIONS_CONF env var
  2. $PROJECT_ROOT/notifications.conf
  3. $CLI_ROOT/notifications.conf

Event Names

strut fires these events from the command handlers:

Event When
deploy.success Deploy / release completed
deploy.fail Deploy / release failed
backup.success Any backup <type> succeeded
backup.fail Backup failed
health.fail A health check reported a failure
drift.detected drift detect found differences
test.ping Emitted by strut notify test <provider>

Subscribe to a subset in each provider's *_EVENTS CSV, or use * for every event.

Payload

Each notification carries:

  • event — the event name
  • stack — stack name (when known)
  • env — environment name (when known)
  • Event-specific fields (e.g. type=postgres for backup.success)

The generic webhook receives this as JSON via POST. Slack and Discord providers format it into a human-readable message.

Testing Providers

strut notify test slack
strut notify test discord
strut notify test webhook

Each sends a single test.ping event through the named provider, using whatever is configured in notifications.conf. Fails loudly if the webhook URL isn't set.

Dry Run

Under --dry-run, strut emits a [notify:dry-run] event=<name> payload=… line to stdout instead of hitting the network. Useful for verifying event firing without spamming a channel.

Relationship to Monitoring

The Monitoring page covers Prometheus / Grafana / Alertmanager — a full self-hosted observability stack. Notifications here are a lightweight alternative: per-event pings straight from strut commands, no extra infrastructure. Use both together if you want both deploy pings and ongoing metric alerts.

Related

  • Monitoring — Prometheus-based alerting with richer alert routing
  • Lifecycle Hooks — drop into user scripts for custom notification logic

Clone this wiki locally