datamade / how-to

đź“š Doing all sorts of things, the DataMade way
MIT License
81 stars 12 forks source link

Research alternatives to Heroku #272

Open hancush opened 2 years ago

hancush commented 2 years ago

Heroku is expensive and just went through a pretty big snafu with its GitHub integration. How has the landscape changed since we identified Heroku as the best platform for deploying containers? Are there better, cheaper alternatives?

Some ideas:

First step would be to evaluate these platforms:

derekeder commented 1 year ago

Hacker news thread on Heroku's plans to end their free tier. includes some links and resources to alternatives: https://news.ycombinator.com/item?id=32594533

smcalilly commented 1 year ago

Render

I tried out Render. Here's an example PR with the changes it took to deploy: https://github.com/datamade/il-nwss-dashboard/pull/48. TLDR: you setup a render.yaml file to declare the app and related services. it's a lot like a docker-compose.yml file. nice and easy.

Here's the live app: https://il-nwss-dashboard.onrender.com/

This PR turned off caching because we need to wire up Redis, which appears easy following their render.yaml blueprints.

Here's a guide on deploying a Django app: https://render.com/docs/deploy-django

Pros/Cons

They make a good sales pitch against Heroku. They also wrote a guide to migrate from Heroku, but this only works if you're using standard Heroku build packs (vs our setup that uses docker).

I like how they follow the infrastructure as code pattern and take it seriously enough to write about it in their docs. You create a render.yaml file that provisions all the resources. You can have multiple services declared within the yaml file, so it's similar to how docker-compose.yml works. For pipelines, you'd need to create a staging and prod service within the yaml file (i think, i'd be curious for a second opinion/someone to come up with an alternative approach). You can also turn on preview apps that clone your production database whenever a PR is open (which is a slick feature).

Dev experience hasn't reached parity with Heroku, but they're working on it. You can see their roadmap with features: https://feedback.render.com/

Overall this is a promising offering and I bet in a year that it'll be as good, if not better, than Heroku. It was also empowering to be able to easily migrate from Heroku without too much pain, in case of emergency.

Pros

Cons

Screen Shot 2022-09-08 at 3 35 14 PM
smcalilly commented 1 year ago

here's a list with some other alternatives: https://testdriven.io/blog/heroku-alternatives/

another thread: https://news.ycombinator.com/item?id=33077118

smcalilly commented 1 year ago

I've gotten both Fly and Render working.

Next steps:

smcalilly commented 1 year ago

So for fly, I had a lot of trouble getting it to work with our Docker setup. It doesn't want to deploy a new app when it's Django + Docker. Derek and I stumbled into a solution where we tried to build the app from the Docker registry. This didn't completely work since the Docker image isn't registered, but it worked enough to trick fly into creating a new deployment which allowed us to deploy the app from the local Docker image. Showing this process in a demo would be better than words. I think having another developer try would add a fresh perspective.

I've documented part of the issue in a comment on their community forum: https://community.fly.io/t/django-ftyctl-launch-makemigrations-exit-status-1/6776

When comparing the developer experience to Render, Render easily wins. Render has review apps and the deployment story feels more like Heroku because you can connect a GitHub repo. Render does not have CLI, but they're working on it. Fly does have a CLI but this was the source of my problems (however it's open source and we could help improve it for our use case).

In the current state, I could see Fly being very frustrating for a developer, especially somebody who doesn't have much experience debugging these sorts of issues (like myself). This could change over time, especially since I read a Hacker News comment by one of Fly's team members that developer experience is something they're planning to focus on. Likewise, Render will improve with time (see my comment above in my render notes about the deal breaker (no release scripts, but they're planning on it)).

I would consider using Fly if I wanted to deploy a native Python application without Docker, needed a server environment with more configuration control than Heroku or Render (you can easily scale up or down the virtual machines and such), or wanted a powerful platform with high availability across the entire world. Fly's best feature, at the time of writing, is very fast response times in multiple geographic locations without a devops team — this blog post explains some of this. This would be a compelling platform if we needed to deploy an app that would be used across the world (like SFM), though most of our application users are located in the US.

smcalilly commented 1 year ago

At the time of writing, neither Render or Fly are at parity to Heroku, so we're going to let the platforms bake and later reassess moving to one. They are cheaper than Heroku, but the developer experience isn't there yet with our preferred stack (Django, Postgres, Docker).

Render

Render has a DX closer to Heroku, and can support both our preferred Django stack as well as our sometimes-used Gatsby stack. Their docs also claim to have "one click" elasticsearch and redis integrations.

Render cons:

Fly

Fly has a better ability to configure the machine to an application's needs — it feels more bare metal (in a good way) but easier to use than something like EC2. Plus it has the magic of a global network so your application is speedily served across the world.

Fly cons:

smcalilly commented 9 months ago

We've been using Vercel in the SFM project, is this a replacement for Heroku? Or is it only a replacement for Netlify?

nikonikoniko commented 9 months ago

In my experience, for anything outside of the next.js ecosystem, Vercel is more like Netlify + AWS Lambda together. For JS apps (backend and frontend) It can be a pretty full framework. Hope that helps!