I have two application that I want to deploy with Google Cloud App Engine.
One of them is react front end, and I want to serve this through
CodePudding user response:
You are on the right path. You are using the microservices architecture which is basically deploying individual apps as parts (services) under a single project.
Your frontend service seems to be your default so you don't need a service name for it. Every GAE App needs a default service.
Rename
react.yaml
toapp.yaml
(since it will be your default service) and update the contents toruntime: nodejs16 env: standard handlers: - url: /static static_dir: static secure: always - url: /.* script: auto secure: always
Also rename your
api.yaml
tobackend.yaml
since that is what you called your service (not sure if this is required but I do that to easily track of what is controlling my service). Update the contents of the file toservice: backend runtime: python37 entrypoint: gunicorn -b :$PORT videoo.wsgi env: standard handlers: - url: /.* script: auto secure: always
You'll need a dispatch.yaml file to route traffic to the different services. Something like
dispatch:
# Send all api traffic to the backend service.
- url: "api.videoo.io/*"
service: backend
# Send all other traffic to the default (frontend).
- url: "*/*"
service: default
- Final step is that during your deploy, you will deploy the 2 services in addition to your dispatch.yaml file. The dispatch.yaml file has to be in your project root folder
gcloud app deploy app.yaml dispatch.yaml <path_to_backend.yaml>