Support load balancing with service discovery
What does this Merge Request do and why?
In Production GitLab.com we run multiple Postgres replicas that are proxied via multiple PGBouncer instances and all discovered by Rails using Consul DNS. At times we need to develop features related to this part of our stack and we presently don't have any documentation for how to setup GDK like this. We do have a section on how to configure load balancing but this doesn't include service discovery which means we can't use this setup when working on service discovery (for example in gitlab#368625 (closed)) .
Read more about our production infrastructure at https://gitlab.com/gitlab-com/runbooks/-/blob/master/docs/pgbouncer/patroni-consul-postgres-pgbouncer-interactions.md .
This MR also improves the existing load balancing setup by automating the database.yml
generation.
Merge Request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise Issue to follow-up. -
Documentation added/updated, if needed. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.