Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Pm2 global #5286

wants to merge 5 commits into from

Conversation

@netlify
Copy link

netlify bot commented Apr 22, 2022

Deploy Preview for redwoodjs-docs canceled.

Name Link
🔨 Latest commit c1a412d
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/626244ce8d99d100084ce28a

@thedavidprice thedavidprice added the release:fix This PR is a fix label Apr 22, 2022
},
skip: () => !yargs.restart,
})
if (serverConfig.pm2Global) {
Copy link
Member

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...

@cannikin
Copy link
Member

Were you able to test these changes on your project? Could you deploy with a global pm2 and a local pm2?

@cannikin
Copy link
Member

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 pm2 from the parent directory that contains all of the actual code. So yarn pm2 wouldn't work from that location.

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!

@zpeters
Copy link
Contributor Author

zpeters commented Apr 23, 2022

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!

@zpeters zpeters closed this Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
No open projects
Status: Archived
Development

Successfully merging this pull request may close these issues.

4 participants