pm2/doc/PULL.md
2014-11-21 16:38:02 +01:00

1.8 KiB

Manage your repository (revision control)

For each app started with PM2, if a revision control system exists, pm2 will recognize it. You can see metadata about the repository:

$ pm2 info <app name|app id>

Metadata

You can switch between previous and next commit:

$ pm2 backward <app name>

Switches your local repository to the previous commit if there is one.

$ pm2 forward <app name>

Switches your local repository to the next (more recent) commit if there is one.

$ pm2 pull <app name> [commit ID]

Updates your local repository to the most recent remote commit for the current branch or to the optional specified commit ID.

Everytime a backward/pull/forward command is executed, pm2 checks in ecosystem.json, process.json and package.json (in that order) for commands to run (e.g. npm install). The field should be named post_update and should be an array of commands. Your file should look something like this :

{
  "apps" :
  [
    {
      "exec_interpreter"   : "node",
      "exec_mode"          : "cluser_mode",
      "instances"          : "max",
      "name"               : "my_app",
      "script"             : "app.js",
      "post_update"        : ["echo App has been updated, running npm install...",
                              "npm install",
                              "echo App is being restarted now"]
    }
  ]
}

For the moment it works with Git, Subversion and Mercurial.

Feature: metadata backward pull forward
Git
Subversion
Mercurial