ci: deploy using pm2

* ci: pm2 configuration file

* ci: github action deploy preview

* ci: github action deploy production

* ci: env variables now pass to pm2
This commit is contained in:
2022-09-29 21:54:58 -05:00
committed by GitHub
parent 4f8c4f6492
commit a35e99f8ff
3 changed files with 125 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
module.exports = {
apps: [
{
name: process.env.APP_NAME,
script: 'npm',
args: 'start',
env: {
NODE_ENV: 'production',
PORT: process.env.PORT || 3000
}
}
],
deploy: {
production: {
user: process.env.SSH_USERNAME,
host: process.env.DEPLOY_HOST,
ref: 'origin/main',
repo: 'https://github.com/SrJuggernaut/entgamers_pro',
path: process.env.DEPLOY_PATH,
'pre-deploy': 'npm install && npm run build',
'post-deploy': 'pm2 startOrRestart ecosystem.config.js',
env: {
...process.env
}
},
preview: {
user: process.env.SSH_USERNAME,
host: process.env.DEPLOY_HOST,
ref: 'origin/preview',
repo: 'https://github.com/SrJuggernaut/entgamers_pro',
path: process.env.DEPLOY_PATH,
'pre-deploy': 'npm install && npm run build',
'post-deploy': 'pm2 startOrRestart ecosystem.config.js',
env: {
...process.env
}
}
}
}