Simple pg replication setup tasks on Makefile

Merged Gabriel Mazetto requested to merge brodock/gitlab-development-kit:pg-replica into master

I've documented on the Makefile some steps I used to make a working postgres replication master/slave on my local machine.

This is something that will help anyone working with GitLab Geo in the future:

This still not perfect, so I would like some help from anyone who can automate it better then I do.

Current Caveats:

  • I got it working correctly only with a clean postgres install

How to use it:

  1. rm -rf postgresql
  2. make postgresql
  3. make postgresql-replication/cluster
  4. foreman start postgresql
  5. make postgresql-replication/role
  6. make postgresql-replication/backup
  7. add replication user data to pg_hba on postgresql/data/pg_hba.conf (automated)
  8. stop foreman and start it normally with foreman start and then bootstrap gitlab database as always

pg_hba data:

host    replication     gitlab_replication            trust
host    replication     gitlab_replication        ::1/128                 trust

cc @marin @jacobvosmaer