I am trying to understand the dispatch.yaml
file for Google App Engine.
We have a vanilla web app with a frontend and a backend. We also have a development and a production environment. Both environments have two services on GAE - frontend
and default
, which is the backend.
We have a vanilla web app with a frontend and a backend. We also have a development and a production environment. We have two services on GAE - frontend and default, which is the backend. We have two projects on GAE - staging
, which is our dev environment, and production
, which is our production environment. The staging environment is built from our dev branch in both our frontend and backend. The production environment is built from our master in both our frontend and backend.
We want to use custom routes for both the staging and production environments.
I have tried using dispatch_staging.yaml
and dispatch_prod.yaml
to differentiate the files but GAE won't recognize those file names. I guess we could rename the frontend service but it looks like there is no way getting around default
.
How do you use dispatch.yaml
to specify the environment being built?
I know this is an old question, but I just discovered something interesting that will help everyone wanting to deploy to different environments.
After a lot of trial and error, I figured out that gcloud
requires the dispatch file given as parameter to be called dispatch.yaml
. If you call it anything else, like dispatch-staging.yaml
or dev-dispatch.yaml
it won't work.
However, and this is the trick I found, the file doesn't have to be in your project's root folder.
So, in our project I did this:
<project_root>/dispatch.yaml
- for production<project_root>/deploy-staging/dispatch.yaml
- for stagingAnd now I can do cd <project_root>
and then:
gcloud --project <production> app deploy ./dispatch.yaml
gcloud --project <staging> app deploy ./deploy-staging/dispatch.yaml
In other words, gcloud
doesn't care in what directory the dispatch.yaml
file is located as long as it is called dispatch.yaml
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With