Free tier 2 machines limit and Elixir Phoenix deployment - not possible at all?

Hi all

I am very new to fly.io and relatively new to the whole Elixir world actually. I am trying to deploy my first Elixir Phoenix app and playing with free tier. It uses Ecto-Postgres, LiveView, and some more javascript (installed via npm). I managed to get fly launch to building an image and push it, but then I am getting the following error:

Provisioning ips for voicepen
...

Running voicepen release_command: /app/bin/migrate
  release_command 17811175a0e678 completed successfully
This deployment will:
 * create 2 "app" machines

No machines in group app, launching a new machine
Error: error creating a new machine: failed to launch VM: To create more than 1 machine per app please add a payment method. https://fly.io/dashboard/artem-808/billing
Please note that release commands run in their own ephemeral machine, and therefore count towards the machine limit.

Now I am confused. If I understand it correctly, fly.io should be good for playing with small Elixir Phoenix trials before you go to the real production, but from the message is sounds like it’s not going to be possible :confused:

Could you, please, help me understand how machine limit works in a free tier and Phoenix app?
Do I get it correctly that machines are used as follows?

  • one machine for postgres
  • one machine for the where Phoenix should run
  • one temporary machine for just the build and… it’s already beyond the limit

What to do about it?
Is it indeed this way? How do you guys run Phoenix app on a free tier?

  • Do you just switch to paid tier?
  • Or do you use PostgreSQL from some other provider?
  • Or am I missing something basic?

Hey @artemf!

I tried deploying with fly deploy --ha=false and got the same error as you.

I tried fly scale count 1 to scale down to 1 machine and still got the same error.
In that organization (without a payment method),
I only had 1 other machine for the Postgres database.

I originally wanted to send these suggestions to help you,
but hope a Fly.io team member gets to this soon.

1 Like

hi @artemf

Accounts require a credit card, primarily to prevent abuse. If you add a payment method, but stay within the free allowances, then you won’t be charged.

More info about credit cards: How We Use Credit Cards · Fly Docs

If a credit card is required, why don’t we require it upfront?
This way the requirement is more explicit and we save the back-and-forth.

Also, in the Dashboard > Trial Plan section, we could link to what is allowed without a credit card and what is unlocked for free when you add a credit card (the green text is not a link).

image

(yes, I created a new account to reproduce this :stuck_out_tongue:)

Oka-ay, I understand it, but not sure I understand how it is related to free allowances.

  • Are you trying to say that my deployment fails, because all (or most of?) the free allowances only work with credit card added?
  • Or is it that what I am trying to do (just a small Phoenix app with a tiny Postgre DB) is beyond the free limits?

We offer the free allowances, but still require a credit card to help us keep down abuse and fraud.

It’s very possible your app and db will fit into the free allowances! You can monitor your usage and make sure.

1 Like

Adding credit card helped, app is now deployed live and… for some reason dashboard and fly status show two machines in the app + 1 for db + 1 free builder.

I don’t really mind it if it’s free, yet if I read fly.io pricing rules correctly it means 4 machines during deployment, so beyond free limits and… I don’t really need that second app machine for the toy trials. fly scale count 1 fails to decrease instances to 1. What would be the proper way to do it?

P.S.
@andie my particular problem seems to be solved enough to get me going yet in general possibly it could be a good idea to add to elixir quickstarts info on that a typical phoenix app will only be started if credit card is added.

1 Like

@artemf Glad you got going!

Your builder app doesn’t count toward any limits.

We do deploy two machines by default for apps. This redundancy ensures your app stays up even if something goes wrong with a particular host. The auto start and stop feature (enabled by default in your fly.toml file) is useful for this because machines shut down and then start up again only as needed.

But if you are okay with the risks, you can run one Machine.

I’m not sure why fly scale count 1 didn’t work for you, it should! You can also try manually destroying one of the Machines: fly machine destroy <machine id> --force.