I understand it this way too.
For my project named “dummy”, I’d like to deploy 1 branch to STAGING, then another branch to PROD. Both are 1 and the same repo, therefore, 1 and the same “app name”, “dummy”.
So when I iex into “dummy”, which one am I going into? By observation, it seems I’m going into the latest deployed one. But how would go iex into the other app?
Has fly.io not considered companies with a project that want to deploy more than 1 branch, from the same repo?
Or, do you suggest that, as I switch branches, change my mix.exs so that I’m essentially deploying a different app name?
We definitely support deploying staging and production apps, however, we’re not super opinionated about how you separate them.
fly deploy will build and deploy whatever branch to the app that’s named in fly.toml. If you deploy the prod branch, switch to staging and deploy that branch, you’ll be building a new release from that branch and deploying to the same app.
The most simple way to create different environments is to create a new app. You can do this by running fly apps create app-name-you-want and then copying your fly.toml to fly.staging.toml and renaming the app key to whatever you used as the app name when you ran fly apps create.
Once this is done, deploy it with fly deploy -c fly.staging.toml
(Sorry for the edits, accidentally hit “post” too soon!)
Thanks for the helpful tip.
My project is called “dummy” as per mix.exs. I have successfully deployed to both fly apps (called “dummy-staging” and “dummy-prod”) under my fly account. Could you specifically explain how I can iex into each?
The complication is that the official command to iex must be fly ssh console --pty -C "/app/bin/dummy remote", in which I must use the name “dummy” from mix.exs. I wish I could specify either of the fly app names (dummy-staging or dummy-prod). As of right now, I can only iex into 1 of the running apps (specifically the most recently deployed one), and have no way to iex into the other.
We have 2 different commands in dicussion: Command A. SSH into machine by fly ssh console -a <app_name_from_fly> Command B. iex into the running-app console by fly ssh console --pty -C "/app/bin/<app_name_from_mix_dot_exs_NOT_app_name_from_fly> remote"
Nonetheless, it seems I’ve discovered a shortcoming of Command A. i.e. In the situation where the same mix.exs app-name is deployed into multiple fly-app names, Command A allows me to iex into ONLY the most recently deployed fly-app, which sometimes is “STAGING”, and sometimes is “PROD”.
Would you be able to improve Command B, to allow the ability to specify fly-app names, instead of mix.exs app-names?