0.4.1 • Published 1 year ago

sftp-deployer v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

sftp-deployer

Build status

Version

A command-line tool for lightning-fast SFTP deployments.

  • Transfers a directory as a single compressed file
  • Minimizes downtime of target directory with blue/green deployment

SFTP deployer demo

Install

You need Node.JS to use sftp-deployer.

npm install -g sftp-deployer

Usage

The following command uploads the contents of the ./build directory to a remote SSH host, to /var/www/build:

sftp-deployer --host example.com \
  --user bob \
  --key private_key.pem \
  --local ./build \
  --target /var/www/build

Available options:

  -V, --version                output the version number
  -c, --config <config file>   configuration file to use (default: ".sftp.json")
  -h, --host <host>            hostname to connect to
  -p, --port <port>            SSH port to use (defaults to 22)
  -u, --user <username>        the ssh username
  -k, --key <key_or_file>      path to private key file, or private key itself
  --password <password>        the password to the private key
  -l, --local <path>           directory to upload
  -t, --target <target_dir>    target directory on remote host
  -s, --staging <staging_dir>  staging directory on remote host
                               (defaults to the target directory + .staging)
  -u, --upload <upload_dir>    upload directory on remote host
                               (default: "/var/tmp")
  --help                       display help for command

Using a configuration file

Each of the options listed above may also be specified in a configuration file called .sftp.json. You may override this filename by using the -c option (see above).

For example:

{
  "host": "example.com",
  "port": 1234, /* Optional, defaults to 22 */
  "user": "bob"
  "key": "private_key.pem"
  "password": "super_secure", /* Optional, only needed if the key is encrypted */
  "local": "./build",
  "target": "/var/www/build",
  "staging": "/var/www/incoming/uploads", /* Optional, defaults to target directory + .staging */
  "upload": "/my/upload/dir" /* Optional, defaults to /var/tmp */
}

You may then simply invoke sftp-deployer and it will take its input from the .sftp.json file in the current working directory.

Blue/green deployment

When a directory is uploaded but a target directory already exists, the following steps are taken to minimize downtime:

  • Deploy new directory to a staging location
  • Swap staging location and target location

This makes sure that the target directory is only down for a couple of milliseconds.

0.3.7

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago