artem

artem

I like creating small projects open to the whole world. Something in style of my_general_domain.com/great_mortgage_calc_in_live_view

These would never be very popular, they would always have tiny audience if any. If some of them by accident ever become popular, I’d deploy them on render.com or fly.io , but before it happens in many cases these aren’t even worth a domain.

If these were done in JS (even with some server side next.js/nuxt.js) I’d post endless amount of them on netlify.com or some competitor for free or very cheap.

What would be a place to host such projects when done in elixir? I don’t mind paying some $5-10 or even $20 a month for hosting, but not per-site.

Or how do you host your tiny hobby projects and exercises?

Showing Posts 1 to 10

lccezinha

lccezinha

You can also check Tiers & Pricing | Gigalixir

travisf

travisf

I’m a big fan of fly.io. They don’t bill if you spend less than $5/mo. Now that I have an Elixir project and a Ghost blog hosted there I think I’m paying about $11/mo

artem

artem OP

Hmm, I can see how fly.io and gigalixir are good for one project (I even use render.com in similar case for one project), however, I am looking for a way to run a dozen or two projects cheaply.

Possibly on a slow machine, with very limited traffic, but running all the time (or with a fast start, not with 50sec long start).

dtew

dtew

I have an old macbook pro (with a broken screen), plugged into the internet in the office, on which I run cloudflare tunnel for free. I run multiple phoenix apps which people access via a domain name, in the usual way. (In my case, these are not public sites … they are for our internal users). If you have a suitable macbook (or pc), then this is all quite simple (even for me → chatGPT is my friend) and free except for electricity. This has been running successfully - faultlessly one could say, for over 18 months.

(I also have cloudflared on my dev macbook for development - same idea).

lud

lud

An OVH dev sandbox is good for hosting small projects if you do not need performance.

But you are the admin of the machine.

artem

artem OP

Hmm, indeed the single cheap VPS machine can probably run many Phoenix instances for just several bucks a month.

Is there anybody who is actually doing it? Do you put everything to docker and setup nginx to serve different projects at different /paths ? How do you plan amount of RAM needed per project? And deployment to go manually via SCP file copying?

Or is there a better way? Like making projects share same RAM somehow (it is extremely unlikely that several tiny projects become popular or even used by more than a couple of visitors simultaneously)?

arcanemachine

arcanemachine

If you own a domain (e.g. artem.xyz) you can put a Phoenix site on each subdomain (e.g. project-1.artem.xyz, project-2.artem.xyz), or you can use a reverse proxy like nginx to put each project in a different path for a given origin (e.g. artem.xyz/project-a, artem.xyz/project-b).

I put my toy projects on a cheap VPS (Hetzner). It’s good practice to run something like that because it also teaches you the basics of DevOps. Sure, you can pay someone like Netlify or Render or fly.io to hide the difficult stuff away, but learning how to do it yourself is a great skill to have. And it’s really not that difficult once you understand what is going on.

So my setup for these toys is to create the server, then use Ansible to set up the server (create users, disable root access, install and configure services, etc.). Then I have a playbook that pulls my Git repo, builds a Docker image, then restarts the server with the new container.

First, you set things up manually, then automate them. There’s tons of great tutorials online that will show you how to set this stuff up.

10
Post #7
LostKobrakai

LostKobrakai

You can take a look at mainproxy, which runs all projects in a single beam instance, which should remove overhead in RAM usage of the VM. Though I’d only go there if that really becomes a problem. E.g. you could also use swap space to increase your RAM ceiling if you don’t expect traffic at the same time.

cmkarlsson

cmkarlsson

I run a number of small Amazon EC2 VPS where I have nginx as a reverse proxy into several elixir/phoenix applications. I deploy them as elixir releases. I have a bash scripts that scp the release to the server, unpack the release and restarts the systemd service. In addition I have a tiny acme script renewing the certificates for them.

They use the same MySQL/Postgres instance which is running on the server.

They are low traffic, used for administration purposes. They are currently sitting at 60Mb RAM usage. I don’t think it would be worth running multiple applications in the same beam to save RAM. It is quite affordable to just increase the RAM resources slightly if needed.

D4no0

D4no0

The stack

I’ve personally deployed directly on VMs for years using docker-compose, that includes commercial products, some of them were pretty beefy. Not only this is painless after you have your sample configurations and a workflow, but you are never limited to one cloud provider/platform.

I used to run the following services by default:

  1. Nginx - running in reverse proxy mode that is also responsible for https traffic;
  2. Certbot - responsible for fetching and refreshing letsencrypt certificates;
  3. Postgres - in 95% of cases, having a self-managed postgres instance located on the same VM is better than alternatives, both in terms of reliability/resource usage/latency.

I’ve updated my setup recently and now I’m using nginx proxy manager instead of nginx+certbot, you lose the declarative approach, however it’s that much easier to get https up and running, for me this is always painful when deploying a brand new project.

The only caveat with this approach is that your project needs to be dockerized, I use mainly gitlab + custom runners to achieve this, however it’s clear that this setup is more involved out of the box because of docker, maybe it could be improved by injecting the release in the container instead of building immutable containers.

Deploying new versions

The setup I use to deploy new versions is pretty primitive, I basically have a git repo called my_project_infra, that contains the docker-compose.yml and all the additional configuration required to deploy that product + some shell scripts to make this work easier. I leverage on git to be able to revert to old configurations if something goes wrong, worked with this setup in production with great success.

I can do zero downtime deploys. The only big thing that this is missing is continuous delivery, which I want to do for all projects these days. I will definitely invest some time in the future to make this work independently of any cloud providers on the market.

Self-hosted vs VPS

Until recently, I was using hetzner (usually for dev envs + runners) and aws (for prod) VMs for deploy, until I recently finally configured my own server at home.

I want to say that having your own infrastructure makes things 100x times easier, especially if there is networking involved. I literally have now practically unlimited resources at the cost of 20$ I pay for the electricity (I have a beefy hp proliant server, so you might easily get away with 5$ for electricity if you have a more power-efficient system).

The home server is also times more reliable as I have it currently running in raid 1 + I plan on setting up a NAS for periodic backups/snapshots, this kind of reliability comes at a premium if you offload it to a cloud provider.

As for networking, as other mentioned above, if your provider blocks inbound connections, using cloudflare tunnels is the way to go, their free plan is very generous and it’s a turnkey solution that I’ve used reliably in the past. The only caveat is that you take some time to understand the security implications of passing unencrypted traffic through their systems.

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews