Hosting options to deploy a Ruby app

You want to deploy your a small app or you’re working on your portfolio and need to get it deployed somewhere quickly, but you’re still deciding what PAAS provider to use, below you’ll find different providers so you can choose the best option for you.

I selected the 3 most popular options and compare them using the following requirements:

  • Always on instances

  • RAM: 500MB

  • CPU: 1x - shared

  • Database: Cheapest available

All of the selected providers offer the following features:

  • Quick setup and deployment of your application

  • Built in metrics dashboards, logging basics, and standard machine health checks

  • CLI to manage and configure your applications from the CLI

  • SSL certificates and domain configuration (out of the box)

  • Security and updates of your servers and applications.

Heroku

Pros

  • Generally easy to use.

  • Build-packs allow you to push your code and the platform takes care of the rest.

  • Reliable and familiar, it’s been around for 15 years.

Cons

  • No free trial.

  • Price can scale quickly if you need to deploy multiple apps or need more resources.

  • Salesforce announced recently that it’s going into a “sustaining engineering model”.

Monthly pricing

  • 1 app - $13 ($7 compute + $5 storage)

  • 3 apps - $36 ($21 compute + $15 storage)

Documentation

Fly

Pros

  • Option to use a SQLite database to get started.

  • Pricing based on usage and 40% discount when you reserve compute in advance.

  • Deployment based on Dockerfile, making it easier to switch to a different provider if needed.

  • Provides more fine-grained controls for scaling horizontally and vertically (RAM, CPU, storage, regions, etc).

Cons

  • No cheap/basic managed Postgres database.

  • Additional charges for data transfer (Bandwidth).

  • Flexibility makes configuration more complex, so you’ll need to work with extra concepts.

Monthly pricing

  • 1 app - $6.15 ($4 compute + $2 bandwidth + $.15 storage)

  • 3 apps - $18.45 ($12 compute + $6 bandwidth + $.45 storage)

Documentation

Render

Pros

  • Same philosophy, cost structure and concepts as Heroku but cheaper as you scale

  • Offers native, fully customizable cron jobs.

  • Native support for Docker, you can deploy using a Dockerfile in your repository.

Cons

  • Basic database only has 256mb of storage and 256MB of RAM.

  • Price can scale quickly if you need to deploy multiple apps or need more resources.

  • Documentation is a bit difficult to navigate.

Monthly pricing

  • 1 app - $13 ($7 compute + $6 storage)

  • 3 apps - $39 ($21 compute + $18 storage)

Documentation

If you find this information helpful, please share it with others. Any feedback or experiences deploying apps to these SaaS providers is welcomed too.

1 Like

Very happy with Hetzner + Miren (https://miren.dev/). Cheap VMs and affordable dedicated servers (comparable in price to much weaker “performance” VMs for most PaaS solutions).

2 Likes

Thanks for the suggestion @rkh ! I have Miren in sight but haven’t had the time to test it yet. For self-hosting I’ve also heard good things about https://hatchbox.io

A comment about Fly, as a user for a year:

  • If your bill is under $5, you get 100% discount. I have been going on like this with a single app for this whole time, although this is not a Rails app and I keep the database on Supabase free tier.
  • Fly actually does offer managed Postgres, although it not full-featured
  • In general, Fly positions itself as a public cloud, not a PaaS, so it’s expected you have to do more work yourself and their offering is closer to bare metal, compared to Heroku or Render. This will be good for some people, bad for some other.
2 Likes

@katafrakt Thanks for sharing your experience and insights. I agree with you that the best option will depend on multiple factors and it won’t be the same for everyone.

Was using Heroku and then move to Fly for better pricing.
Now I’ve been playing with Hetzner and Kamal 2, thinking about to move everything out to Hetzner. The only thing that makes me hesitate is the managed postgresql. The cost saving is insane.

You’re using Fly managed Postgres and want to save costs? If that’s the case and you don’t want to do the full migrations, you could consider moving to an unmanaged Postgres database or look for a database provider with a free or cheap tier.

Self hosting everything is not a bad option either, but you also need to consider the extra time you need to invest to setup and manage by yourself (and if you put a price to your time it might be more expensive than a PAAS), but it’s always a tradeoff and depends on your particular needs, skills and goals.

I self-host all of my own projects from my cabinet in a Toronto datacenter, but for clients, if they aren’t also hosted with me, I’ve been finding many of them have been trending towards Render for hosting, and occasionally, Hatchbox. I have at least one client using Azure and one using AWS.

Using the Render interface has been quite enjoyable for the most part. Deployments are quick, easy access to logs, etc.

Azure and AWS are the least appealing to me, and for Azure specifically, one that I frequently run into bizarre bugs or clearly issues that are business/operations orientated (ie, a team clearly couldn’t get another database column added on an entity so they jammed it in as a bizarre environment variable). Unless requirements dictate such as HIPAA or generous startup credits, these 2 are the bottom of my list.

For self-hosting, Kamal has been a game changer. I do have some holdouts using Dokku (and previously, some using Caprover), but I’ve gradually switched everything over to Kamal.

1 Like

Hey @adam12 ! It’s great to see you here, thanks for sharing your experience with self-hosting and Render.

I have some follow up questions if you don’t mind. Do you usually help your clients with the setup/migration of new applications? What would you say is the biggest challenge from going to PaaS to self-hosting? Or in what cases you would recommend one over the other?

I’m typically involved in the setup of every single one. A project not launched is of little value, so I try to push for deployment early in the project lifecycle and make it easy to start continuous deployments of some sort (manual or automated).

General operations. Ensuring backups are complete, upgrading of system dependencies, etc. Kamal/Dokku extract a way a lot of the running of the app, but there is that ‘boring’ aspect of operations that keeps the lights on but everyone hates doing.

If you run the hardware as well (as I do), then you’ll eventually encounter strange bugs in firmware, faulty physical components (failing cables, backplanes, etc).

Hard to say. I enjoy the freedom of running everything myself, but also, it means I’m essentially on-call 24/7/365. Not exactly great for vacation planning.

If you can make operation problems someone else’s problem, that’s typically more favourable from a business’s point of view, IMHO.

Thanks for the thorough response @adam12 ! It’s great to have your perspective. I totally agree that freedom is great but it does come with a cost that needs to be taken into consideration.

I like the idea of making operations someone else’s problem too! Sometimes I find it hard to pay for things I know how to do or that I enjoy doing, but sometimes outsourcing or paying for a service makes more sense for the business.

I haven’t tried it yet, but since we’re talking about costs I must mention OCI. They offer in their Always Free tier 4 OCPUs and 24GB of memory in which you can split across n instances of the A1 Ampere instance type.

I think that capacity would be enough in a lot of cases. The only thing to note is that the processors are ARM-based and I’ve heard that some gems with native extensions might not work properly.

More on that here: Always Free Resources - OCI

1 Like

As mentioned in another thread, I’m using Hetzner and nothing else to host a Brut (Rack/Sinatra) app with redis and postgres. While I know exactly how it’s all set up, self-hosting without any tool support is starting to kinda suck. Here’s what I have to provide my own solution for (and you know it’s all bash :slight_smile:

  • Get new code onto the server
  • Run database migrations without downtime
  • Cron
  • systemd services for the app + sidekiq
  • Install/update/manage postgres and valkey
  • system updates
  • Install/update/manage Ruby and Node
  • A ton of sudo and user management stuff to avoid ssh’ing in as root or equiv
  • logs
  • environment variables / secrets

Currently, I’m doing this for $10/month, which is a good deal for the app in question, which is not being used in any real way. I also haven’t wasted too much time on this because LLMs seem to give sufficiently correct info that I can either use its instructions directly or use them to find correct instructions. I also know enough about this topic to ask it for things it’s not volunteering or steer it in a better way (e.g. it has suggested a few times that I allow all sudo commands from my personal user to run w/out a password, which is not the right way to do that)

I think a Docker-based deployment could simplify a lot of this stuff, but we’ll see.

1 Like