1.0.5 • Published 7 years ago

ssh2deploy v1.0.5

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago

Simple deployment tool using SSH2

This tool is very lightweight and uses ssh2 (node-ssh) for deployment and exposes Promise.

1. install

npm install ssh2deploy --save-dev
var deploy = require('ssh2deploy');

2. connect

deploy.connect({
    cwd: '.',
    connect: { ... ssh2 connect options ...},
    exec: { pty: true }
})

You can use ssh2 connect options for connect and ssh2 exec options. Cwd is for base folder on target server.

3. copy files

deploy.connect(...)
.then(...)
.then(deploy.copy([
    '**/*.php',
    '!temp/',
    ...
]))

Copying to server is super-fast. It uses globby for file patterns and compress files to tgz for transfer. On target server it extracts files to cwd defined in connect method.

4. execute commands on server

deploy.connect(...)
.then(...)
.then(deploy.exec([
    'ls -la',
    'chmod -R 777 upload',
    ...
]))

It executes commands on the target server in cwd defined in connect method.

5. or do whatewer you want

deploy.connect(...)
.then(function (ssh) {
    // your custom code to execute
})

You can do whatewer you want. You get node-ssh2 instance from connect, copy and exec methods.

6. catch errors

deploy.connect(...)
.then(...)
.catch(function (error) {
    console.error('ERROR IN DEPLOYMENT: ', error.message);
})

7. disconnect

deploy.connect(...)
.then(...)
.then(deploy.disconnect())

Don't forget to disconnect when you are done.

8. PROFIT

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago