Fly.io
Learn how to deploy your TurboStarter app to Fly.io.
Fly.io makes deploying web applications to the cloud easy and efficient. It handles scaling, monitoring, and logging so you can focus on building your app.
This guide explains how to deploy your TurboStarter app on Fly.io. You'll learn how to leverage Docker containers to deploy your app, set up builds, and manage environment variables for a smooth and reliable deployment.
Setup Fly CLI
As we will be using Fly CLI to launch and manage our app, you need to install and setup it on your machine.
Check the official documentation on how to install Fly CLI.
After you've installed Fly CLI, you need to login to your Fly account and connect it with your machine:
Read more about authenticating CLI.
Now you're ready to launch your app!
Launch project
Use a Dockerfile to launch your app with Fly CLI. You can use the following command to do this from your local machine:
Make sure to set all the required configuration in the CLI steps (e.g. set port to 3000
, setup additional services, choose billing plan, etc.).
Customize region for better performance
If you want to achieve better performance and lower latency in your API requests, you can customize the region of your Render service. Make sure to set it to the region closest to your database and users.
After the launch is complete, Fly will output your project configuration into fly.toml
file. The configuration of your project is stored there, feel free to customize it to your needs:
See Fly.io documentation for more information on how to use this file.
Set up secrets
To make your app fully functional, you need to set up required environment variables. You can do this by running the following command:
They will be automatically added to your app's runtime environment.
Deploy!
Each time you make changes to fly.toml
or secrets, you need to re-deploy your app to apply changes to the running app.
To do this, just run the following command in your project directory:
This will build your app and deploy it to Fly.io with the latest code version.
That's it! Your app is now deployed to Fly.io, congratulations! 🎉
Fly is a platform that allows you to deploy and manage applications in the cloud. It provides a simple and intuitive way to deploy your app, with features such as automatic scaling, load balancing, and rolling updates. With Fly, you can focus on building your app without worrying about the underlying infrastructure.
Last updated on