n8n 'Deploy notify' workflow and heartbeat #4
Labels
No labels
auto-update
blocked
dependency
major
release-blocker
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
You do not have permission to read 1 dependency
Reference
Wi3eDigital/laravel-deploy-actions#4
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
notifyaction posts deploy events to one generic n8n workflow that forwards them to Signal. The same workflow watches heartbeats so a silently broken schedule is noticed.Plan: https://forgejo.entwirr.me/Wi3eDigital/laravel-deploy-actions/src/branch/main/docs/plan.md (section "Notifications").
Tasks
POST, header auth onX-Notify-Token(the credential is created by the owner, not in this issue)schema: 1, required fields per the plan)dedup_keyalready seen in the last 24h, stored in an n8n data tableinfoevents are logged only, exceptdeploy.succeededforenv: prod;warnandcriticalare sentheartbeatevents per repo (last seen) in a data tableheartbeatfor more than 2 daysAcceptance criteria
X-Notify-Tokenare rejectedschemaare rejected or logged, not sentdedup_keywithin 24h is sent onceinfoevents are not sent, except proddeploy.succeededBlocked by
Nothing (the payload schema is fixed in the plan). Owner: create the n8n header auth credential.
n8n workflows built (unpublished)
Both live in the personal project root (next to "PHP security patch watcher"). Neither is published yet.
d9Tw3FIqnGOjfvG0POST /webhook/deploy-notify(production URLhttps://n8n.entwirr.me/webhook/deploy-notify), header authDQvPEV7oHPAgpdmvPayload contract: docs/plan.md, "Notifications"
Data tables (same project):
deploy_notify_seen(kSYCGXG8hD16I6BJ): dedup_key, event, project, last_seen_atdeploy_notify_heartbeat(7zXqeREjuJRMalDr): project, repo, last_heartbeat_at, last_event, plusstale_alerted_at. I added that column so a stale repo gets one alert, not one per check run.How Deploy notify works
schema === 1event,severity,projectandtitleare non-empty stringseventandseverityare values from the plan's listsreasonsis an array, if present{accepted:false, errors:[...]}and nothing is sent. A valid one gets 202{accepted:true}straight away, then processing continues.heartbeatevent is upserted intodeploy_notify_heartbeat, keyed onproject.last_heartbeat_atis the n8n receive time, not the clientts. Heartbeats are never sent.dedup_keyindeploy_notify_seen. If the key was seen within 24h, the event is dropped.warnandcriticalare always sent.infois only sent fordeploy.succeededwithenv: prod. Every otherinfoevent is logged in the execution and not sent./v2/send, with the same sender and recipient set in theConfignode, and no credential. Thededup_keyrow is upserted after the send. The message format is:Heartbeat check
aevana, slight-exposure, kima-portal, kima, kardeema, homepage. The list lives in theConfignode (projects) and is also written in the workflow description.last_heartbeat_atis more than 2 days old. It is alerted again only after a newer heartbeat arrives and then goes stale again. Projects that have never sent a heartbeat are not alerted daily, so repos that haven't been rolled out yet stay quiet.Test results
All tests were manual MCP test runs. Both Signal send nodes were pinned in every run, so no real Signal message was sent. The data table nodes ran against the real tables.
deploy.failedprod[CRITICAL] test-notify prod v0.0.1: Deploy failed+ body + 2 reason bullets + urldedup_key)deploy.succeededstagingdeploy.succeededprodpromote.duedeploy_notify_heartbeat, no lookup and no sendschema: 2, unknown event, no title)stale_alerted_atwritten on the matching rowtest-notifyrow was ignoredX-Notify-TokenTest rows left in the tables (out-of-scope project
test-notify, so they never alert):deploy_notify_seen:test:deploy.failed:v0.0.1,test:deploy.succeeded:prod:v0.0.2,test:promote.due:v0.0.3deploy_notify_heartbeat:test-notifyThey can be deleted in the n8n UI.
Owner TODO
X-Notify-Tokenand a random value as the token.DEPLOY_NOTIFY_URL=https://n8n.entwirr.me/webhook/deploy-notifyDEPLOY_NOTIFY_TOKEN= the token value