Cost effective and robust options for deployment

Hi all,

I spent the last few months learning the basics of web development (although I do have a few years of professional programming experience) and now I’m working on a TAPE stack website that I’d like to eventually deploy in production. I’m currently evaluation available services and ideally, I’d like to find a solution that meets the following criteria:

  • Sensible pricing that would work for a solo part-time developer
  • Reliable database that I would be able to migrate to another solution if needed
  • Self-healing capabilities in case the server goes down
  • Some level of log monitoring
  • Not overly complicated CI/CD integration
  • Zero-downtime deployment

At that point, I’d like to add that if you think I’ve missed anything important in my requirements, then please let me know.

So far I’ve considered the following options:

  • Gigalixir: I really like this option, but it’s quite expensive. The cheapest option would cost me about $30 per month. There is also a free tier, but the documentation says that it’s not suitable for production. Is anyone using the free tier for production? If so then what are the risks? Instability? Slow loading?
  • Render: Also looks really good and cheaper than Gigalixir (~$15 per month). Pricing aside, one reason I prefer Gigalixir over Render is that it there’s more documentation on how to run Phoenix on Gigalixir. Considering the pricing though, I’m leaning towards Render at the moment. Are there any other significant disadvantages of Render when compared with Elixir to justify the extra cost?
  • DigitalOcean Droplets: The most basic option is quite cheap, only about $5 per month, but it’s just a bare-bones VM, so I’m not sure if the pain of setting everything up is worth it. I suppose I could run a DB as well as the phoenix server on the same VM with docker-compose, but I’m not sure if this would be a robust solution… If anyone is familiar with the topic, would you say that the free tier of Gigalixir is a better option that a DigitalOcean droplet running docker-compose as described?
  • Scalingo: Thanks to @shad for pointing this one out! Scalingo looks very solid. It’s as cheap as Render and it seems to meet all my requirements. Additionally, it comes with a CLI that appears to make Phoenix app deployment a breeze

There are other options too such as GCP/AWS/Azure but I think they would be similar to DigitalOcean as they would just give you a VM to work with (please correct me if I’m wrong!).

Lastly, I’d like to note that for some reason, the part that unsettles me the most for some reason is database management. I’m concerned that if I go for a flaky solution e.g. DO droplet that I might incorrectly set up myself or a free-tier database that might cause problems then I might potentially either lose data or somehow screw up DB migrations at some point, but I’m not sure if my fears are justified :slight_smile:

Let me know if you can think of any other services that should be added to this list. Also, if you have any thoughts on this topic or if you can answer any of the questions I’ve raised, then I’d love to hear from you.

Many thanks :slight_smile:

Edits:

  • Added Scalingo to the list
8 Likes

Have you considered Heroku? That will turn out to be more expensive than your listed services. In that case, there is an escape with Digital Ocean with Dokku. You will have the seme deployment flow with buildpacka, but a lot cheaper. This is my suggestion when asked where and how to host side/hobby/nonprofit projects.

I would start with Digiatl Ocean or Linode, and use Traefik as the load balancer for your docker deployments, thus allowing you to rotate containers with new versions of your code, while at same time it takes care of creating and renew LetsEncrypt certificates automatically for you.

At work I have wrote a Debian Traefik Setup guide to help our potential clients to run our demos in online servers, thus you can use it as a base to create a production ready stack:

I also wrote guide to run Traefik on AWS EC2:

You can see an example of the Traefik setup being used to deploy one of our demos for an Elixir backend in this repo:

IMPORTANT: Please bear in mind that this Elixir docker stack was created with the intention of deploying the 3 servers on the docker-compose.yml file online for testing proposes, and then bring them down once testing is completed, thus you may need to do some optimizations in the stack. One I can think off right now is to optimize the Dockerfile for multistage builds in order to reduce its size.

I don’t know why Heroku is even an option for any stack deployment. From the moment I read in their docs that they restart the dynos every 24 hours I just close the tab in the browser and never looked back to them as an option for my deployments.

How do people use them and handle their server going offline every night?

Or are a lot of developers using it without knowing that their app will be offline once a day?

You may say that it’s during the night, but for someone else in the world will be during the day.

Am I missing something?

3 Likes

I’ve personally used Scalingo for years now, mostly with NodeJS, and for the last 6 months a new Phoenix app (i’m using the default system their documentation specifies, never had any issue until now).

They’re based on the same system than Heroku. You can actually use pretty much any buildpack from them and it will work (including managed databases with backup and other stuff). In the case it wouldn’t for some reason, they’re support has always been fast (like less than an hour in the worst case). Don’t know how they compare in prices with others, but i don’t find them expensive (and with the peace of mind that comes with their services, i’m fine with whatever it costs me).

Regarding @Exadra37 comment about Heroku, Scalingo does not stop containers, nor do they put them to sleep, they run 24/7, and on the rare cases where they have to restart a container, they send you an email prior to it (happened like one time in the last 2 years or something).

One downside at the moment, they only have one region (Paris, which is enough for me, but might not be for you), supposed to open New York, San Fransisco, Tokyo in 2020, but they’re a bit late on that (should not be too long though now).

4 Likes

I think its rolling restarts so it is actually not offline.

Render is great and super easy. I use them myself. Have switched from DigitalOcean.

2 Likes

Thanks for the suggestions. Dokku looks pretty good if you are going with DigitalOcean. Definitely worth looking into. As for Heroku, I’ve actually used their free-tier in the past, but it was extremely slow, so I’d prefer to try something different. I understand though that if I go with a paid version, it’ll most probably be faster.

2 Likes

Hey, thanks for sharing, it looks like a solid solution for zero-downtime deployments, but I’ve gotta admit that I’m still a little intimidated by handling low-level stuff like that by myself :slight_smile:

1 Like

Thanks for sharing, that’s the first time I’m hearing about Scalingo but it looks pretty good. Price-wise they seem to be on par with Render and they also have documentation on how to deploy a phoenix app. Definitely worth looking into!

Great, thanks for sharing your experience, at this stage Render is my number 1 choice.

Assuming liveview, or any other stateful website, even a rolling shutdown means that your current state will be killed and has to be rehydrated.

For some stuff this is a very big nogo.

4 Likes

Oh… thanks for bringing this up, didn’t think of that!

That is true but you would need to cater to that in one way or the other. Like when deploying new code.

Beeing aware of this will happen because I deploy, which in such situation will probably done in a maintenance window rather than continous, is completely different to "it will happen once every 24 hours at a time you can not control, because it is totally dependant on your hoster.

2 Likes

In my opinion is totally unacceptable to have my hosting company dictating how I write my code, so that it can cope with their way of running their infrastructure.

2 Likes

And yet that’s exactly what Amazon is doing and people are very happy to throw millions at them. :003:

1 Like

Sure, I dont defend them but in reality its not a big deal for most apps. I would not host at Heroku partly for this.

I usually set up my apps for continous deployment so I might deploy 2-10 times per day. So I need to make sure that the stateful parts can recover state (hello postgres).

2 Likes

Can you point me to the place of the docs where they say that?

Personally I don’t like them, and I don’t use them for my stuff, but at work we use them and Google cloud.

Oh, I don’t mean that they reboot instances just like that (although I heard of that as well but I don’t think it’s happening anymore).

I mean that you literally have to architect your application a certain way to make use of all their dozens of services.

1 Like

I have used Linode for a long time and they always told me via support ticket when they would inter-vein in the hardware where my VPS was running and tell me what I need to do or not and how much of down-time or not I could expect or intermittent network failures. Though they just did it a few times in all the years I have used them.

So, I accept that host providers need to do maintenance in their hardware and very rarely I may be affected by it, but not daily :wink:

Vendor locking, that’s why I don’t like them, plus they are building all this locking on top of the shoulders of giants, read open source, and they usually don’t give back.

1 Like