-
-
Save wkei/6d984c47da980fd954bc05029f626800 to your computer and use it in GitHub Desktop.
Basic PM2 Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export SERVER_USER=xxyy | |
export SERVER_IP=xxx.yyy.xxx.yyy | |
export PROJECT_PATH=/home/user/xxyy | |
export PORT=4321 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "xxyy", | |
"version": "1.0.0", | |
"license": "MIT", | |
"scripts": { | |
"start": "nodemon app.js", | |
"setup": "source ./env && pm2 deploy ./pm2.config.js production setup", | |
"addenv": "source ./env && scp ./env $SERVER_USER@$SERVER_IP:$PROJECT_PATH/source/env", | |
"deploy": "source ./env && pm2 deploy ./pm2.config.js production" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
apps: [{ | |
name: 'xxyy' | |
}], | |
deploy: { | |
production: { | |
user: process.env.SERVER_USER, | |
host: process.env.SERVER_IP, | |
path: process.env.PROJECT_PATH, | |
repo: '[email protected]:xx/yy.git', | |
ref: 'origin/master', | |
'post-deploy': 'source ./env && yarn && pm2 startOrRestart ./pm2.config.js --env production', | |
env: { | |
NODE_ENV: 'production', | |
PORT: process.env.PORT | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment