Jump toUpdate content
Setting up Gitlab with a Managed Database for PostgreSQL
GitLab is an open-core Git repository manager that provides a wiki, issue tracking and CI/CD pipeline features. Open-core means that the core functionalities of the software are released under an open-source license with additional optional modules. Many large technology companies use this tool to manage their software development life cycle. It was initially developed in Ruby and currently also uses Go and Vue.js as part of its technology stack.
- You have an account and are logged into the Scaleway console
- You have configured your SSH Key
- You have an Instance or Elastic Metal server running Ubuntu Bionic Beaver (18.04)
- You have a domain or subdomain configured to point to the IP address of your Instance
- You have enabled the SMTP ports to send emails from your Instance
Connect to your Instance using SSH
aptpacket cache and upgrade the software already installed on the instance:
apt update && apt upgrade -y
Install the following packages using
apt install -y curl ca-certificates postfix
Add the GitLab package repository and prepare the installation of GitLab Community Edition by running the script:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
Set your domain name in the
EXTERNAL_URLvariable, then install GitLab using
EXTERNAL_URL="https://gitlab.example.com" apt install -y gitlab-ceImportant:
GitLab will automatically request a Let’s Encrypt certifcate for your domain name. Make sure you have pointed the
A-Recordof your domain to your Instances IP address to be able to obtain a valid certificate.
Create a Managed PostgreSQL Database Instance from the Scaleway console. We name our database
You are taken to your Managed Database’s Overview page.
Click the Users tab, then on Add User.
Enter the username (
gitlab) and a secure password. In the permission tab, give
ALLpermissions for the user on the
Retrieve the Database Instance Endpoint from the Overview tab, as it is required for the following steps. The first part, before the colon, is the IP address, and the second part is the port.
For the following steps, you should be connected to the Ubuntu Bionic Beaver Instance on which you installed GitLab.
Open the file
/etc/gitlab/gitlab.rbin your favourite text editor (For example
Add the following parameters to the Gitlab configuration file:
# Disable the built-in Postgres server
postgresql['enable'] = false
# Connection details of the Scaleway Database
gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_encoding'] = 'utf8'
gitlab_rails['db_database'] = '<SCALEWAY_DATABASE_NAME>'
gitlab_rails['db_host'] = '<SCALEWAY_DATABASE_IP>'
gitlab_rails['db_port'] = '<SCALEWAY_DATABASE_PORT>'
gitlab_rails['db_username'] = '<SCALEWAY_DATABASE_USERNAME>'
gitlab_rails['db_password'] = '<SCALEWAY_DATABASE_PASSWORD>'
Replace the following values in the configuration:
<SCALEWAY_DATABASE_BASE>: The name of your Scaleway Database. In our example, this is
<SCALEWAY_DATABASE_IP>: The IP address of your Scaleway Database Instance
<SCALEWAY_DATABASE_PORT>: The port of your Scaleway Database Instance
<SCALEWAY_DATABASE_USERNAME>: Your Scaleway Database user
<SCALEWAY_DATABASE_PASSWORD>: Password of your Scaleway Database user
Once modified save the file and exit the text editor.
Seed the GitLab database:Important:
This command overwrites your GitLab database. Be careful when using it. You will lose any previous data stored in the database.
DISABLE_DATABASE_ENVIRONMENT_CHECK=1 gitlab-rake gitlab:setup
Confirm the database seed by typing
Set the password for your root user with the following command:
Enter and confirm the password when prompted.
Open your web browser and go to the URL you configured for Gitlab (for example:
Log in using the user
rootand the password you defined in step 1.
The GitLab dashboard displays. You can now configure your GitLab installation, add additional users and repositories. All data is stored securely on your Scaleway Database Instance:
For more information on how to configure GitLab, refer to the official documentation.