@aptoma/node-codedeploy

4.0.0 • Public • Published

@aptoma/node-codedeploy

Bash scripts for deploying node apps with AWS CodeDeploy the aptoma way.

App Requirements

The following is required for the app that should be deployed

  1. pm2 config must exist in <app root>/config/pm2.json
  2. pm2.json must contain "cwd": "/var/services/app"

Installation

Install this module in your application

npm install @aptoma/node-codedeploy

Copy appspec.yml to your application root dir

cp nodemodules/@aptoma/node-codedeploy/appspec.yml .

Create a pm2 config in config/pm2.json

[{
	"name": "my-app",
	"script": "./src/server.js",
	"exec_mode": "cluster",
	"cwd": "/var/services/app",
	"out_file": "/var/log/aptoma/my-app.out.log",
	"error_file": "/var/log/aptoma/my-app.err.log",
	"kill_timeout": 2300
}]

Setup custom environment variables in scripts/deploy/env.sh

#!/bin/bash

export MONGO_URI=`getCredential "my-app" "mongo_uri"`
export CRYPTO_KEY=`getCredential "my-app" "crypto_key"`

Credstash credentials

There is a helper function available for getting credstash credentials. Using this requires that credential keys are using the following form service.<appname>.<environment>.<key>

Example of scripts/deploy/env.sh

#!/bin/bash

export MONGO_URI=`getCredential "my-app" "mongo_uri"`

Readme

Keywords

Package Sidebar

Install

npm i @aptoma/node-codedeploy

Weekly Downloads

22

Version

4.0.0

License

MIT

Unpacked Size

7.81 kB

Total Files

9

Last publish

Collaborators

  • aptoma