-
Notifications
You must be signed in to change notification settings - Fork 1k
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 global #5286
Pm2 global #5286
Conversation
✅ Deploy Preview for redwoodjs-docs canceled.
|
}, | ||
skip: () => !yargs.restart, | ||
}) | ||
if (serverConfig.pm2Global) { |
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.
Rather than repeating these entire commands when only a couple of things change, what if just simplify it into setting the name of the command and the options first, then run the command once but using those vars for the settings? Something like:
// assume local install
let command = 'yarn'
let startOptions = ['pm2', 'start', 'ecosystem.config.js', '--only', process]
let restartOptions = ['pm2', 'restart', process]
let saveOptions = ['pm2', 'save']
if (serverConfig.pm2Global) {
command = 'pm2'
startOptions.shift()
restartOptions.shift()
saveOptions.shift()
}
tasks.push({
title: `Starting ${process} process for the first time...`,
task: async (_ctx, task) => {
await sshExec(ssh, sshOptions, task, serverConfig.path, command, options)
},
skip: () => !yargs.restart,
})
// save...
// restart...
Were you able to test these changes on your project? Could you deploy with a global pm2 and a local pm2? |
You know, as I'm working on this PR I'm coming to realize that I may need to require everyone to install pm2 globally! I'm looking at adding a symlink to the current deployed version of the repo, and the only way this will work is if I execute Would you be totally bummed if I ended up having to do that? It means we'd just close this PR. 😬 Sorry about that, I didn't realize until I was deep into my changes! |
no worries at all. Im just here to learn and help make the project better. If that means we end up discovering better/different ways of doing things im all for it! Im going to close with this comment. Please tag me if there is anything i can collaborate on. Have a great weekend! |
Adds configuration option (defaults to false) and necessary code to use pm2 "globally" instead of "locally", if needed