This would be of interest to anybody who is automating tasks involving the launching of new applications. This was motivated by internal needs to support the GitHub Launch UI, but the results are potentially applicable elsewhere so we are sharing and developing in public and welcome feedback.
We have a low level API, a higher level command line, and a dashboard that is build on both. Often the command line contains useful combinations of usage of the API so at times it easier to build on that. In the case of fly launch
, the useful combination is at times too big to be consumable.
Examples from the GitHub Launch UI… it is useful to separate out the initial scan from the creation of databases from the generation of assets; particularly when involving languages like Rails where the generation of may depend on having a specific version of Ruby installed.
A more granular interface also opens up the possibility of running steps in parallel, reducing the overall elapsed time.
So without further ado… introducing fly launch plan
:
With flyctl v0.2.112, you can run:
% fly launch plan --help
[experimental] Granular subcommands for creating and configuring apps
Usage:
fly launch plan [command]
Available Commands:
create [experimental] create application
generate [experimental] generate Dockerfile and other configuration files based on the plan
postgres [experimental] create postgres database
propose [experimental] propose a plan based on scanning the source code or Dockerfile
redis [experimental] create redis database
tigris [experimental] create tigris database
Flags:
-h, --help help for plan
Global Flags:
-t, --access-token string Fly API Access Token
--debug Print additional logs and traces
--verbose Verbose output
Use "fly launch plan [command] --help" for more information about a command.
An example may make this clearer. Run the following in an empty directory:
git clone https://github.com/fly-apps/node-dictaphone.git .
echo --------------------------------------------------------------------
fly launch plan propose | tee plan.json
echo --------------------------------------------------------------------
fly launch plan create plan.json
echo --------------------------------------------------------------------
fly launch plan postgres plan.json
echo --------------------------------------------------------------------
fly launch plan redis plan.json
echo --------------------------------------------------------------------
fly launch plan tigris plan.json
echo --------------------------------------------------------------------
fly launch plan generate plan.json
echo --------------------------------------------------------------------
fly deploy
We are still exploring what flags make sense on what steps, and what the right level of granularity is; and we welcome any feedback on how we could make this more useful to you.