All Projects → vmarchaud → pm2-githook

vmarchaud / pm2-githook

Licence: MIT license
receive webhook from github/gitlab and ask pm2 to reload the application for you

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pm2-githook

Skyhook
Parses webhooks and forwards them in the proper format to Discord.
Stars: ✭ 263 (+574.36%)
Mutual labels:  jenkins, gitlab, webhook, bitbucket
playwright-ci
☁️ Set up Playwright in CI
Stars: ✭ 27 (-30.77%)
Mutual labels:  jenkins, gitlab, bitbucket
Generic Webhook Trigger Plugin
Can receive any HTTP request, extract any values from JSON or XML and trigger a job with those values available as variables. Works with GitHub, GitLab, Bitbucket, Jira and many more.
Stars: ✭ 287 (+635.9%)
Mutual labels:  gitlab, webhook, bitbucket
Env Ci
Get environment variables exposed by CI services
Stars: ✭ 180 (+361.54%)
Mutual labels:  jenkins, gitlab, bitbucket
Git Deploy
Php Script for Auto-Pull in server (Using WebHook from GitLab, GitHub and Bitbucket)
Stars: ✭ 495 (+1169.23%)
Mutual labels:  gitlab, webhook, bitbucket
Git Auto Deploy
Deploy your GitHub, GitLab or Bitbucket projects automatically on Git push events or web hooks
Stars: ✭ 251 (+543.59%)
Mutual labels:  gitlab, webhook, bitbucket
deployserver
Deploy your project automatically when git branch was updated.
Stars: ✭ 24 (-38.46%)
Mutual labels:  module, webhook, bitbucket
froggit-go
Froggit-Go is a universal Go library, allowing to perform actions on VCS providers.
Stars: ✭ 19 (-51.28%)
Mutual labels:  gitlab, webhook, bitbucket
Gitwebhookproxy
A proxy to let webhooks reach running services behind a firewall – [✩Star] if you're using it!
Stars: ✭ 123 (+215.38%)
Mutual labels:  jenkins, gitlab, webhook
Hwamei
企业微信webhook,企业微信群机器人webhook,支持Github、Gitlab、Sentry等Webhook
Stars: ✭ 142 (+264.1%)
Mutual labels:  jenkins, gitlab, webhook
10-days-of-git-and-github
asabeneh.github.io/10-days-of-git-and-github/
Stars: ✭ 786 (+1915.38%)
Mutual labels:  gitlab, bitbucket
go-zero-looklook
🔥基于go-zero(go zero) 微服务全技术栈开发最佳实践项目。Develop best practice projects based on the full technology stack of go zero (go zero) microservices.
Stars: ✭ 2,691 (+6800%)
Mutual labels:  jenkins, gitlab
moadsd-ng
The MOADSD-NG project does provide a simple way to setup a hybrid cloud security demo, playground and learning environment within the clouds.
Stars: ✭ 13 (-66.67%)
Mutual labels:  jenkins, gitlab
gitcolombo
🧬 Extract and analyze contributors info from git repos
Stars: ✭ 55 (+41.03%)
Mutual labels:  gitlab, bitbucket
YappyGitLab
A GitLab monitor bot for Discord
Stars: ✭ 51 (+30.77%)
Mutual labels:  gitlab, webhook
pm2-docker
Monitor Docker Daemon (expose host docker daemon for monitoring)
Stars: ✭ 21 (-46.15%)
Mutual labels:  module, pm2
Containerization-Automation
Study and Use of Containers and Automation Tools
Stars: ✭ 45 (+15.38%)
Mutual labels:  jenkins, gitlab
git-the-lines
A Discord bot that prints out the lines referenced in a GitHub, GitLab, or BitBucket snippet link
Stars: ✭ 37 (-5.13%)
Mutual labels:  gitlab, bitbucket
caesar
持续集成
Stars: ✭ 40 (+2.56%)
Mutual labels:  jenkins, gitlab
epf-transmitter
astrizhachuk.github.io/epf-transmitter/
Stars: ✭ 32 (-17.95%)
Mutual labels:  gitlab, webhook

Description

PM2 module to receive http webhook from github, execute pre/post hook and gracefull reload the application using pm2.

Install

pm2 install pm2-githook

Configure

  • port (Defaults to 8888) : The port that will be used by the http server to receive hooks.

  • apps : Contains definition of applications in JSON :

      {
        "APP_NAME" : {
          "secret" : "supersecret",
          "prehook" : "npm install --production && git submodule update --init",
          "posthook" : "echo done",
          "errorhook" : "echo error",
          "service": "github"
        }
      }
    • APP_NAME is the name of the api in pm2 and in the url defined on github or gitlab (eg: : http://127.0.0.1:8888/APP_NAME).
    • secret is the secret you put in github/gitlab to verify that the transaction is made by github/gitlab.
    • prehook is the shell command executed in the cwd (care of this) of the app after the pull and before the gracefullReload.
    • posthook is the shell command executed in the cwd (care of this) of the app after making the gracefullReload.
    • errorhook is the shell command executed in the cwd (care of this) of the app if an error occurs.
    • service is the service used to make the http call (github is the default)
      • github : you'll need to set the same secret as defined in github (can specify branch)
      • gogs : (applies to forks such as gitea) you'll need to set the same secret as defined in gogs (can specify branch)
      • gitlab : you'll need to set the secret as the token defined in gitlab
      • jenkins : you'll need to set the secret as the ip of the jenkins (can specify branch)
      • bitbucket : secret not needed, bitbucket ip range is inside the code (can specify branch)
      • droneci : you'll need to set the secret to match the Authorization header defined inside the plugin (can specify branch)
    • nopm2 if set to true, we will not reload the application using pm2 (default to false)
    • cwd if provided we don't resolve the cwd using pm2 and will take this value (defaults to undefined)

(can specify branch) mean that you can use a addional configuration to run the posthook on a specific branch

How to set these values ?

After having installed the module you have to type : pm2 set pm2-githook:key value

To set the apps option and since its a json string, i advice you to escape it to be sure that the string is correctly set (using this kind of tool).

e.g:

  • pm2 set pm2-githook:port 8080 (bind the http server port to 8080)
  • pm2 set pm2-githook:apps "{\"APP_NAME\":{\"secret\":\"supersecret\",\"prehook\":\"npm install --production && git submodule update --init\",\"posthook\":\"echo done\",\"errorhook\":\"echo error\"}}"

Uninstall

`pm2 uninstall pm2-githook

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].