flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

`fly launch` should accept an existing config file for multi-environment setups

Open vjanssens opened this issue 3 years ago • 14 comments

Describe the bug Fly launch should be able to accept an existing config file and use this configuration to 'launch' the application. I've been working on a fly configuration but needed a separate staging environment. So I renamed my fly.toml file to fly.production.toml, copied it to fly.staging.toml and made some changes to the staging file.

Because fly launch --config ./fly.staging.toml is not possible, fly launch will create a separate/new fly.toml file which I don't need because I already created one.

So, instead of running:

fly launch --org my-organisation-name --name staging-my-app-name

You could do:

fly launch --config ./staging.fly.toml

And the name will automatically be fetched from the config.

  • Operating system

    fly v0.0.325 darwin/arm64 Commit: da2b638 BuildDate: 2022-04-28T04:00:48Z

vjanssens avatar May 10 '22 09:05 vjanssens

A follow-up to this could be to include a field for organization in the fly.toml specification (https://fly.io/docs/reference/configuration/). This way, you can omit --org my-organisation-name from fly launch as well.

My example of fly launch --config ./staging.fly.toml incorrectly assumed organization was already part of fly.toml.

Do you want me to create a separate ticket for it?

vjanssens avatar May 10 '22 09:05 vjanssens

I'd love to be able to put fly.toml in some config folder :(

suchy avatar Jan 04 '23 13:01 suchy

@vjanssens @suchy do you still need this?

redjonzaci avatar Sep 02 '23 13:09 redjonzaci

Not at the moment but this is generally nice to have.

suchy avatar Sep 02 '23 14:09 suchy

I will start implementing this and let you know how it goes in at most 7 days.

redjonzaci avatar Sep 02 '23 14:09 redjonzaci

Amazing ;-)

suchy avatar Sep 02 '23 14:09 suchy

@suchy is your use case covered by what @vjanssens has described?

redjonzaci avatar Sep 02 '23 18:09 redjonzaci

Yes, 100%

suchy avatar Sep 02 '23 18:09 suchy

What logic I am following:

  1. Try to launch an app from the provided path to a fly.toml file.
  2. If not found, fallback to current way.

redjonzaci avatar Sep 02 '23 19:09 redjonzaci

Sounds correct 👍🏼 thanks

suchy avatar Sep 02 '23 19:09 suchy

I am continuing my work on the --config flag, but I cannot make the decision to add the organization field to fly.toml. Hopefully, a Fly.io employee decides in favor of adding that.

redjonzaci avatar Sep 03 '23 08:09 redjonzaci

Initial implementation done, but there are things to be discussed with the Fly.io team in the coming days.

redjonzaci avatar Sep 03 '23 10:09 redjonzaci

@suchy as promised, following up 7 days later. The Fly.io team seems to be working on higher priority issues for the moment and it might take some time for my PR to get the proper attention. Hope it's not a big problem for you!

Also, my PR aims to close #966 too, but I still need to add its implementation.

redjonzaci avatar Sep 10 '23 09:09 redjonzaci

@redjonzaci thanks for your efforts ;-)

suchy avatar Sep 27 '23 10:09 suchy