Skip to content

Database Backup should support multiple GITLAB_BACKUP_* overrides

Summary

GitLab provides a backup rake task that will take a backup of the database. This task supports multiple database setup.

However, we need to improve supporting overriding the Rails configuration using GITLAB_BACKUP_* environment variables. This is needed if the application is using for example PgBouncer for the database connections: we want to create backups using direct connection to the primary PostgreSQL instance.

Currently, we do not support overrides per database. So it is not possible to use GITLAB_BACKUP_* overrides to specifiy a second database server for backing up ci

Solution

  1. We need to support multiple database setup for GITLAB_BACKUP_* variables. An proposed implementation, example is GITLAB_BACKUP_PGHOST but it should work the same for all these variables
    • if we are on single database setup, we support GITLAB_BACKUP_PGHOST but GITLAB_BACKUP_MAIN_PGHOST will also work
    • if we are on multiple databases, we support both GITLAB_BACKUP_PGHOST and GITLAB_BACKUP_MAIN_PGHOST
  2. Update documentation https://docs.gitlab.com/ee/administration/backup_restore/backup_gitlab.html#environment-variable-overrides
Edited by Rutger Wessels