{"id":20511395,"url":"https://github.com/friedrith/pm2-deployer","last_synced_at":"2026-04-21T06:07:13.940Z","repository":{"id":72463737,"uuid":"81809139","full_name":"friedrith/pm2-deployer","owner":"friedrith","description":"deployer to manage pm2 applications hosted on github or bitbucket","archived":false,"fork":false,"pushed_at":"2018-05-13T15:18:58.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T09:07:42.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/friedrith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-13T09:46:09.000Z","updated_at":"2018-11-28T18:17:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d71eb4f-fe9e-4ada-b4e0-e0dcd3844a46","html_url":"https://github.com/friedrith/pm2-deployer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fpm2-deployer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fpm2-deployer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fpm2-deployer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedrith%2Fpm2-deployer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/friedrith","download_url":"https://codeload.github.com/friedrith/pm2-deployer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242117660,"owners_count":20074433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T20:35:52.034Z","updated_at":"2026-04-21T06:07:08.906Z","avatar_url":"https://github.com/friedrith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pm2-deployer\n\nIt is a tool to easily deploy web applications managed by pm2 and hosted on github or bitbucket. It catches webhooks in order to automatically redeploy the webapps.\n\nMoreover, it integrates a standalone proxy in order to avoid nginx installation for small projects.\n\n## Get started\n\n```bash\n$ git clone https://github.com/thibaultfriedrich/pm2-deployer.git\n\n# update the file config.yaml in order to define all apps (config.yaml is a pm2 config file with little retrocompatible improvements).\n# always keep app pm2-deployer, otherwise pm2-depoyer will not be started by pm2\n\n# for all apps\n$ git clone \u003crepository\u003e\n$ cd \u003crepository path\u003e\n$ npm install \u0026\u0026 npm run build\n$ cd ../\n\n\n# finally\n$ cd pm2-deployer\n$ npm install \u0026\u0026 npm run build\n$ pm2 start config.yaml # start all applications\n```\n\n\n## Configuration\n\nA example of the config file is [here](examples/config.yaml). This file is also used by pm2 to manage the web applications. So you only need one config file for **pm2** and **pm2-deployer**.\n\n### Base\n\nWe encourage you to get this web application folders architecture :\n\n```\n+ pm2-deployer\n  \u003e config.yaml\n  \u003e package.json\n  \u003e ...\n+ web app 1 # directly cloned from its repository\n+ web app 2\n+ web app 3\n```\n\nIn this configuration, your config.yaml should begin like that:\n```yaml\nbase: ../\n```\n\n### Github\n\nIf your web applications are hosted on github, you may want to catchs the pushes on your git to automatically redeploy your app after the pushes. So you have to define a token in the config.yaml.\n\n```yaml\ngithub:\n  token: \u003cyour token\u003e # on linux, you can use command echo $(date)$(uname -a) | md5sum to generate a token\n```\n\nThen on your github repository, go to Settings \u003e Webhooks \u003e Add webhook and use the following configuration :\n\n* Payload URL: `\u003chost to your pm2-deployer\u003e/webhook/github/\u003cweb app 1\u003e`\n* Content type: `application/json`\n* Secret: \u003cyour token\u003e\n\n\u003e For now, this configuration expects that your github repository is fully public.\n\n### Bitbucket\n\nIf your web applications are hosted on bitbucket, you may want to catch events on your git to automatically redeploy your app after the pushes. So you have to define a token in the config.yaml.\n\nExactly as github, you can specify a token in the config.yaml. Besides, you can also specify a ssh key to access the repository\n\n```yaml\nbitbucket:\n  token: \u003cyour token\u003e\n  ssh_key: \u003cpath to a rsa private key relatively to the config.yaml path\u003e\n```\n\nThen on your bitbucket repository, go to Settings \u003e Webhooks \u003e Add webhook and use the following configuration:\n\n* Title: whatever you want\n* URL: `\u003chost to your pm2-deployer\u003e/webhook/bitbucket/\u003cweb app 1\u003e/\u003ctoken\u003e`\n* Status: checked\n* SSL/TLS: checked if your pm2-deployer is accessible with https\n* trigger: Repository Push\n\n\nIf your bitbucket repository is private, you need to define a ssh key to be enabled to pull and get the new version of your web application.\n\nGenerate the ssh key in the server hosting **pm2-deployer** with command `ssh-keygen -N \"\" -f ssh_rsa` (you need to use empty passphrase). Then add the public key in the bitbucket repository as access keys : got to Settings \u003e Access keys \u003e Add key.\n\n\u003e At the opposite of github, it works for private repositories on bitbucket\n\n### Slack\n\nYou may be notified if deployment succeeded or failed on slack.\n\nOn slack, go to App \u0026 integrations \u003e Build \u003e Start Building.\n\nChoose a name and the team then go to Incoming Webhooks \u003e On \u003e Add a New Webhook to Team.\n\nFinally choose your channel then click on Authorize.\n\n\nOn **pm2-deployer**, use the following configuration:\n\n```yaml\nslack\n  hook_url: \u003chook_url\u003e\n  name: \u003cthe notifications will be send with this name\u003e\n  channel: \u003cthe channel previously chosen\u003e\n```\n\n\n### apps\n\nThen you need to set the configuration of your web applications:\n\n```yaml\napps:\n  # for each app\n  -name: \u003cweb app1\u003e # the same name used in the webhook, and used as the folder name of the application\n  repo: \u003curl of the repository\u003e # not used for now\n  branch: \u003cbranch name\u003e # the branch we detect the pushes\n  script: \u003cthe path to your node.js script entrance\u003e\n  url: \u003cthe web application 1 is accessible through this url\u003e # for the slack notification\n  env: # defines the environment variables needed by the web application 1\n    PORT: \u003cport\u003e # the port of your web application\n    NODE_ENV: production # etc\n    # ...\n```\n\n**In order to redeploy your web app, pm2-deployer calls command `npm run build`. So be sure to compile your web app with this npm script.**\n\n### proxy\n\n**pm2-deployer** is used to detect pushes on repositories but since **pm2-deployer** has access to a lot of information, **pm2-deployer** may be also used as a proxy for all your web applications managed by pm2 and **pm2-deployer**.\n\nYou might use nginx as proxy for web application for significant traffic but **pm2-deployer** proxy is easier to use for small traffic because you need only one config file to manage pm2, deployment and proxy.\n\nIn order to do it, you only need to add environment variables to your **pm2-deployer** :\n\n* PORT_PROXY: \u003cport accessible from outside\n* PROXY: 'true'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedrith%2Fpm2-deployer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffriedrith%2Fpm2-deployer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedrith%2Fpm2-deployer/lists"}