1.2.2 • Published 4 years ago

deploy-restart v1.2.2

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

deploy-restart

Deploy an application to a remote Linux machine and restart a service using systemctl or other commands

Install it through:

npm i -D deploy-restart

This module executes three basic steps: 1. Stops a service 2. Copies files over SCP 3. Starts a service

Written in TypeScript. It uses two core node modules:

Usage

import { DeployRestart } from 'deploy-restart';

...

const deployRestart = new DeployRestart({
    user: 'john',
    host: '192.168.1.1',
    localPath: '/home/john/app/dist',
    remoteDeployPath: '/home/remote/services/app',
    restart: true,
    serviceName: 'app'
});

try {
    await deployRestart.start();
} catch (e) {
    console.error(e);
}

The start method resolves with void and rejects with the following object:

{
    stopServiceStatus: boolean;
    deployStatus: boolean;
    startServiceStatus: boolean;
    error: any; //Error thrown by the step that fails
}

Options

NameTypeRequired
userstringYes
hoststringYes
localPathstringYes
remoteDeployPathstringYes
privateKeyPathstringNo
passwordstringNo
restartbooleanNo

If restart is true, then the following applies:

NameDefaultTypeRequired
serviceNamestringYes if serviceStartCommand and serviceStopCommand are not provided
serviceStartCommandsudo systemctl start serviceNamestringYes if serviceName is not provided or if serviceStopCommand is provided
serviceStopCommandsudo systemctl stop serviceNamestringYes if serviceName is not provided or if serviceStartCommand is provided

In other words, you may either pass serviceName that will be executed as sudo systemctl start serviceName or pass both serviceStartCommand and serviceStopCommand to use your own commands.

License

MIT

1.2.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago