# pm2-deploy

> Deployment system for PM2

Latest version **1.0.2** (published 2020-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install pm2-deploy
pnpm add pm2-deploy
yarn add pm2-deploy
bun add pm2-deploy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-04-13 |
| First published | 2014-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 2 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 180 |
| Author | Alexandre Strzelewicz |
| Maintainers | tknew, vmarchaud |

## Links

- npm: https://www.npmjs.com/package/pm2-deploy
- Repository: https://github.com/Unitech/pm2-deploy
- Homepage: https://github.com/Unitech/pm2-deploy#readme
- Issues: https://github.com/Unitech/pm2-deploy/issues
- npm.io page: https://npm.io/package/pm2-deploy

## Dependencies (2)

- [tv4](https://npm.io/package/tv4.md) ^1.3.0
- [run-series](https://npm.io/package/run-series.md) ^1.1.8

## Recent versions

- 1.0.2 (latest) — 2020-04-13
- 0.3.1 (next) — 2016-05-27
- 1.0.0 — 2020-04-13
- 1.0.1 — 2020-04-13
- 0.4.0 — 2018-12-27
- 0.3.10 — 2018-07-17
- 0.3.9 — 2017-12-03
- 0.3.8 — 2017-09-28
- 0.3.7 — 2017-08-25
- 0.3.6 — 2017-08-16
- 0.3.5 — 2017-02-01
- 0.3.4 — 2017-01-19
- 0.3.3 — 2016-10-26
- 0.3.2 — 2016-10-26
- 0.3.1-1 — 2016-05-27
- … 10 more at https://npm.io/package/pm2-deploy/versions

## README

# Deploy system for PM2

This is the module that allows to do `pm2 deploy`.
Documentation: http://pm2.keymetrics.io/docs/usage/deployment/

[![build status](https://badgen.net/travis/Unitech/pm2/master)](https://travis-ci.org/Unitech/pm2-deploy) [![npm package version](https://badgen.net/npm/v/pm2-deploy)](https://npm.im/pm2-deploy) [![install size](https://badgen.net/packagephobia/install/pm2-deploy)](https://packagephobia.now.sh/result?p=pm2-deploy) [![github license](https://badgen.net/github/license/Unitech/pm2-deploy)](https://github.com/Unitech/pm2-deploy/blob/master/LICENSE) [![js semistandard style](https://badgen.net/badge/code%20style/semistandard/pink)](https://github.com/Flet/semistandard)

## Instalation

    $ npm install pm2-deploy

## Programmatic Usage

```js
var deployForEnv = require('pm2-deploy').deployForEnv;

// Define deploy configuration with target environments
var deployConfig = {
  prod: {
    user: 'node',
    host: '212.83.163.168',
    ref: 'origin/master',
    repo: 'git@github.com:Unitech/eip-vitrine.git',
    path: '/var/www/test-deploy'
  },
  dev: {
    user: 'node',
    host: '212.83.163.168',
    ref: 'origin/master',
    repo: 'git@github.com:Unitech/eip-vitrine.git',
    path: '/var/www/test-dev'
  }
};

// Invoke deployment for `dev` environment
deployForEnv(deployConfig, 'dev', [], function (err, args) {
  if (err) {
    console.error('Deploy failed:', err.message);
    return console.error(err.stack);
  }
  console.log('Success!');
});

// Rollback `prod` environment
deployForEnv(deployConfig, 'prod', ['revert', 1], function (err, args) {
  if (err) {
    console.error('Rollback failed:', err.message);
    return console.error(err.stack);
  }
  console.log('Success!');
});
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [deployForEnv](#deployforenv)
    -   [Parameters](#parameters)
-   [DeployCallback](#deploycallback)
    -   [Parameters](#parameters-1)

### deployForEnv

Deploy to a single environment

#### Parameters

-   `deployConfig` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** object containing deploy configs for all environments
-   `env` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the environment to deploy to
-   `args` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** custom deploy command-line arguments
-   `cb` **[DeployCallback](#deploycallback)** done callback

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** return value is always `false`

### DeployCallback

Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)

#### Parameters

-   `error` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** deployment error
-   `args` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** custom command-line arguments provided to deploy

---
_Source: https://npm.io/package/pm2-deploy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
