Fly with many containers

I am evaluating using Fly for the prototype of a project, but I don’t know if I can adapt it to Fly.

The project basically consists of a load balancer, several back end instances, a proxy to the database and several instances of the database (forming a cluster).

Is it fatible? Any example or tutorial that generates a similar structure? Thank you!

What kind of database(s) are you thinking?

The PostgreSQL project we’re working on is roughly that kind of layout. The most difficult part of putting databases on Fly is bootstrapping clusters that aren’t really designed to work in container environments.

Proxy layers and backend apps are simple! I’d probably model each of them as their own Fly app and use private networking + DNS discovery to connect to them.

The load balancer might be unnecessary, but it’ll work just fine if you have special load balancing logic to implement.

If you can tell us more about the specific apps / software you’re working with I can point you to some examples and help get it going.

Currently in the local environment I have:

  • A load balancer.
  • A back end using fastifyJS (with several instances to spread the load).
  • A proxy to the database (RethinkDB)
  • A cluster made up of several RethinkDB instances.

ps: I’m using consul for service discovery.

If I keep this structure, should I have an app for each part?

Ah! We haven’t tried RethinkDB, but if it supports IPv6 it should work fine.

I think you can skip the load balancer, and possibly use our built in DNS service discovery. The proxy could either be its own app, or you could roll it into the RethinkDB VMs.

If you can get a DB going with Volumes, and call it something like my-app-db, you can connect to it from either the rethink proxy or your fastify app using my-app-db.internal.

Where are you hosting RethinkDB now? You could also try putting your app + RethinkDB proxies on Fly and connect them to your existing cluster.

Actualmente tengo todo en local.

RethinkDB y el back and puedo implementarlas como apps separadas? Si es asi, suena mas simple que armar un cluster de Kubernetes o Nomad.

pd: voy a buscar como usar el balanceador de carga y descubrimiento de servicios de Fly.io.

Yes separate apps should work great! And it should be much simpler than Kubernetes or Nomad (we use Nomad under the hood).

1 Like

Sorry I copy the text in spanish, my original language.

No worries! Google Translate worked, it was completely understandable.