Shared group-wide Postgres service

Can I share a single Postgres service among all the projects within a group for each environment?

I have one client and two microservices, one for business object CRUD, and another for processing media, as three projects within a single Group. Currently the business object process uses the included Postgres db that is automatically created by GitLab. It works fine when I connect using the default DATABASE_URL. I am adding the media processing microservice and it would be nice if it could directly access the same Postgres db as the business object microservice.

If I use the default DATABASE_URL in the media processing service, it will connect to its own, separate postgres db, in all environments (staging, and production). I can see this on the cluster, since each project has a workload for itself, and its own “-postgres” workload.

The easiest solution for me would be to figure out how I can have the media operations service connect to the GitLab-created Postgres db that is part of the business object project. IOW, for project A to connect to the database for project B within the same Group. I’m not sure if that is (1) possible, and (2) good design.

Another solution could be to have separate, dedicated postgres services in staging and production that are somehow managed at the Group level? Is there any way to set this up using the existing Auto DevOps pipeline, perhaps with minor modifications? Perhaps another Project at the Group level that somehow just deploys a simple alpine Postgres container that is visible to the other projects within the environment on the cluster, but NOT visible to anything externally (for security)?

Tips and suggestions about best practices are most welcome. If this should be done in another way, please let me know!

Thanks,

Wex