@aptoma/node-codedeploy
v4.0.0
Published
AWS CodeDeploy scripts for deploying Node apps
Downloads
66
Readme
@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
- pm2 config must exist in
<app root>/config/pm2.json
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"`