1. 18
    Create a fly.io Account and Prepare a Project for Deployment
    2m 23s

Create a fly.io Account and Prepare a Project for Deployment

Lazar Nikolov
InstructorLazar Nikolov
Share this video with your friends

Social Share Links

Send Tweet

To persist data for our like button feature we will need to run a server. Fly.io is a great service that has a free tier that we can use to accomplish just that.

We will sign up and instantiate a Fly.io project in this lesson.

Lazar Nikolov: [0:05] To build our API and connect it to a database, we would need to host our Astro site to an actual server with persistent storage. We'll move our website's deployments from Vercel to Fly.io. In this lesson, we're going to create and set up a Fly.io account.

[0:16] First, you're going to need to sign up. You can use either GitHub or Google, or just email and password. After we sign up, we'll get a, "Welcome to Fly," screen, which prompts us to install the flyctl CLI app.

[0:29] After we install it, we're going to run flyctl auth login to authenticate the CLI app with our account. We're going to click continue and close the window. There we go. We have successfully logged in. Now we're ready to set up a project in Fly.io.

[0:44] Before we begin, Fly will ask for our credit card. Make sure to get that set up in your billing settings. Don't worry though, we're going to stay within Fly's free allowances, so you won't be billed.

[1:02] Let's set up our Fly app by running Fly launch at the root of our project. First, it'll ask us to provide the project name. The project name doesn't really matter. It has to be unique. If you want to take the easy way, just leave it blank. Fly will generate that for you.

[1:12] If your account is not brand new, it'll ask you to select the organization. If it is, you won't see this step. I'm going to choose the Astro block organization that I specifically created for this project. It'll ask us to choose a region for deployment. Pick the one that's closest to you. Then Fly is going to generate a few files for us.

[1:33] Let's check them out. You can see that we have the fly.toml file. It has the app, the region that we selected, and an HTTP service block. We also have a Dockerfile that runs the build command and exposes the port 3000. We also have a Docker ignore file with some specific values. These files are not going to be final, but feel free to check them out in better detail if you like.

[1:57] The configuration that we're going to create is going to be much simpler than this one. That's it for this lesson.

[2:03] Let's do a quick recap. We went through the process of signing up for a Fly.io account, downloading the flyctl CLI application, authenticating it, and running the Fly launch command. Which created the initial files we need to deploy our application. In the next lesson, we're going to work on the Dockerfile for our deployment.