Btw, keep your sysadmin egos in check and just deploy using existing PaaS that manage all of this for you. I wouldn’t never host on a single VPS for a production system.
Feels like a lot of people don't know, and haven't tried both approaches or either. Its probably still worth people trying for the own learning experience, and to satisfy that thought of "I wonder if that way is better, I should try it". I've been messing around with a self-hosted PaaS called Caprover on a Oracle cloud VPS. Its good; better than just docker alone. There are some other similar software like Dokku and portainer. I just plan on using this to host a portfolio site + some small demo projects, static sites and maybe to quickly deploy test versions of apps I make in the future. But I agree with you; to me this is not a good idea for production, especially without some container orchestration tool like portainer. Seems too "involved" and now I am creeping into another job entirely. For example, I found myself googling so much to figure out how to secure the VPS, open and close ports, configure ip-tables, configure the VNIC on Oracle, and how to go about patching the operating system / dependencies. I don't see anything wrong with playing with this stuff and learning, but it just seems like I'd have to draw the line somewhere sooner, to focus more on the software development. Have you tried self-hosting a PaaS like caprover, dokku or portainer? it could be a nice in-between paying for a PaaS provider vs self-hosting on a VPS using docker. But these self-hosted PaaS don't have all the features that many PaaS providers have, like vercel and their edge functions.
We rent dedicated servers from Hetzner and use Kubernetes for container and cluster management. It saves us something like 95% compared to using AWS. It's an option for high, constant load infrastructure. Just something to keep in mind, though usually not very relevant for SaaS or such. But for low return per volume uses (eg ad supported sites) the difference is quite stark. Physical CPU cores can be 7-8x as fast as a VPS or cloud server vCore (and it doesn't fluctuate based on CPU usage of others sharing the server), and you typically don't have to pay for bandwidth per GB, so the math is really, really twisted. Just something interesting to keep in mind.
Thank you for tackling the mundane world of vps hosting, it is a very comprehensive video explanation of how to have a solid handle of a vps deployment.. Maybe you should do a video on how you prevent run-away cc charges on the serverless platforms you prefer to use. I think the nightmare scenarios we all have read online is what makes us stay away from serverless.
For Grafana+Loki, it's not as good for search as ELK (it doesn't have an inverted index full text search engine) but it is far faster and scales to ridiculous levels, while using much less storage. So if the goal is to dump a million log lines per hour into it, Loki is probably a better choice than Elastic. Otherwise, stick to ELK.
Even though I agree with your opinion on using existing PaaS instead of self-hosting, I still appreciate that you take the extra step to show how it would actually look like if you were to use a VPS instead. In my current workplace we are so few devs that we need to pretty much manage all aspects of the dev pipeline and one of the main reasons why we didn't go with self-hosting is because the complexity is so steep that teaching it to someone who has previously only worked with react-native stuff would just not be worth it. Much simpler to teach someone to do basic deployment to production and such if there is a friendlier interface to use e.g Hasura.
100%, rolling your own deployment solution means you better have great documentation for when the main people who set it up decide to leave the company and they hire someone who has to figure out how it was all hobbled together.
I dont understand how you use something like web sockets or cron jobs with serverless architecture. Do those things have to run on a VPS where its stateful? Could you touch on that a little?
I’d just use a third party websocket service, such as aws api gateway v2 or pusher. Or if you really want to you can just deploy the websocket server as a stand-alone service and have your api signal your socket server for sending out events. But yes, that’s the one down side of serverless, websockets are not easy anymore. For cron jobs, again I’d just use aws cloudwatch alarms and setup cron rules to invoke my serverless endpoints.
Thanks for the content. There is something i don't understand, i would appreciate it if you can explain: a 16gb RAM droplet on DigitalOcean would be $96 /mo, while a 32gb RAM Hostinger VPS would be $22 /mo. I don't quite understand the pricing difference, would i be just because hostinger is pre-paid instead of by usage?
You’d probably need to look at the hardware specs and read on perf benchmarks. DO might have much better cpu speeds or memory bus speeds. Hostinger only gives a big up front discount if you pay for a year up front, otherwise it’s $60/month.
This is so much appreciated, many thanks, I am coming to a point of where I am needing a place to host my site also, I was wondering have you already covered a docker and AWS setup on your channel?
Great explanation! May I ask why would anyone do this over using something like Vercel or Aws? This feels like it would take months to learn for someone new to devops/cloud. Id rather use a provider and actually work on building my application.
it's "cheaper" they say, but no one factors in the hours it'll take to configure, maintain, upgrade, monitor, automate, and scale their custom VPS solution so that they can only pay $5 / month. I easily wasted a few hours alone just trying to setup this ELK logging setup for this video. I spend an ENTIRE HOUR because I was using localhost instead of 127.0.0.1 somewhere in my configuration files.
Probably because theres some people out there that already have this experience acquired through many years and this is just the way they are comfortable building things.
@@dandogamer @WebDevCody Definately, I can see how it might be needed, if you had an enterprise app, where doing all this yourself can actually save money because you have so many users. Even then, there would be a whole team youd need to pay
Hi Cody, I’m sort of a beginner on devops/hosting thing. My question is, if I were to host my API on AWS Lambda, what do you think is the best option to deploy my React app? I’d like to make it all as cheap as possible
@@WebDevCody I see, would you recommend just using SST to deploy my full-stack app or still deploy the API on Lambda manually and then the Client app on SST?
@@yohance6904 if this is for a side project, I’d just use nextjs and deploy using sst. It makes it easier when the api and frontend are combine. If you can figure it out, you can also just write your api with express or nest, then use a wrapper to get the entire api deployed to a single lambda, that’s what we do at work.
@@WebDevCody so basically, for a side project just deploy all together on sst, if down to do something more professional(?), use a wrapper to deploy the api on a single lambda. If i wanted use a wrapper, which one do you recommend?
@@yohance6904 we use @vendia/serverless/express, then we zip it and deploy it to a lambda, then we hook it up to an api gateway. I haven’t done it with sst so idk if they have an example on that already or not
Besides creating a vps and using nginx or apache as a proxy server, what else is needed to upload website? Do you need to use docker or software like vscode?
The bare minimum is your node server and probably caddy or nginx in front of it on your machine. You’d have to figure out your own process to deploy updates. Docker compose makes it easier to just build an image, Publix it, then rerun docker compose up to deploy your updates
SST seems to be the real sweet spot, but I've never used AWS for db. Might be missing out. For that, I'd probably just use supabase or pay 15 bucks a month for a managed DB at linode. I never use planetscale because they dont have real relations which bugs me. great video man!
Hi Cody, I'm kind of a noob in this devops and hosting stuff, I have done some full stack projects but I have no idea where to host them, they are either react and express or nextjs, sometimes with third party hosted db, sometimes with postgres running with docker. I already know It's possible to host static sites for free but is that also true for full stack apps? Ive looked into some options (vercel, hostinger, netlify) and I'm wondering whats your recommendation both for personal projects and for apps that could possibly get a lot of users.
I personally use SST to deploy my next.js application to AWS. It's free / dirt cheap until you get real traffic. It does require more knowledge to understand how to set it up and deploy, but their docs are good. The easiest solution to deploy next.js is vercel (assuming you can get away with the free plan license). If you plan to just host a node server, you can checkout railway or DO app deploy. There are tons of options, it all boils down to how much you are willing to pay a month. If you want lowest price possible with a confusing UI, go with AWS. If you want the best UI and developer experience, go with vercel.
I think it's fine to do either. For my example, I'm using Caddy in front of my node server because it's very easy for having HTTPS work out of the box. Nginx and Caddy also allow for load balancing, so having those from the start might make it easier to distribute traffic to multiple node instances if needed. Nginx can also cache various assets if configured correctly, which can help improve performance.
🎉 i have a digital ocean droplet running a express server. everything works fine. but some of my user sometimes get timeout error on single endpoint. 1. if they use VPN or other internet connection the endpoint work fine i am not sure whats the issue, any idea?
Nice content! As far as i know securing docker containers it is not a piece of cake - ufw is actually not enough to restrict access to selected (own) ips.Any tips how to secure access to monitoring services (cAdvisor, logstash, graphana etc.) ? reverse proxy ?
Easiest would be to use username and pass for elasticsearch and kibana. Aws has security groups which would only allow access to you EC2 instance if you’re on a certain IP or vPC group
02:37 yikes, that will fail within a few months. Never run latest tags with images, always specify tags. Especially with postgres as you can not easily upgrade between major versions. As for elasticsearch, yep it is a big load on a small vps. But one can configure docker in a way that logs are sent to an external address (i.e. another vps).
yes, this video isn't a production ready setup, I was just showing that I'd probably use docker-compose to host all my things if i had to use a VPS. Yeah, it's better to keep elasticsearch + kibana on a separate vps, and the database on a separate VPS, but then at that point you're trying to manage 3 separate machines that it's easier to just pay for a PaaS.
WTF, Hetzner got double the specs and double less costs vs digital_ocean from this video ..example 2cpu, 8gig ram, 80 gig hdd, 20tb outbound transfers etc ...
I have been following your latest videos and i completely agree that a single VPS for this use case is insane, and not production optimal. I just find it funny that, the only solution to met the requirement of "using a vps" is by using docker, which then at scale translate to Kubernetes. In that way you would get the same way of customizibility (that you dont get from PaaS) and cost effectiviness (at-scale)
At this point I’m seeing that every single project and developer in this industry has a completely different idea of production ready. I guess if the app is online and accepting traffic, it’s production ready in the eyes of many.
Hey Cody, nice explanation of the services that you recommend using. I'm currently using glances instead of cAdvisor, it has a pretty nice UI. Glances just hast to be deployed once on your server and then it works forever, displays your VPS' CPU, Memory and Storage usage aswell as the container usages. I was wondering tho, is there currently any proper way to host a Next.js 13 Application with the App Directory and Server Actions? My current approach is to build the nextjs application and then just simply let it run using PM2 with the command "next start". I haven't found yet a better way and would be interested if you know better.. Greetings from Germany :)
@@WebDevCody Yeah the thing is you can't use a nodejs server if you're using server actions. Or am I missing something? PM2 works fine as well, it auto restarts too.
I just noticed that I actually could just simply run a alpine linux container and then just use next start in it to host the nextjs app, not sure if that's a good approach tho@@WebDevCody
There is definitely a sweet spot in between where you use serverless for things that are hard (db/auth/logging/possibly file hosting) and vps for the easy stuff (your webapp). Also systemd ( cmon you wrote a unitfile to launch docker compose) can restart on fail so not only is docker not needed, a piece of software to restart your dead service isn't either
Great video! 😊 Complitly agree with everything, setting up VPS is great for learning but for a business or serious project my goto is eather aws lambda or aws fargate for containers. Great stuff 😊
Yeah if you're paying per-use, you can accidentally bankrupt yourself or company if you don't have alarms and billing alerts setup to prevent run-away charges. With a VPS you know exactly how much you'll be paying for each month (plus whatever bandwidth they will charge on top of your VPS server which you again can have run-away charges if someone racks up your bill)
As a separate note, many services are cappable by quota to do cost control. That may or may not be a deal breaker but if the scale is small enough to even consider VPS it is probably not.
You should add this video to the description of the first video. And some of the other new ones, in case someone comes across that video. It seems counterintuitive from reading titles. But can be cleared up in the description 🤷♂
I was hosting on vps and even dealing with my own security protocols so I don't get attacked for decades. But all companies use to hate me n wouldn't even employ me :) while millions took certifications from vendors :( They are not engineers but just users.
I could agree with that. K8s gives you the control and flexibility for hosting containers while also removing the need to maintain and orchestrating everything. Although, it does has a learning curve to it. Also no vendor lock-in with is good
To be honest, if it's a smaller scale app you probably don't need all that logging for it to be "production ready" IMO. I've worked on multiple "production" apps that were internal use only or smaller scale apps for a company and logging was never crucial. It would be beneficial in few cases, but usually apps just run and work and that's it. Of course, logging probably never hurt anybody and it's great to have in many many scenarios. Yeah it's easier to use one click solutions to deploy all this stuff, but I think it's great to know how some of this stuff works.
this. And also what i have noticed, with local vps providers you get like a 2 core 8gb ram, 250gig sdd for like 8$ a month. On this you can run like 2-3 applications in parallel for SMEs like 10-30 users. If you know how to configure this and run it all, it is a steal compared to all the other platforms
@@AlexanderHyll yes, but I think this assumes everything you do is Nodejs and that isn't necessarily the case. Where I work we use C# and .Net Core for backend so it's not Nodejs. I know there is Lambda for C#, but then I think you have to write things a certain way and kinda lock yourself into AWS. This also doesn't account for the fact that you need a database and in case of some heavy computation we have done in the past, alongside a SQL database we required a document database that focused on raw performance. Also, from our experience, free database tiers are awfully slow and not usable so going for free tier on everything doesn't work or at least it didn't work for us. This might have changed as time went on, but we haven't retested to be honest. This is probably something we have to revisit. It's sometimes just easier to deploy all of this on a single VM for $10/month and get decent performance and not get locked into anything. If we have issues with a VM on AWS for example, we can easily just switch to Azure or Digital Ocean since we work on bare metal in that case and aren't locked into anything particular. There are also cases where enterprise clients have on premise or non-cloud hardware and you have to deploy on a random VM since there is no cloud. It's good to know how to work with bare metal, it just allows you to be more flexible. Being 100% dependent on these cloud providers just limits your possibilities. Don't get me wrong, I understand the the benefit of these cloud providers and various services they offer, but they don't work for every case.
@@rand0mtv660 I actually don’t even know JS/TS hardly at all. I may be ignorant here, but for the type of app you’re describing I would personally never deploy it and call it production ready without the bells and whistles of logging, monitoring etc. Id have to agree with Cody, doesn’t seem production ready to me for enterprise clients. I personally work on enterprise software for big banks, which obviously has a whole another scale. I was thinking more personal projects or internal tools, where if you are considering using such a small VM performance isnt a big concern anyways. Ive had no issues hooking cloud functions/lambdas to one of several DBs for data of some size. You may get somewhat locked in to provider, I currently mostly write Java and Rust. Quite a bit is portable though, but it depends I guess on how you plan to ship. Maybe Im just biased cause I havent seen this in-between tier, I would just personally never ship to a client for outside hosting without monitoring/logging regardless of API/app size. And then again Id still pick hosted K8 in either scenario. :)
@@AlexanderHyll yeah I guess we just have different experiences and that's fine. To me just adding more services and you now mentioning K8s just seems unnecessarily complicated for certain types of apps. But of course I'll have to investigate all of this a bit more because I haven't experimented with all these 3rd party services in a long time
Hi! Like 👍 your videos so much. I would like to know your way of creating a regular website which has some landing pages, contact form, media gallery, blog. Which CMS and stack you will use. Thanks! Support with like 👍 if you support my suggestion!
which part looks painful? Unless you use an PaaS, you'll always end up SSH into a machine and manually setting up a variety of things. This is the less painful approach I can think of over trying to install nginx, caddy, pm2, manually on the machine directly
@@eshw23 oh, absolutely, unless you’ve spent a lot of time learning how to properly set it all up and manage it, using a paid PaaS provider is much easier and probably much better for your production system
@@WebDevCody Yea especially since my app is a long term project and im a solo dev, I host my Next app on Vercel and then get out lol. If its valuable to learn ill learn it though.
Btw, keep your sysadmin egos in check and just deploy using existing PaaS that manage all of this for you. I wouldn’t never host on a single VPS for a production system.
Pin this comment ❤️
Feels like a lot of people don't know, and haven't tried both approaches or either. Its probably still worth people trying for the own learning experience, and to satisfy that thought of "I wonder if that way is better, I should try it". I've been messing around with a self-hosted PaaS called Caprover on a Oracle cloud VPS. Its good; better than just docker alone. There are some other similar software like Dokku and portainer. I just plan on using this to host a portfolio site + some small demo projects, static sites and maybe to quickly deploy test versions of apps I make in the future.
But I agree with you; to me this is not a good idea for production, especially without some container orchestration tool like portainer. Seems too "involved" and now I am creeping into another job entirely. For example, I found myself googling so much to figure out how to secure the VPS, open and close ports, configure ip-tables, configure the VNIC on Oracle, and how to go about patching the operating system / dependencies. I don't see anything wrong with playing with this stuff and learning, but it just seems like I'd have to draw the line somewhere sooner, to focus more on the software development.
Have you tried self-hosting a PaaS like caprover, dokku or portainer? it could be a nice in-between paying for a PaaS provider vs self-hosting on a VPS using docker. But these self-hosted PaaS don't have all the features that many PaaS providers have, like vercel and their edge functions.
We rent dedicated servers from Hetzner and use Kubernetes for container and cluster management. It saves us something like 95% compared to using AWS. It's an option for high, constant load infrastructure. Just something to keep in mind, though usually not very relevant for SaaS or such. But for low return per volume uses (eg ad supported sites) the difference is quite stark. Physical CPU cores can be 7-8x as fast as a VPS or cloud server vCore (and it doesn't fluctuate based on CPU usage of others sharing the server), and you typically don't have to pay for bandwidth per GB, so the math is really, really twisted. Just something interesting to keep in mind.
"wouldn’t never"
Lol… and a triple vps? Using docker swarm?
Thanks Cody!
Could you please provide guidance on configuring CI/CD using GitHub Actions for a VPS?
Great content Cody, really enjoying everything you're putting out. Nice work!
Thank you for tackling the mundane world of vps hosting, it is a very comprehensive video explanation of how to have a solid handle of a vps deployment.. Maybe you should do a video on how you prevent run-away cc charges on the serverless platforms you prefer to use. I think the nightmare scenarios we all have read online is what makes us stay away from serverless.
For Grafana+Loki, it's not as good for search as ELK (it doesn't have an inverted index full text search engine) but it is far faster and scales to ridiculous levels, while using much less storage. So if the goal is to dump a million log lines per hour into it, Loki is probably a better choice than Elastic. Otherwise, stick to ELK.
Interesting video.
Question: would you consider using Ansible and give up on docker compose?
you are the GOAT of web dev content! Much love for you dude!
Even though I agree with your opinion on using existing PaaS instead of self-hosting, I still appreciate that you take the extra step to show how it would actually look like if you were to use a VPS instead. In my current workplace we are so few devs that we need to pretty much manage all aspects of the dev pipeline and one of the main reasons why we didn't go with self-hosting is because the complexity is so steep that teaching it to someone who has previously only worked with react-native stuff would just not be worth it. Much simpler to teach someone to do basic deployment to production and such if there is a friendlier interface to use e.g Hasura.
100%, rolling your own deployment solution means you better have great documentation for when the main people who set it up decide to leave the company and they hire someone who has to figure out how it was all hobbled together.
Thanks for showing this regardless. When it comes to personal projects, I still go this kind of route due to budget.
I dont understand how you use something like web sockets or cron jobs with serverless architecture. Do those things have to run on a VPS where its stateful? Could you touch on that a little?
I’d just use a third party websocket service, such as aws api gateway v2 or pusher. Or if you really want to you can just deploy the websocket server as a stand-alone service and have your api signal your socket server for sending out events. But yes, that’s the one down side of serverless, websockets are not easy anymore. For cron jobs, again I’d just use aws cloudwatch alarms and setup cron rules to invoke my serverless endpoints.
Thanks for the content. There is something i don't understand, i would appreciate it if you can explain: a 16gb RAM droplet on DigitalOcean would be $96 /mo, while a 32gb RAM Hostinger VPS would be $22 /mo. I don't quite understand the pricing difference, would i be just because hostinger is pre-paid instead of by usage?
You’d probably need to look at the hardware specs and read on perf benchmarks. DO might have much better cpu speeds or memory bus speeds. Hostinger only gives a big up front discount if you pay for a year up front, otherwise it’s $60/month.
This is so much appreciated, many thanks, I am coming to a point of where I am needing a place to host my site also, I was wondering have you already covered a docker and AWS setup on your channel?
Great explanation! May I ask why would anyone do this over using something like Vercel or Aws? This feels like it would take months to learn for someone new to devops/cloud. Id rather use a provider and actually work on building my application.
it's "cheaper" they say, but no one factors in the hours it'll take to configure, maintain, upgrade, monitor, automate, and scale their custom VPS solution so that they can only pay $5 / month. I easily wasted a few hours alone just trying to setup this ELK logging setup for this video. I spend an ENTIRE HOUR because I was using localhost instead of 127.0.0.1 somewhere in my configuration files.
Probably because theres some people out there that already have this experience acquired through many years and this is just the way they are comfortable building things.
@@dandogamer @WebDevCody Definately, I can see how it might be needed, if you had an enterprise app, where doing all this yourself can actually save money because you have so many users. Even then, there would be a whole team youd need to pay
Fear of overnight exorbitant charges
Hi Cody, I’m sort of a beginner on devops/hosting thing. My question is, if I were to host my API on AWS Lambda, what do you think is the best option to deploy my React app? I’d like to make it all as cheap as possible
I use SST. It’ll deploy it to s3 behind cloudfront.
@@WebDevCody I see, would you recommend just using SST to deploy my full-stack app or still deploy the API on Lambda manually and then the Client app on SST?
@@yohance6904 if this is for a side project, I’d just use nextjs and deploy using sst. It makes it easier when the api and frontend are combine. If you can figure it out, you can also just write your api with express or nest, then use a wrapper to get the entire api deployed to a single lambda, that’s what we do at work.
@@WebDevCody so basically, for a side project just deploy all together on sst, if down to do something more professional(?), use a wrapper to deploy the api on a single lambda. If i wanted use a wrapper, which one do you recommend?
@@yohance6904 we use @vendia/serverless/express, then we zip it and deploy it to a lambda, then we hook it up to an api gateway. I haven’t done it with sst so idk if they have an example on that already or not
Great job babe!!! Also FIRST!!! Finally
Wohoo 🎉 thanks babe!
super awesome insight man, will look deeper into all of the tech you used & implement it
Can you link to that old video where you talked about why you wouldn't use vps?
Besides creating a vps and using nginx or apache as a proxy server, what else is needed to upload website? Do you need to use docker or software like vscode?
The bare minimum is your node server and probably caddy or nginx in front of it on your machine. You’d have to figure out your own process to deploy updates. Docker compose makes it easier to just build an image, Publix it, then rerun docker compose up to deploy your updates
SST seems to be the real sweet spot, but I've never used AWS for db. Might be missing out. For that, I'd probably just use supabase or pay 15 bucks a month for a managed DB at linode. I never use planetscale because they dont have real relations which bugs me.
great video man!
planetscale is not for everyone.
Planetscare ux sucks
yeah, because other than that, their pricing and scaling is top tier@@ooogabooga5111
Thanks for actually posting a video on using a vps I know many other TH-camrs that would just dismiss it and not even give an attempt
Sure thing, it’s still a viable option for many projects, but not my personally recommended way
u should try the community edition of portainer to view all your containers, images and that kinda stuff ^^
is that some type of k8s host?
Hi Cody, I'm kind of a noob in this devops and hosting stuff, I have done some full stack projects but I have no idea where to host them, they are either react and express or nextjs, sometimes with third party hosted db, sometimes with postgres running with docker. I already know It's possible to host static sites for free but is that also true for full stack apps? Ive looked into some options (vercel, hostinger, netlify) and I'm wondering whats your recommendation both for personal projects and for apps that could possibly get a lot of users.
I personally use SST to deploy my next.js application to AWS. It's free / dirt cheap until you get real traffic. It does require more knowledge to understand how to set it up and deploy, but their docs are good. The easiest solution to deploy next.js is vercel (assuming you can get away with the free plan license). If you plan to just host a node server, you can checkout railway or DO app deploy. There are tons of options, it all boils down to how much you are willing to pay a month. If you want lowest price possible with a confusing UI, go with AWS. If you want the best UI and developer experience, go with vercel.
@@WebDevCody Thank you so much! Def gonna be checking these out
do u think it's a good thing to use nginx in the front instead of the js server directly?
I think it's fine to do either. For my example, I'm using Caddy in front of my node server because it's very easy for having HTTPS work out of the box. Nginx and Caddy also allow for load balancing, so having those from the start might make it easier to distribute traffic to multiple node instances if needed. Nginx can also cache various assets if configured correctly, which can help improve performance.
🎉 i have a digital ocean droplet running a express server.
everything works fine. but some of my user sometimes get timeout error on single endpoint.
1. if they use VPN or other internet connection the endpoint work fine
i am not sure whats the issue, any idea?
Nice content! As far as i know securing docker containers it is not a piece of cake - ufw is actually not enough to restrict access to selected (own) ips.Any tips how to secure access to monitoring services (cAdvisor, logstash, graphana etc.) ? reverse proxy ?
Easiest would be to use username and pass for elasticsearch and kibana. Aws has security groups which would only allow access to you EC2 instance if you’re on a certain IP or vPC group
What solution you are using in your projects for logging? Love your vids!
02:37 yikes, that will fail within a few months. Never run latest tags with images, always specify tags. Especially with postgres as you can not easily upgrade between major versions. As for elasticsearch, yep it is a big load on a small vps. But one can configure docker in a way that logs are sent to an external address (i.e. another vps).
yes, this video isn't a production ready setup, I was just showing that I'd probably use docker-compose to host all my things if i had to use a VPS. Yeah, it's better to keep elasticsearch + kibana on a separate vps, and the database on a separate VPS, but then at that point you're trying to manage 3 separate machines that it's easier to just pay for a PaaS.
Where could I learn more of this topics? Like VPS , creating a public IP and domain stuff, etc
I know TH-cam lol but more in depth
Yeah I’m not sure if that’s a niche that’s being filled on youtube
@@WebDevCody yeah , it’s like a more advanced and real life stuff lol , but your content adds a great value, thanks bro
WTF, Hetzner got double the specs and double less costs vs digital_ocean from this video ..example 2cpu, 8gig ram, 80 gig hdd, 20tb outbound transfers etc ...
I have been following your latest videos and i completely agree that a single VPS for this use case is insane, and not production optimal.
I just find it funny that, the only solution to met the requirement of "using a vps" is by using docker, which then at scale translate to Kubernetes. In that way you would get the same way of customizibility (that you dont get from PaaS) and cost effectiviness (at-scale)
At this point I’m seeing that every single project and developer in this industry has a completely different idea of production ready. I guess if the app is online and accepting traffic, it’s production ready in the eyes of many.
Hey Cody,
nice explanation of the services that you recommend using.
I'm currently using glances instead of cAdvisor, it has a pretty nice UI. Glances just hast to be deployed once on your server and then it works forever, displays your VPS' CPU, Memory and Storage usage aswell as the container usages. I was wondering tho, is there currently any proper way to host a Next.js 13 Application with the App Directory and Server Actions? My current approach is to build the nextjs application and then just simply let it run using PM2 with the command "next start". I haven't found yet a better way and would be interested if you know better..
Greetings from Germany :)
Yeah, you could host using pm2, or use a docker container with restart always like I had in this video and it’ll restart it if it crashes
@@WebDevCody Yeah the thing is you can't use a nodejs server if you're using server actions. Or am I missing something? PM2 works fine as well, it auto restarts too.
@@amenofisch server actions should work on a vps, at least I thought it would. What issues are you seeing with server actions?
I just noticed that I actually could just simply run a alpine linux container and then just use next start in it to host the nextjs app, not sure if that's a good approach tho@@WebDevCody
I love your work.. keep it coming bro ❤
Anyone can get access to elastic search and cAdvisor
So how can we make it secure?
you could host on a home lab depending on your experience setting up your own hardware and network
There is definitely a sweet spot in between where you use serverless for things that are hard (db/auth/logging/possibly file hosting) and vps for the easy stuff (your webapp).
Also systemd ( cmon you wrote a unitfile to launch docker compose) can restart on fail so not only is docker not needed, a piece of software to restart your dead service isn't either
yeah, nothing is black and white, use what works for your project
Can you share you SaaS mind map, Thank you
Hi Cody,
Do you have any video/playlist on docker?
I don't think so
Great video! 😊 Complitly agree with everything, setting up VPS is great for learning but for a business or serious project my goto is eather aws lambda or aws fargate for containers. Great stuff 😊
The logging point i loved
I heard one of the cons of cloud services vs VPS is that its not easy to cap your budget. Someone could find a way to rack up your bill right?
Yeah if you're paying per-use, you can accidentally bankrupt yourself or company if you don't have alarms and billing alerts setup to prevent run-away charges. With a VPS you know exactly how much you'll be paying for each month (plus whatever bandwidth they will charge on top of your VPS server which you again can have run-away charges if someone racks up your bill)
As a separate note, many services are cappable by quota to do cost control. That may or may not be a deal breaker but if the scale is small enough to even consider VPS it is probably not.
is there any reason in particular you use caddy over nginx?
it's easier and automatically sets up your SSL certificates for you. Maybe nginx will do that for you, I haven't tried in a while.
FYI SST deploys to VPS too.
What about things like dokku? Are they worth it over docker compose.
dokku seems like a good solution from what I've read from their docs.
You should add this video to the description of the first video. And some of the other new ones, in case someone comes across that video. It seems counterintuitive from reading titles. But can be cleared up in the description 🤷♂
Could you please share that docker-compose 🙏?
github.com/webdevcody/vps-elk-express
I need someone expert in this area to teach me how to use docker, who knows a teacher in the docker (deployment in general) that give me some lessons?
thats amazing. thanks for sharing
I was hosting on vps and even dealing with my own security protocols so I don't get attacked for decades. But all companies use to hate me n wouldn't even employ me :) while millions took certifications from vendors :( They are not engineers but just users.
A very informative video for my level of experience. Thank you.
Personal website, or project for a small client. Just drop an apache for 100 visits a day!
Wow beautiful
Lambdas will be cheap when you don't have scale. As soon as you have some meaningful traffic, you will be making cloud gods richer :)
Seems a lot of suggestions are at either end of the serverless spectrum. Am I the only one that finds managed K8 to be the best of both worlds?
I could agree with that. K8s gives you the control and flexibility for hosting containers while also removing the need to maintain and orchestrating everything. Although, it does has a learning curve to it. Also no vendor lock-in with is good
Blick Circle
Alexane Throughway
Hermiston Crescent
Nice video
To be honest, if it's a smaller scale app you probably don't need all that logging for it to be "production ready" IMO. I've worked on multiple "production" apps that were internal use only or smaller scale apps for a company and logging was never crucial. It would be beneficial in few cases, but usually apps just run and work and that's it. Of course, logging probably never hurt anybody and it's great to have in many many scenarios.
Yeah it's easier to use one click solutions to deploy all this stuff, but I think it's great to know how some of this stuff works.
this. And also what i have noticed, with local vps providers you get like a 2 core 8gb ram, 250gig sdd for like 8$ a month. On this you can run like 2-3 applications in parallel for SMEs like 10-30 users. If you know how to configure this and run it all, it is a steal compared to all the other platforms
At that scale cloud functions and the like are free ^^
@@AlexanderHyll yes, but I think this assumes everything you do is Nodejs and that isn't necessarily the case. Where I work we use C# and .Net Core for backend so it's not Nodejs. I know there is Lambda for C#, but then I think you have to write things a certain way and kinda lock yourself into AWS.
This also doesn't account for the fact that you need a database and in case of some heavy computation we have done in the past, alongside a SQL database we required a document database that focused on raw performance. Also, from our experience, free database tiers are awfully slow and not usable so going for free tier on everything doesn't work or at least it didn't work for us. This might have changed as time went on, but we haven't retested to be honest. This is probably something we have to revisit.
It's sometimes just easier to deploy all of this on a single VM for $10/month and get decent performance and not get locked into anything. If we have issues with a VM on AWS for example, we can easily just switch to Azure or Digital Ocean since we work on bare metal in that case and aren't locked into anything particular. There are also cases where enterprise clients have on premise or non-cloud hardware and you have to deploy on a random VM since there is no cloud. It's good to know how to work with bare metal, it just allows you to be more flexible. Being 100% dependent on these cloud providers just limits your possibilities.
Don't get me wrong, I understand the the benefit of these cloud providers and various services they offer, but they don't work for every case.
@@rand0mtv660 I actually don’t even know JS/TS hardly at all. I may be ignorant here, but for the type of app you’re describing I would personally never deploy it and call it production ready without the bells and whistles of logging, monitoring etc. Id have to agree with Cody, doesn’t seem production ready to me for enterprise clients. I personally work on enterprise software for big banks, which obviously has a whole another scale.
I was thinking more personal projects or internal tools, where if you are considering using such a small VM performance isnt a big concern anyways. Ive had no issues hooking cloud functions/lambdas to one of several DBs for data of some size.
You may get somewhat locked in to provider, I currently mostly write Java and Rust. Quite a bit is portable though, but it depends I guess on how you plan to ship. Maybe Im just biased cause I havent seen this in-between tier, I would just personally never ship to a client for outside hosting without monitoring/logging regardless of API/app size. And then again Id still pick hosted K8 in either scenario. :)
@@AlexanderHyll yeah I guess we just have different experiences and that's fine. To me just adding more services and you now mentioning K8s just seems unnecessarily complicated for certain types of apps. But of course I'll have to investigate all of this a bit more because I haven't experimented with all these 3rd party services in a long time
Hi! Like 👍 your videos so much. I would like to know your way of creating a regular website which has some landing pages, contact form, media gallery, blog. Which CMS and stack you will use. Thanks! Support with like 👍 if you support my suggestion!
Kling Cove
This looks and sounds so painful lol
which part looks painful? Unless you use an PaaS, you'll always end up SSH into a machine and manually setting up a variety of things. This is the less painful approach I can think of over trying to install nginx, caddy, pm2, manually on the machine directly
@@WebDevCody No nothing specific, just setting up your own VPS instead of using a provider. Great job on explaining how to do it though!
@@eshw23 oh, absolutely, unless you’ve spent a lot of time learning how to properly set it all up and manage it, using a paid PaaS provider is much easier and probably much better for your production system
@@WebDevCody Yea especially since my app is a long term project and im a solo dev, I host my Next app on Vercel and then get out lol. If its valuable to learn ill learn it though.
Lewis Timothy Taylor Melissa Lewis Helen
Didn’t age well 😂
It aged like a fine wine
@@WebDevCody oops sorry. This comment was meant for your other video titled “Why I wouldn’t host my apps on a VPS”