Deploy fly apps using custom made bot

We’re switching our infrastructure from Heroku to Fly.

We have built a small chatbot that allows us to deploy to production apps easily. That is done via Heroku API calls such as

POST https://api.heroku.com/pipeline-promotions

I’ve been searching for something that would allow us to do the same thing using fly, however, all I can find is flyctl. Is there any publicly available API we could use to achieve this?

There are apis but they are loosely documented. I recommend reading through how flyctl GitHub - superfly/flyctl: Command line tools for fly.io services and the terraform provider GitHub - fly-apps/terraform-provider-fly: Terraform provider for the Fly.io API do things. Also check out GraphQL Playground particularly the docs tab you can access on the far right of the screen. The machines references is also helpful Machines · Fly Docs.

This is going to sound silly, but the best way to automate Fly deploys is probably to just run flyctl from your bot code.

Heroku pipeline promotions basically work by deploying the result of a previous build. The basic process of this on Fly is:

  1. Build your Docker image, probably with a CI tool
  2. Tag image with registry.fly.io/<app>:<tag>
  3. Push to registry.fly.io
  4. flyctl deploy -i registry.fly.io/<app>:<tag>

You can use our GraphQL API to replicate this logic but it’s more work. And flyctl is designed to be easy to run, you can just bundle it with your bot and shell out to it directly.

2 Likes

Thank you so much! Will explore both solutions then. The flyctl method definitely feels the easier to work with