Search code examples
google-app-enginegoogle-container-registrygoogle-cloud-build

Serving different Container Registry images for dev, test, prod within one GAE project


I deploy my Docker image to default GAE by gcloud app deploy --image-url=us.gcr.io
I have successfully mapped my custom domain to this application with custom runtime and flex env.

My dispatch.yaml sends requests to its sub-domain:

dispatch:
  - url: "dev.domain.com/*"
    service: default

Now I want to use different images from Container Registry for test.domain.com and domain.com
While having all these images sharing same Cloud Storage and Firebase credentials.

Being new to GCP I wanted to learn any simple approach to organize such basic structure without going into services and versions (just by assigning proper images to serve relevant domains).

Is it even possible to do within one GAE project or I should create separate projects for it?


Solution

  • Mapping custom domains can only be done at the service level, so if you don't want to go into services separate projects is your only choice.

    Actually using separate projects instead of services (or service versions) for implementing different environments has some advantages, I'd choose separate projects, too. See Advantages of implementing CI/CD environments at GAE project/app level vs service/module level?

    I'm not sure if sharing the storage and credentials between production and other environments is a good idea (what if something goes wrong?). I'd keep them separate, too (maybe with some jobs to populate non-production projects with production data, if you need to). But if you do want to share them across projects you'll probably need to make some extra steps.