Configuring Fly

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 apps create command.

flyctl apps create
? App Name (leave blank to use an auto-generated name) hellofly
? Select organization: Demo (demo)
New app created
  Name     = hellofly
  Owner    = demo
  Version  = 0
  Status   =
  Hostname = <empty>

app = "hellofly"

Wrote config file fly.toml

Note: 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.

Also: 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.

The 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"

[[services]]
  concurrency = "20,25"
  internal_port = 8080
  protocol = "tcp"

  [services.port]

    [services.port.443]
      handlers = ["tls","http"]

    [services.port.80]
      handlers = ["http"]

  [[services.tcp_check]]
    interval = 10000
    timeout = 2000

The 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. 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.