I’m confused on what to do to setup this staging environnement.
Can anybody help ?
I have tried to have a fly.staging.toml file with a different appname, but when I try to deploy it It gives me a error. “Error failed to fetch an image or build from source: Could not find App”.
My main fly.toml app name is xxx and the fly.staging.toml app name is xxx-staging.
I run my production code on the main git branch and my staging code on the dev branch.
Just to make sure I understand the part where you say "run this cmd in an empty folder).
The empty folder can be anywhere ? I not sure I understand that part.
I have my master branch and my dev branch. Is it possible to work on my master and deploy my production environnement and have my dev branch and deploy on a stage environnement on fly ?
Say, you create two Fly apps (with flyctl launch or flyctl apps create), devdw-app-test and devdw-app-prod and add corresponding entries for it in fly.toml.
If staging and prod use same fly.toml but different dockerfiles, you’d do:
# for staging
flyctl deploy -c fly.toml -a devdw-app-test --dockerfile /path/to/dockerfile-test
# for prod
flyctl deploy -c fly.toml -a devdw-app-prod --dockerfile /path/to/dockerfile-prod
If staging and prod use the same dockerfile but different fly.toml (with app name predefined in the toml itself), you’d do:
# for staging
flyctl deploy --dockerfile /path/to/dockerfile -c fly.staging.toml
# for prod
flyctl deploy --dockerfile /path/to/dockerfile -c fly.prod.toml
Glad it worked. I think, even if I hadn’t helped, you’d have figured it out given the numerous other such threads on these forums and the official Fly docs themselves.
unfortunatly, the ‘/root/.fly/bin/flyctl secrets set GIN_MODE=$VAR_NAME’ line does not put secrets in the projectname-live app but in the projectname app.
Could I do something like :
/root/.fly/bin/flyctl --app projectname-live secrets set GIN_MODE=$VAR_NAME