Deployment on DigitalOcean, best way to avoid confusion

default discord avatar
gammalaserkanone2 months ago
16

I'm currently deploying my first test app on a DigitalOcean Droplet, and have my DB at MongoDB Atlas.


But the Atlas seems too expensive for me. Is it better to use the DigitalOcean Database Cluster with MongoDB, or install MongoDB directly within the Droplet? What's a good solution for beginners? I aim to host all my websites like this, and some might have a little more traffic.



Any help appreciated 🙏 or maybe even hints.



MongoDB Atlas: 57$ month for 10GB


DigitalOcean DB: 15$ month for 15GB



😮‍💨



Within the droplet it's kind of free, but a huzzle to set up, right? And I'd have to create a bigger Droplet, but that would be the cheapest option. Maybe one Droplet for each website with it's own DB??

  • default discord avatar
    notchr2 months ago

    Not bad for that amount of space



    Its inteded to be difficult to setup manually because they want people to go with Atlas



    is my understanding

  • default discord avatar
    paulpopus2 months ago

    You may wanna check out coolify



    I pay for the base tier, you simply give it a VPS, i use hetzner for this, and then it just goes in and deploys everything you might need



    as long as your server can handle it, you deploy anything and it supports automatic deployments, preview branches and other features



    so your cost will be like $5 for coolify + $5-10 for the VPS and these 2 should be able to handle all of your needs

  • default discord avatar
    gammalaserkanone2 months ago

    Self hosted Vercel sounds very cool! I'm sceptical about Vercels free tier in the future, as with many things that are free in the beginning shift to paid.



    Currently trying out the app platform by D.O., and each instance is beginning from 12$ month. But you do need the additional D.O. DB, which can be used for multiple websites I guess.



    Maybe it's a good idea to spend a little more coin on hosting... My mind always shifts to the cheapest options 😩 😅

  • default discord avatar
    davelsan2 months ago

    I've only heard good things about Hetzner in this regard. I'm not too happy with the hosting providers I've tried, would love to try this with v3.

  • default discord avatar
    gammalaserkanone2 months ago

    But I like that in DigitalOcean there is an option to automatically setup a MongoDB, which saves me time. I just want to whip it up and don't think about it. In Hetzner I guess you have to install all the stuff. But yeah, once you know how it works, thats great.

  • default discord avatar
    davelsan2 months ago

    Yeah, co-locating the mongo db with the server sounds really nice to use with the local API. I currently use atlas and there is a noticeable delay.

  • default discord avatar
    ardiansyaherwin2 months ago

    how about utilizing Supabase(or any similar service) free tier and set the region close to your DO droplet? is it doable?

  • default discord avatar
    gammalaserkanone2 months ago

    But Atlas is like 3 times as expensive, and has a lower SSD. But it does have more power and functionality.



    Supabase is 25$ for 8GB, and DigitalOcean is 15$ for 15GB. But yeah, if you have just a couple of blog posts and no IMG's, then that would totally work.



    Just checked: Supabase has 100GB Disk (file storage), where you could deploy everything, but I'm not sure how that works 😅 I think its not meant to be used that way.



    … Man this discussion has me occupied for 4 days now 😮‍💨

  • default discord avatar
    muczaczos.2 months ago

    Hi @gammalaserkanone. If you familar with linux mantaing, mongoDB directly within the droplet is easier than work with Atlas :). I've created database for payload CMS in less than 1 hour, without any knowledge about MongoDB.


    Digitalocean has great tutorials about many topics in linux administration field.

  • default discord avatar
    ardiansyaherwin2 months ago

    yup, that is, depends on your future usage. Currently I'm still looking for similar services which have pay-as-you-go plan, so then I can initially cheer up my client 🥳



    Once 3.0 released, I'll go full on DO droplet, then setup Payload and DB in a single droplet.

  • default discord avatar
    rluisn12 months ago

    @gammalaserkanone That is a good point, I agree with you about the costs while using atlas is very high. Honestly, I’m in the same situation as you now. I’m exploring the capabilities with Kubernete option. In digital ocean it is $12 mon, per node.



    DigitalOcean (DO) with Kubernetes can be a good option for a cost-effective deployment of your Next.js application with MongoDB, especially if you're looking to move away from MongoDB Atlas pricing



    Pros:



    Cost-effective: DO offers Droplets (virtual machines) at competitive prices, allowing you to scale your resources based on your application's needs. Kubernetes helps manage containerized deployments efficiently, optimizing resource utilization.


    Flexibility and Control: You have full control over your infrastructure on DO. You can choose your operating system, configure services like MongoDB yourself, and customize your deployment to your specific needs.



    Cons:



    Management Overhead: Setting up and managing a Kubernetes cluster on DO requires more technical expertise compared to a managed service like MongoDB Atlas. This includes maintaining the cluster, handling upgrades, and ensuring security.



    Complexity: Kubernetes adds an additional layer of complexity to your deployment. You'll need to learn Kubernetes concepts like deployments, pods, and services to manage your application effectively.



    But that part can be minimised using Skaffold from google kubernetes team where you com deploy it using a simples yaml file . If you use real thats is fine skaffold covers it if you do not use. Also fine.


    You can have the full cluster in your machine and deploy to the digital ocean later.

  • default discord avatar
    ccssmnn2 months ago

    When you are exploring, testing and so on, there is nothing wrong with putting everything into the same droplet. You can use Docker Compose to spin everything up, which is quite easy especially with AI help a la ChatGPT or Phind.



    When you want to earn money and have customers with your application, I would go with managed services. With DO you can have Storage for 5$, MongoDB for 15$ and your deployed app completely managed. Those costs should be small compared to potential earnings with your application.



    You don't need Kubernetes for such an app.

  • default discord avatar
    rluisn12 months ago

    Indeed, :niceone: that’s also a good point to observe. Adding another layer for Kubernetes would indeed have to think about the size and workload of your application. I’ll also explore the options only with droplet and compose and check the results.

  • default discord avatar
    ardiansyaherwin2 months ago

    I just got a pretty lead from Reddit post, he advised to just use

    https://zeabur.com

    . It simplifies the NextJS and PostgreSQL setup, it also has preview URL like Vercel (I havent tried this feature). Most likely I'll go with this option on 3.0, PayloadCMS+PostgreSQL in a single Zeabur project.

  • default discord avatar
    gammalaserkanone2 months ago

    Ahh so this is another Coolify. We might need a deployment section in the Payload docs that collects everything. I'm currently just very busy atm

  • default discord avatar
    ardiansyaherwinlast month

    @gammalaserkanone yeah I ended up trying to install Coolify on a Contabo VPS

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.