First infrastructure
Hey!
I'm looking for advice to making my "first" infrastructure for my apps.
I started freelancing not too long ago and looking for a good starting point, an easily scalable infrastructure.
Stack:
Nextjs (v15) + payloadcms (as CMS)
Postgres database
S3 storage (currently at DigitalOcean, moving to hetzner)
My main idea would be to have 3 VPS at hetzner and a S3 storage (for backups and static assets for the websites, like images, pdf, etc.)
1. vps - dokploy ui
2. vps - postgres
3. vps - apps
Current projects: startups, local landing pages, webshops
I want to have a staging and a production server as well. (Staging used for demo & development purpose)
(EU based projects only so no need for worldwide access)
Any ideas how to improve this setup or should I change it entirely?
17 Replies
It all depends on your user base size. What you have there may be good, totally overkill, or not even close to being enough.
I will have multiple applications the idea would be to make a starter infrastructure and update it when needed, but I consider to separate the stuff (apps, db) to make it easier to update later. And use the same infra for all the applications
I like to use Dokploy for apps, but for production where I have customers I leave that to dedicated databases managed by cloud providers. There is just too much risk with self hosting stuff like that. Just my 2 cents
Which provider do you use for database? I'll consider this option too
I use Azure. Not that I would say that they have the best, but there is certain compliance features which only they cover (location). This is my case though
Back to your situation. A VPS dedicated to just Dokploy seems like overkill
I considered a small vps, like cx22 in hetzner (2vCPU, 4GB, 40GB) to separate them from the apps, so if any of the app vps goes down don't make the ui go down as well
I would like to spend like 40 euros for starting to host the apps I develop for my small user based clients (like max ~100 concurrent users)
I like a lot the Hetzner provider (based on their price & quality)
I'm thinking about future as well, if I deploy everything on one vps it would be harder to scale later
Horizontal scaling of your apps: can easily be done later. Even if everything runs on one machine. Horizontal scaling of you DB: is gonna be hard either way. Keeping you DB on a separate machine sounds nice as a starting point. Your infra idea is going to handle a lot. And usually, when the load gets too much, you're earning enough to scale them up vertically.
If you think that you're going to need the ability to scale horizontal to hundreds of VPS, I would advice you to read about the infra to Stack Overflow.
I don't think I will need that much. I got your point of view and thanks for clarification.
I'm sure that I don't want to handle database part. So maybe stick to the 1 vps for the dokploy ui and 1 for the apps
Best of luck. I would also advice you get good at the docker commands Dokploy is running behind the scenes. At a huge surge of users one time and ran out memory. The one thing the operating system decided to kill was Traefik, which kinda takes everything down
I will limit the resources
Get good at backup, and get even better at restoring backups. There is no way in the UI for dokploy to restore them, so have to do it manually. Practice it. When you feel comfertable, you can basically have a database anywhere
Yeah, I managed that part
Like 1 day ago
Thanks for advice and clarification, much appreciate it!
No worries. It's really fun to self host stuff. Gives you a real ownership over your data
Just a last thing if you have a little more spare time, how would you use the 35 euros(at hetzner), what would you rent for running like 4-5 apps (max ~100 concurrent users). Yeah I got it, it's a little bit overkill
Two sets of CX42 would easily handle that traffic
How would you setup them? (Balancing the application or like in a cluster mode).
Application if you are building the apps on you primary server. Cluster if you're building the apps in a CI/CD pipeline