View Source FLAME.FlyBackend (flame v0.1.9)
The FLAME.Backend
using Fly.io machines.
The only required configuration is telling FLAME to use the
FLAME.FlyBackend
by default and the :token
which is your Fly.io API
token. These can be set via application configuration in your config/runtime.exs
withing a :prod
block:
if config_env() == :prod do
config :flame, :backend, FLAME.FlyBackend
config :flame, FLAME.FlyBackend, token: System.fetch_env!("FLY_API_TOKEN")
...
end
To set your FLY_API_TOKEN
secret, you can run the following commands locally:
$ fly secrets set FLY_API_TOKEN="$(fly auth token)"
The following backend options are supported, and mirror the (Fly.io machines create API)[https://fly.io/docs/machines/working-with-machines/]:
:cpu_kind
- The size of the runner CPU. Defaults to"performance"
.:cpus
- The number of runner CPUs. Defaults toSystem.schedulers_online()
for the number of cores of the running parent app.:memory_mb
- The memory of the runner. Must be a 1024 multiple. Defaults to4096
.:boot_timeout
- The boot timeout. Defaults to30_000
.:app
– The name of the otp app. Defaults toSystem.get_env("FLY_APP_NAME")
,:image
– The URL of the docker image to pass to the machines create endpoint. Defaults toSystem.get_env("FLY_IMAGE_REF")
which is the image of your running app.:token
– The Fly API token. Defaults toSystem.get_env("FLY_API_TOKEN")
.:host
– The host of the Fly API. Defaults to"https://api.machines.dev"
.:services
- The optional services to run on the machine. Defaults to[]
.