Creating an App on Fly
Fly allows you to deploy any kind of app as long as it is packaged in a Docker image. That also means you can just deploy a docker image and as it happens we have one ready to go in
Each Fly application needs a
fly.toml file to tell the system how we'd like to deploy it. That file can be automatically generated with the command
flyctl init command.
? App Name (leave blank to use an auto-generated name) hellofly
App Name: We recommend that you go with the autogenerated names for apps to avoid namespace collisions. We're using
hellofly here so you can easily spot it in configuration files.
? Select organization: Demo (demo)
Organizations: Organizations are a way of sharing applications between Fly users. When you are asked to select an organization, there should be one with your account name; this is your personal organization. Select that.
? Select builder: Image (Use a public Docker image)
Builders: Builders are ways to turn your code into a deployable image. When prompted here, select Image to use the a public Docker image.
? Select Image: flyio/hellofly:latest
Image: Enter the name of the Docker image you want to use here. Just hit return to get the default
? Select Internal Port: 8080
Internal Port: This is the port that our app uses to communicate to the outside world. Hit return to get the default, 8080.
New app created Name = dawn-wood-553 Owner = dj Version = 0 Status = Hostname = <empty> Wrote config file fly.toml
fly.toml file now contains a default configuration for deploying your app. In the process of creating that file,
flyctl has also created a Fly-side application slot of the same name, "hellofly". If we look at the
fly.toml file we can see the name in there:
app = "hellofly" [build] image = "flyio/hellofly:latest" [[services]] internal_port = 8080 ...
flyctl command will always refer to this file in the current directory if it exists, specifically for the
app name value at the start. That name will be used to identify the application on the Fly platform. You can also see how the app will be built and that internal port setting. The rest of the file contains settings to be applied to the application when it deploys.
We'll have more details about these properties as we progress, but for now, it's enough to say that they mostly configure which ports the application will be visible on.