You can choose to install and manage a database server (PostgreSQL/MySQL) yourself, or you can use GitLab Omnibus packages to help. GitLab recommends PostgreSQL. This is the database that will be installed if you use the Omnibus package to manage your database.
If you're hosting GitLab on a cloud provider, you can optionally use a managed service for PostgreSQL. For example, AWS offers a managed Relational Database Service (RDS) that runs PostgreSQL.
If you use a cloud-managed service, or provide your own PostgreSQL:
- Setup PostgreSQL according to the database requirements document.
- Set up a
gitlabusername with a password of your choice. The
gitlabuser needs privileges to create the
- Configure the GitLab application servers with the appropriate details. This step is covered in Configuring GitLab for HA.
Note: We're working on a new version that will help automate the setup of a PostgreSQL cluster. You can use the alpha version of the document to try it out now.
- Download/install GitLab Omnibus using steps 1 and 2 from GitLab downloads. Do not complete other steps on the download page.
/etc/gitlab/gitlab.rband use the following configuration. Be sure to change the
external_urlto match your eventual GitLab front-end URL. If there is a directive listed below that you do not see in the configuration, be sure to add it.
external_url 'https://gitlab.example.com' # Disable all components except PostgreSQL postgresql['enable'] = true bootstrap['enable'] = false nginx['enable'] = false unicorn['enable'] = false sidekiq['enable'] = false redis['enable'] = false prometheus['enable'] = false gitaly['enable'] = false gitlab_workhorse['enable'] = false mailroom['enable'] = false # PostgreSQL configuration gitlab_rails['db_password'] = 'DB password' postgresql['md5_auth_cidr_addresses'] = ['0.0.0.0/0'] postgresql['listen_address'] = '0.0.0.0' # Disable automatic database migrations gitlab_rails['auto_migrate'] = false
sudo gitlab-ctl reconfigureto install and configure PostgreSQL.
reconfigurestep will result in some errors. That's OK - don't be alarmed.
Open a database prompt:
su - gitlab-psql /bin/bash psql -h /var/opt/gitlab/postgresql -d template1 # Output: psql (9.2.15) Type "help" for help. template1=#
Run the following command at the database prompt and you will be asked to enter the new password for the PostgreSQL superuser.
\password # Output: Enter new password: Enter it again:
Similarly, set the password for the
gitlabdatabase user. Use the same password that you specified in the
\password gitlab # Output: Enter new password: Enter it again:
CREATE EXTENSION pg_trgm; # Output: CREATE EXTENSION
Exit the database prompt by typing
gitlab-psqluser by running
sudo gitlab-ctl reconfigurea final time.
Configure the GitLab application servers with the appropriate details. This step is covered in Configuring GitLab for HA.
Read more on high-availability configuration: