I guess everyone was underwhelmed about the latest news from Heroku that left you with new questions like: “what should I migrate to?”. One of those answers might be fly.io due to their reasonable pricing that looks quite decent compared to Heroku.
Fortunately, migrating your Heroku apps to Fly.io is really easy! You have at least two ways to migrate your app:
- Use the automated-migration tool created by Fly.io – https://fly.io/launch/heroku
- Migrate manually using the documentation
For the sake of this tutorial, we’ll go with the latter.
I’m assuming you already have fly cli installed. If not, go to their documentation: https://fly.io/docs/getting-started/installing-flyctl/
Let’s say you have Node.js application or any supported application on Fly.io. Now it’s time to go to your project directory and run this command:
fly launch
It will automatically recognise a framework, set up the basic configuration and deploy it. During that, you’ll be asked to provide a new app name and to select the closest server location to you.
Your application is deployed and accessible now via a new url: YOUR_APPLICATION_NAME.fly.dev
You can also find the new url in the Fly.io dashboard 🙂
Before we wrap up, there’s only one thing to remember which is that the deployed app won’t go to sleep automatically when the VM is not being used. This is very important because our free tier has 2,340 hours per month. If we have 1 or 2 apps then it’s fine because we won’t exceed the limit. If you’re going to add more apps then you need to create new apps via REST API and use Fly machines. The whole process is defined here: https://fly.io/docs/reference/machines/#create-a-fly-application (there’s one tricky part when your machine don’t want to boot up. To fix this, you have to run fly deploy
).
In our case, we’re going to have only one application so we don’t have to worry about that all.
If you’ve gone through all these steps, you should have your application working on the Fly.io 🚀 Congrats!