New to Fly.io, several questions :)

Hello there,

Please find questions about Fly services :

  • Most important question : can machines be balanced this way : 1 request = 1 machine, if no machine available, an error is thrown ?
  • Can endpoint be protected ? Our backend, that is not on fly.io, needs to call http endpoint to start machines, but we don’t want that random http request call our endpoint and start machines. I guess I could set up a proxy on fly.io to handle such auth mechanism, but frankly I would prefer avoid it…
  • How many machines/resources can we use ?
  • Is there a NodeJS/Typescript/Javascript client library ?

Thanks everyone !

Hi @Biscuit

  • I believe you might be able to to get 1 req = 1 machine if you set soft_limit and hard_limit to 1. I recall a customer who attends this forum does that but I couldn’t find that post.
  • Can you talk more about your use case of endpoints that start machines? I don’t think I fully understand what needs protection
  • We have a soft limit of how many machines a new org can have (set per organization) but if you find that you need to spawn several machines feel free to reach out to us.
  • At the moment we don’t offer official SDKs in any language. In Golang though we ship some needed stuff in our CLI.

Thanks for this quick reply. I found this : Concurrent Tasks on Machines · Laravel Bytes which I think explain how to achieve what we need.

Regarding securing endpoint, I would like that our backend calls for example https://myapp.fly.dev . When http request ended, then worker finished its task. But if any random web bot call this URL (as we often see in server logs), it will start a machine, and we will be billed accordingly…

For machines amount, for tests, it’s ok for now, but for production, we will use sometimes dozens of machines (1 proc with 1/2 GB each request).

Regarding SDK, I guess we don’t need it ATM thanks to http endpoint functionnality.

I see now!

To prevent random bots from being able to wake up your machines I’d say remove public IP addresses from that machine and work with a Flycast IP (make sure to have a services section!) since it can wake your machine on HTTP.

Its gonna be really easy if it’s a Fly machine calling a Flycast IP because our networking Just Works :tm: but if you need to call that machine from your Not-on-Flyio server you’d probably want to connect it to Fly using Wireguard which is easy and also Just Works :tm:.

Here’s an example of a customer who needed just that: Automatically start and stop internal services

Hi, I am building a product that’ll run user code in machines and I can’t predict how many I’d need. So what is this soft limit you talk about? how many?
Do I get email when I’m reaching 80% of this limit?

I just checked and the default is 20 running machines at the same time. I don’t think we email but we warn on Flyctl/Machines API. Feel free to reach out to billing[at]fly.io if you need more.

Many thanks. And do requests have a max timeout ?

Someone can correct me if I’m wrong but I believe our proxy terminates idle connections at 60 seconds. Unfortunately I couldn’t find the post here on our community forum talking about it!

This post talks about removing the timeout restrictions and about how connections are dropped if they get backlogged.

This seems to answer the question. I’ll do some tests :). Thanks.