PM2 module to process webhooks and update your project realtime. Supports multiple ports and pathes.
You must have pm2 installed. Just add module
pm2 install pm2-webhook
Your repository page → Settings → Webhooks & services → Add webhook
Field | Value |
---|---|
Payload URL | http://example.com:23928/webhook |
Content Type | application/json |
Secret | SECRET |
Add environment variables in your ecosystem.json file. Only WEBHOOK_PORT
variable is mandatory.
{
"apps": [
{
"name": "app",
"env": {
"WEBHOOK_PORT": 23928,
"WEBHOOK_PATH": "/webhook",
"WEBHOOK_SECRET": "SECRET"
},
...
},
...
]
}
Restart your processes with pm2 startOrGracefulReload ecosystem.json
.
That's it. Each time you push to your repository, this module runs pm2 pull <app name>
.