flyctl
fly postgres create
, give the new fly app a name, select its location and machine setup. For this example the development configuration was used, but you can choose to make yours highly available with the other options.
fly deploy
, we can’t alter the entrypoint or run command from fly deploy
so we need to directly create our fly machines
To create them directly we can use a Dockerfile which we’ll simplify to a single line:
fly launch
command and edit the fly.toml
file that gets created:
Dockerfile
and fly.toml
configuration:
serve
in order to run the container without any additional configuration.
fly launch
to get an initial configuration setup and generate a basic fly.toml
file. You can tweak the default configurations to change Region, App Machines, Memory, etc.
flyctl
command fly launch
to get our app working. We’ll remove the generated section [http_service]
and add two [[services]]
sections to our configuration.
This is so we can expose both the REST API and gRPC ports of 3476
and 3478
. If you only want to expose one or the other, then keep only the port service that you wish to expose.
fly deploy
. Once it’s done building and the status is showing as deployed, you can check the url provided by Fly to your app in your web browser if the REST API port was exposed by checking the health endpoint https://<your-app-url>:3476/healthz
and you should see {"status":"SERVING"}
.