This was a really great tutorial, thank you for walking us through the steps. I already knew most of them, but needed a refresh, especially on the pm2 part. Keep up the great work!
I think Digital Ocean is going to be the best value and very easy. The interface is so clean and easy. Aws interface is very confusing and the pricing is complex. The servers may be similar in cost but with AWS there’s added cost to bandwidth which makes it even more elusive. If you’re scaling something massive AWS would be good if you will use other services . For most apps Digital Ocean is really nice.
Really good! I'm still getting over the fact that nextjs has to be built in situ. A build can always fail, so it seems very risky to overwrite your live site with some new code that needs to be built. Folk are likely handling this with containers but I think I'm going to try a blue/green strategy and switch the nginx config when the build has succeeded. I'm also a bit startled to see the PATH modified in the deployment pipeline. Why should I need to modify my pipeline every time my node version changes? I think I need a better solution there. God I wish we still had server guys.
There is a slight problem with this and it is that you cannot run build while running PM2 because building causes the files that are being served by PM2 to be modified, you have to copy them to another directory before hand, I think you can use `next build [directory to which you copied the files]` to fix this, otherwise awesome video! edit: use next JS standalone mode, not `next build [directory]`!
It means when you created the server you didn’t place your ssh key on the server. If creating from digital ocean you need to add the ssh key during the process of creating the server. If it’s not added when creating you won’t be able to login. You can delete the server and start over.
nvm, pm2 and npm should not be running as root, this is dangerous and asking for trouble. If anybody wants to follow this guide I really highly recommend that you create a separate user account for this and also for cloning and updating the code. Root is the Linux equivalent of an admin user and anything that does not require admin privileges should never run as root. If there is ever an RCE in your code or nextJS and you are running this setup the attacker has full admin access to your server. Create a sandboxed user account with limited privileges, a separate SSH key and read/write only allowed to their own files for every project, project A should not be able to read files from project B.
Your tutorials are absolute gold! Thank you so much! 😊
Wowza, thank you!
This was a really great tutorial, thank you for walking us through the steps. I already knew most of them, but needed a refresh, especially on the pm2 part. Keep up the great work!
The TH-cam algorithm brought this to me right when I needed it! getting myself a droplet and learning
Thanks for sharing an amazing tutorial 🙏. I was really searching for the perfect one, and it is well explained 🙌
Wow, best video I've ever watched on TH-cam! Congratulations!!!
Absolute gold man❤
You are back!! great news!
Thank you for the incredibly helpful content!
this content is legendary !
Very helpful content. Tnx so much! 🙏
Awesome tutorial! Any idea on how DigitalOcean pricing compares to AWS?
I think Digital Ocean is going to be the best value and very easy. The interface is so clean and easy. Aws interface is very confusing and the pricing is complex. The servers may be similar in cost but with AWS there’s added cost to bandwidth which makes it even more elusive. If you’re scaling something massive AWS would be good if you will use other services . For most apps Digital Ocean is really nice.
Thank you so much!
Really good! I'm still getting over the fact that nextjs has to be built in situ. A build can always fail, so it seems very risky to overwrite your live site with some new code that needs to be built. Folk are likely handling this with containers but I think I'm going to try a blue/green strategy and switch the nginx config when the build has succeeded. I'm also a bit startled to see the PATH modified in the deployment pipeline. Why should I need to modify my pipeline every time my node version changes? I think I need a better solution there. God I wish we still had server guys.
This is absolutely amazing... Been looking/waiting for this.
What about full stack with something like prisma?
Thank you!
Thanks! Yeah that's another wonderful aspect, you can put a database on the server too.
There is a slight problem with this and it is that you cannot run build while running PM2 because building causes the files that are being served by PM2 to be modified, you have to copy them to another directory before hand, I think you can use `next build [directory to which you copied the files]` to fix this, otherwise awesome video!
edit: use next JS standalone mode, not `next build [directory]`!
A good point. I haven’t run into a lot of issues in most cases but what you suggested is definitely best practice. Thank you!
LIFE SAVER ❤
sir i am facing this issue
ubuntu@13.200.235.21: Permission denied (publickey).
Error: Process completed with exit code 255.
It means when you created the server you didn’t place your ssh key on the server. If creating from digital ocean you need to add the ssh key during the process of creating the server. If it’s not added when creating you won’t be able to login. You can delete the server and start over.
something wrong with this. i tries to run two apps on same domain with subomains, but only one app runs on domain
Then what is the point of npm run build
mongodb in host bro !
Right! I'm all about mysql, but that's another cool thing about your own server, you can place the database on the same server! mongodb, or any other.
nvm, pm2 and npm should not be running as root, this is dangerous and asking for trouble. If anybody wants to follow this guide I really highly recommend that you create a separate user account for this and also for cloning and updating the code. Root is the Linux equivalent of an admin user and anything that does not require admin privileges should never run as root. If there is ever an RCE in your code or nextJS and you are running this setup the attacker has full admin access to your server. Create a sandboxed user account with limited privileges, a separate SSH key and read/write only allowed to their own files for every project, project A should not be able to read files from project B.
That is a good point. I believe I mentioned this the tutorial. Just kept root for the demo. Thank you for clarifying
The title reads 'Self host' - using Digital Ocean is not self hosting. How about using Ubuntu-server on a local machine to deploy a live Next.js app?
Digital ocean droplets are just ubuntu server under the hood, literally same thing, you can use this tutorial on any ubuntu server anywhere
@@haiffy yah it worked for me on my self hosted ubuntu. great tut