Where do you host **small** or even tiny elixir projects?

I have been running Dokku on a hetzner VPS for a couple of years for several architectural spikes, one phoenix. Once it was set up I found it easy to maintain (but I adopted containers before docker, YMMV). Set up involved a bit of trial and Error.

What I like about Dokku is that it makes it very easy to gradually develop and launch. Eg start new site, add letsencrypt for it, start developing without login, just add dokku basic auth, see if the idea works and then later add logins, access control etc. And I get effortless remote private git repositories for every experiment.

Possible downside is that you need a bigger vps than for just hosting, since dokku also builds before running (mine was already oversized because of a haskell deployment, I donā€™t know if this is an issue with elixir). It can also pull images, but I quite like the tight push-build-deploy flow.

I was not aware of coolify. Might look into it to see how it compares.
(And nice to see @artem around, I believe we met eons ago at a conference in Helsinki).

4 Likes

Iā€™ve been increasingly looking to Livebook apps for this exact use case! Just set up a single Livebook instance on your favourite hosting provider, develop your app using Kino, or PhoenixPlayground, hit ā€œDeployā€ and enjoy!

The biggest drawbacks right now are that you canā€™t host anything at the root path (everything is nested under ā€˜/appsā€™), you donā€™t get domain-based routing, and you canā€™t easily design the homepage without running your own fork of Liveview.

Even so, the freedom to just jump into a Livebook, code something up and deploy it in minutes, at zero additional cost is beyond cool!

Also, with Livebook teams, you can actually have separate environments eg dev/staging/prod without compromising the workflow.

As an example, Iā€™ve set this up on https://speedrun.dev . No apps deployed right now, but you get the gist :slight_smile:

1 Like

Kamal and Hetzner does the trick:

5 Likes

You should look at Docker Watchtower for CD. GitHub - containrrr/watchtower: A process for automating Docker container base image updates.

You just let your CI pipeline push a new image and Watchtower will automatically pull and run it (I do not know if this is zero downtime though).

Another party trick that Elixir can do well but would be a terrible idea with other runtimes, is GitHub - sasa1977/site_encrypt: Integrated certification via Let's encrypt for Elixir-powered sites so that Elixir handles the lets encrypt certs. What I think you might lose here is that you canā€™t have one Nginx that is reverse-proxying different urls to different ports on the box.

I used watchtower and site encrypt on a VPS before I decided to just use Fly.io but if the cost savings were worth it to me I would totally go back to a VPS because it worked very well.

One way to limit the cost on Fly.io is to have a shared Postgres on Fly.

2 Likes

The thing that they mention to not use it in production and instead reach for k8s is very questionable honestly, this might point to potential issues with the technology.

From what is written in readme, it seems that the old container is stopped and the new one is started. This is not ideal, but for a project where you can afford downtime and donā€™t update often, this should be good enough.

I have a small second hand computer in my electrical cupboard that I deploy OCI containers to using a small shell script, podman, and systemd. Itā€™s great!

2 Likes

Iā€™m using a mix of Kamal and Dokku. Iā€™m transitioning more to Kamal since I like itā€™s architectural design more (Dokku insists on owning more of the host).

This is self-hosted on my rack of servers.

Kamal + Phoenix worked right out of the box. I only had to adjust nginx once I put nginx in front of Kamal (for wildcard SSL certs).

I found Elixir/Phoenix to be reasonably conservative on RAM, with my latest app consuming ~ 150MB.

2 Likes

Thanks a lot for so many great answers! I donā€™t dare to mark any of them as a solution, because all these options are. Will be studying what works best for my case and maybe then post here what worked.

3 Likes

Virtual Machine on my PC.

I have a non-standard deployment that works well for my needs. I run a Nerves instance on https://www.vultr.com by using nerves_system_vultr. It costs me $5/mo. I have an SQLite db I keep on the same host.

I use it to run DepViz and a few other tiny sites. If youā€™re interested in how it works you can find the code on GitHub: GitHub - axelson/vps.

For me the biggest downsides for hosting web apps in this way is that all the dependencies have to be in sync and itā€™s hard to add external dependencies (since thereā€™s no apt get install).

1 Like