-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pm2 config #9
Pm2 config #9
Conversation
- run prettier script to format all the files - run eslint script to fix linting errors
- setup scripts to initialize node app in development and production mode using pm2 - create pm2 config file (ecosystem.config.js)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to change the build commands in the workflows after this pm2 configuration?
@@ -0,0 +1,22 @@ | |||
module.exports = { | |||
apps: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we need 3 apps configurations, for staging, prod and PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes yes, I am working on this finding some suitable settings for the corresponding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need three configs for PM2 ecosystem config? You can have same app config used in all three environments na?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have different env and app name for all 3. And that env's are subject to change during development time so was planning to have everything separate for now. Can keep one after the first production release.
Yes, we do need to update them, How about after this is all set up, you create a PR which would then set up the workflows for the remaining environments. I'll keep the original run/build commands as well so that this wont affect the current staging after merger. |
Yo sounds great 🦾 |
You may need to change the app name as well, I am quite unsure about the spacing in the app name 🤔 |
nah nah.... I'm pretty sure we can name with a space. |
@@ -0,0 +1,22 @@ | |||
module.exports = { | |||
apps: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need three configs for PM2 ecosystem config? You can have same app config used in all three environments na?
"start:dev": "npx pm2 startOrGracefulReload ecosystem.config.js --env development", | ||
"start:stage": "pm2 startOrGracefulReload ecosystem.config.js --env staging", | ||
"start:prod": "pm2-runtime ecosystem.config.js --env production", | ||
"stop": "npx pm2 stop ecosystem.config.js && npx pm2 delete ecosystem.config.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling a command stop and then deleting ain't good
{ | ||
name: 'Aptiche Server', | ||
script: './dist/index.js', | ||
watch: false, | ||
instances: 1, // TODO: change to max for production | ||
exec_mode: 'cluster', | ||
max_memmory_restart: '500M', | ||
time: false, | ||
error_file: './logs/pm2-err.log', | ||
out_file: './logs/pm2-out.log', | ||
log_file: './logs/pm2-app.log', | ||
combine_logs: false, | ||
kill_timeout: 2000, | ||
min_uptime: '1m', | ||
max_restarts: 5, | ||
restart_delay: 1000, | ||
autorrestart: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a thing known as an exponential back-off restart. Use that.
I see that is watch is false here, what do you plan for development phase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Planning not to use pm2 during dev but will include this if you suggest.
Your checklist for this pull request
🚨Please review the guidelines for contributing to this
repository.
(right side). Don't request your default branch!
(left side). Also you should start your branch off default branch.
requested structure.
test.
Description
Configure pm2 for development and production.
Please describe your pull request.
❤️Thank you!
Post merge checklist
this repository.
maintainers will add you to all-contributors list.