Am using the DigitalOcean OpenLiteSpeed NodeJS image from marketplace for setting up the Droplet, for running my NextJS app.
I have setup everything and when tested, the home page was displaying properly. When I clicked the Login button (that uses NextAuth v4) it was throwing an issue because of another package. So using yarn
, I removed the package and re-installed it.
So after installation, I ran the yarn build
(that executes next build
command) and build was generated. But my question is, how do I restart the app? Will doing the Graceful Restart from the Litespeed admin console (https://myserverip:7080) is fine? I didn't done anything with the PM2
. I mean I followed this video tutorial for deploying the NextJS app in the droplet: https://www.youtube.com/watch?v=IktnuT9UgbM and he didn't mentioned anything about the PM2
Let me know your thoughts. If this isn't the correct forum, please feel free to move this question that best suits. Thanks
In a droplet, you can run
npm run start
. However, this forces you to leave the console open for the app to continue running.Enter pm2. pm2 allows you to run the app in the background and allows you to persist the command if the droplet is rebooted (run on startup). So to restart the app, you run
pm2 restart
to restart whatever apps are configured. Runpm2 status
to check what apps are configured and their status(es).OLS is a web server like apache or nginx, which just controls what the public has access to... a Graceful Restart on OLS just allows you to pickup any changes made to OLS. It will not affect your app.