Score:0

Litespeed - NextJS app in DigitalOcean Droplet - Restart Custom Server

cn flag

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

Score:0
pk flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.