Re-deployment of next.js apps

Hi. I am a new user of Linode. I plan to use it primarily to host websites made with next.js, including the required databases.

I plan to use a combination of an ubuntu distribution, nginex and pm2 to serve the next.js apps and I believe that I can setup the system easily for the initial deployment (I am doing it already on my current server), but I am not sure of how to do efficient (i.e. automated) re-deployments when my apps change in the future. Currently, I ssh to the server, stop pm2, rebuild the next.js app and restart it with pm2.

This is Ok during development, but it is not acceptable in production.

Ideally, I would like to have a staging server and the ability to quickly roll-back to the previous working version if there are problems.

I would appreciate suggestions.

Thank you very much in advance.

1 Reply

I would suggest you look into configuring a CI/CD pipeline. Continuous Integration and Continuous Delivery software will allow you to do everything you mentioned.

Linode has created the following content which explores the topic of CI/CD:

All of these tools require the use of Version Control software such as Git to manage deployments.

There are many CI/CD platforms and tools available, some of which I have listed below:

This blog post which outlines how to use Github Actions to deploy a Next.js app might be useful as well:

Lastly, PM2 has a deployment system built-in with the ability to update and revert deployments:

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct