1.0.5 • Published 5 years ago

grunt-hoist v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

grunt-hoist

Code Climate Code Climate issues badge David badge

This repository contains the source code for a suite of Grunt tasks to deploy Node.js apps to hosts and execute related remote procedures.

Setup

To include this module in your package, simply run:

npm install grunt-hoist --save-dev

Environment variables

The following environment variables are managed by Park Ranger and expected by tasks:

NameRequiredDescriptionExample
HOIST_DEST_HOSTyesHostname of remote serverexample.com
HOIST_DEST_DIRyesDirectory on remote server for deployment of files/var/www/app
HOIST_DEST_USERyesUser name for authentication to remote serverwebmaster
HOIST_SYSTEMD_SERVICEno  Name of systemd service to start or restart upon deploy-appmyapp

Additionally, the ENV_NAME variable used by Park Ranger is optionally used to determine filenames for app dependencies per below.

App files

The following files located in the parent repository directory are deployed upon app deployment, as available:

  • index.js
  • Gruntfile.js
  • package.json

After these app files are deployed, dependencies are automatically loaded on the host using two methods. The first is simply to call npm install --production to install dependencies that can be sourced from npm. The second is to copy all local dependencies listed in the parent repository's package with the file:../ prefix to the parent directory of HOIST_DEST_DIR on the host to ensure their availability.

If the HOIST_SYSTEMD_SERVICE environment variable is available, a systemd service with corresponding name on the host will also be restarted or started, depending on its current runtime status.

App dependencies

Certain files and directories in the parent repository directory are treated as app dependencies to be deployed given their filenames, as available.

These dependencies include those for environment variables (e.g. .env), configurations (e.g. .config.json) and SSL certificates (e.g. .cert). Their source and destination filenames are determined using both the ENV_NAME environment variable and a standard -deploy suffix. If no ENV_NAME value is available, they are located using just the suffix.

The following describes how file and directory names would be mapped with ENV_NAME available as value "example":

SourceDestination
.cert-example-deploy.cert-example
.config-example-deploy.json.config-example.json
.env-example-deploy.env-example

And the following describes how they would be mapped without an ENV_NAME value available:

SourceDestination
.cert-deploy.cert
.config-deploy.json.config.json
.env-deploy.env

Note that the destination value is relative to the directory on the host indicated by HOIST_DEST_DIR. The source value is relative to the parent repository base directory.

Scripts

Installation of this package as a dependency makes the following scripts available automatically:

CommandDescription
npm run deploy-allDeploys app and dependencies
npm run deploy-appDeploys app files
npm run deploy-dependenciesDeploys dependencies
1.0.5

5 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