Examples for application + database

I am trying to deploy a backend service which uses a MySQL database. I am not sure if I am understanding this correct, so I wanted to ask.

I want to host both the backend (fastAPI app) and database (MySQL) through Fly. Does it mean that I need to make 2 Fly apps: one for the backend and one for MySQL? I am a little confused about this and cannot find examples.

Thanks!

Yes, you should create 1 app for MySQL, then 1 app to host fastAPI

Read more at: Use a MySQL Database · Fly Docs

Thank you for that. Just to be sure, I will have two fly.tomls, correct?

So I can structure my project something like

  • Backend
    • fly.toml for python app
  • DB
    • fly.toml for MySQL
1 Like

Correct. It’s how I deployed my apps with MySQL.