FlyMachineClient.Orchestrator (fly_machine_client v0.1.0)

High-level orchestrator for multi-step or state-aware Fly API operations.

This module provides higher-level flows that often involve:

  • Checking resource states (e.g., pending vs. active)
  • Retrying or waiting for readiness
  • Handling subtle edge cases where Fly returns 500 or other errors during transitions

Example usage could include:

  • create_app_and_wait/2: Create an app, then poll get_app until the status is no longer "pending".
  • create_machine_and_wait/2: Create a machine, wait for it to be "started".
  • orchestrated deployments involving multiple resources.

Summary

Functions

Creates an app, then waits for it to become active. Accepts

Creates a machine, then waits for it to be in the "started" state. Example multi-step flow

Waits for the given Fly app to become active. Polls get_app until status != "pending" or until timeout.

Functions

create_app_and_wait(params, wait_opts \\ [])

Creates an app, then waits for it to become active. Accepts:

  • params: Map with :app_name, :org_slug, etc.
  • wait_opts: Options for how long to poll, intervals, etc. (optional) Returns {:ok, app} or {:error, reason}.

create_machine_and_wait(params, wait_opts \\ [])

Creates a machine, then waits for it to be in the "started" state. Example multi-step flow:

  • create_machine/2
  • wait_for_machine_state/6

wait_for_app_active(app_name, wait_opts \\ [])

Waits for the given Fly app to become active. Polls get_app until status != "pending" or until timeout.

wait_opts may include:

  • :timeout (in seconds), default 60
  • :interval (in ms), default 2000