Managing deployments in a monorepo

Hi :wave:

I’m new to fly.io, and i’m stoked to use it! I have a few questions on how to manage deployments in a monorepo? Is there any monorepo examples with Fly PR review apps?

I currently have:

  • Rust API
  • Astro Frontend
  • Admin Astro Frontend

These depend on:

  • Postgres
  • Redis
  • Meilisearch

Welcome!

There are a few ways to do this:

  1. Multiple apps (one per “project”)
    • Either multiple fly.toml (one for each app)
    • or a single one and you deploy by specifying which app to use with the “generic” fly.toml
  2. Single app with a process supervisor to launch each component

You can also use either multiple Dockerfile or a multiple targets in a single Dockerfile if that makes sense for your app (but I don’t think it does).

You probably don’t need to have the admin frontend running everywhere, so that sounds like a different app.

Every app within the same organization can communicate securely via its private network.

Does the Astro frontend need to make requests through the Internet? If so, then you probably need a separate app for it and the Rust API. If not, then you can possibly save a few tens of milliseconds by keeping both the frontend and the Rust API in the same app. Using the private network is also a bit faster than going through the Internet (and our proxy).

All our databases could be only reachable through the private network for your organization, reducing attack surface by a lot.

If Redis is used as a cache, then it could run in the same app as whatever uses that cache.

Lots of possibilities!

What do you mean by this?