1.0.25 • Published 6 years ago

@johnwatkins0/node-autodeploy v1.0.25

Weekly downloads
-
License
ISC
Repository
github
Last release
6 years ago

node-autodeploy Build Status

Associate branches of a Git project with remote servers. Auto-sync your repository to the remote server over SSH. Useful for developers working with servers they have minimal control over.

Installation

Install the package in your project:

npm install --save-dev @johnwatkins0/node-autodeploy

.deploy-servers.js

Create a server config file, .deploy-servers.js in the project root. It should export a settings object like the example below:

module.exports = {
  master: {
    active: false,
    server: 'server-hostname',
    destPath: '/path/on/the/server/',
    username: 'username',
    srcPath: `${__dirname}/`
  },
  staging: {
    active: true,
    server: 'server-hostname',
    destPath: '/path/on/the/server/',
    username: 'username',
    srcPath: `${__dirname}/`
    port: 22
  }
};

Each object key should be identical to the name of the Git branch you want to associate with the server. In the example above, the staging deployment will run if the current Git branch is staging.

Settings

KeyTypeDescriptionOptional?
activeboolIf set to false, the deployment will never run.required
serverstringThe server hostname.required
destPathstringThe absolute path to the project's destination on the serverrequired
usernamestringA user with permissions to write to the destination directory on the server.required
srcPathstringThe absolute path to the source directory.required
portnumberThe port number through which to sink to the remove server.not required

.deploy-settings.js

Create a settings config file, .deploy-settings.js in the project root. This provides another JavaSript settings object to determine the behavior of the rsync command run by the script.

KeyTypeDescription
excludearrayAn array of glob strings representing files and folders that shouldn't be synced to the server.

Example:

module.exports = {
  exclude: [
    '.deploy*',
    '*.json',
    'src',
    '.git*',
    'package.json',
    'tests',
    '.eslintrc',
    'node_modules/'
  ],
};

Deploying

With the two settings files in place, execute the following in the project's root:

node node_modules/node-autodeploy

Or use the provided binary:

node node_modules/.bin/autodeploy

Or use an NPM script:

{
  "scripts": {
    "deploy": "autodeploy"
  }
}
1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago