37 KiB
reading_time |
---|
true |
Reference architecture: up to 2,000 users
This page describes GitLab reference architecture for up to 2,000 users. For a full list of reference architectures, see Available reference architectures.
- Supported users (approximate): 2,000
- High Availability: False
- Test RPS rates: API: 40 RPS, Web: 4 RPS, Git: 4 RPS
Service | Nodes | Configuration | GCP | AWS | Azure |
---|---|---|---|---|---|
Load balancer | 1 | 2 vCPU, 1.8GB Memory | n1-highcpu-2 | c5.large | F2s v2 |
Object Storage | n/a | n/a | n/a | n/a | n/a |
NFS Server (optional, not recommended) | 1 | 4 vCPU, 3.6GB Memory | n1-highcpu-4 | c5.xlarge | F4s v2 |
PostgreSQL | 1 | 2 vCPU, 7.5GB Memory | n1-standard-2 | m5.large | D2s v3 |
Redis | 1 | 1 vCPU, 3.75GB Memory | n1-standard-1 | m5.large | D2s v3 |
Gitaly | 1 | 4 vCPU, 15GB Memory | n1-standard-4 | m5.xlarge | D4s v3 |
GitLab Rails | 2 | 8 vCPU, 7.2GB Memory | n1-highcpu-8 | c5.2xlarge | F8s v2 |
Monitoring node | 1 | 2 vCPU, 1.8GB Memory | n1-highcpu-2 | c5.large | F2s v2 |
The architectures were built and tested with the Intel Xeon E5 v3 (Haswell) CPU platform on GCP. On different hardware you may find that adjustments, either lower or higher, are required for your CPU or Node counts accordingly. For more information, a Sysbench benchmark of the CPU can be found here.
AWS-equivalent and Azure-equivalent configurations are rough suggestions and may change in the future. They have not been tested and validated.
For data objects such as LFS, Uploads, Artifacts, etc, an object storage service is recommended over NFS where possible, due to better performance and availability. Since this doesn't require a node to be set up, it's marked as not applicable (n/a) in the table above.
Setup components
To set up GitLab and its components to accommodate up to 2,000 users:
- Configure the external load balancing node that will handle the load balancing of the two GitLab application services nodes.
- Configure the Object Storage used for shared data objects.
- Configure NFS (Optional) to have shared disk storage service as an alternative to Gitaly and/or Object Storage (although not recommended). NFS is required for GitLab Pages, you can skip this step if you're not using that feature.
- Configure PostgreSQL, the database for GitLab.
- Configure Redis.
- Configure Gitaly, which provides access to the Git repositories.
- Configure the main GitLab Rails application to run Puma/Unicorn, Workhorse, GitLab Shell, and to serve all frontend requests (UI, API, Git over HTTP/SSH).
- Configure Prometheus to monitor your GitLab environment.
Configure the load balancer
NOTE: Note: This architecture has been tested and validated with HAProxy as the load balancer. Although other load balancers with similar feature sets could also be used, those load balancers have not been validated.
In an active/active GitLab configuration, you will need a load balancer to route traffic to the application servers. The specifics on which load balancer to use or the exact configuration is beyond the scope of GitLab documentation. We hope that if you're managing multi-node systems like GitLab you have a load balancer of choice already. Some examples including HAProxy (open-source), F5 Big-IP LTM, and Citrix Net Scaler. This documentation will outline what ports and protocols you need to use with GitLab.
The next question is how you will handle SSL in your environment. There are several different options:
- The application node terminates SSL.
- The load balancer terminates SSL without backend SSL and communication is not secure between the load balancer and the application node.
- The load balancer terminates SSL with backend SSL and communication is secure between the load balancer and the application node.
Application node terminates SSL
Configure your load balancer to pass connections on port 443 as TCP
rather
than HTTP(S)
protocol. This will pass the connection to the application node's
NGINX service untouched. NGINX will have the SSL certificate and listen on port 443.
See the NGINX HTTPS documentation for details on managing SSL certificates and configuring NGINX.
Load balancer terminates SSL without backend SSL
Configure your load balancer to use the HTTP(S)
protocol rather than TCP
.
The load balancer will then be responsible for managing SSL certificates and
terminating SSL.
Since communication between the load balancer and GitLab will not be secure, there is some additional configuration needed. See the NGINX proxied SSL documentation for details.
Load balancer terminates SSL with backend SSL
Configure your load balancer(s) to use the 'HTTP(S)' protocol rather than 'TCP'. The load balancer(s) will be responsible for managing SSL certificates that end users will see.
Traffic will also be secure between the load balancer(s) and NGINX in this scenario. There is no need to add configuration for proxied SSL since the connection will be secure all the way. However, configuration will need to be added to GitLab to configure SSL certificates. See NGINX HTTPS documentation for details on managing SSL certificates and configuring NGINX.
Ports
The basic ports to be used are shown in the table below.
LB Port | Backend Port | Protocol |
---|---|---|
80 | 80 | HTTP (1) |
443 | 443 | TCP or HTTPS (1) (2) |
22 | 22 | TCP |
- (1): Web terminal support requires
your load balancer to correctly handle WebSocket connections. When using
HTTP or HTTPS proxying, this means your load balancer must be configured
to pass through the
Connection
andUpgrade
hop-by-hop headers. See the web terminal integration guide for more details. - (2): When using HTTPS protocol for port 443, you will need to add an SSL certificate to the load balancers. If you wish to terminate SSL at the GitLab application server instead, use TCP protocol.
If you're using GitLab Pages with custom domain support you will need some
additional port configurations.
GitLab Pages requires a separate virtual IP address. Configure DNS to point the
pages_external_url
from /etc/gitlab/gitlab.rb
at the new virtual IP address. See the
GitLab Pages documentation for more information.
LB Port | Backend Port | Protocol |
---|---|---|
80 | Varies (1) | HTTP |
443 | Varies (1) | TCP (2) |
- (1): The backend port for GitLab Pages depends on the
gitlab_pages['external_http']
andgitlab_pages['external_https']
setting. See GitLab Pages documentation for more details. - (2): Port 443 for GitLab Pages should always use the TCP protocol. Users can configure custom domains with custom SSL, which would not be possible if SSL was terminated at the load balancer.
Alternate SSH Port
Some organizations have policies against opening SSH port 22. In this case, it may be helpful to configure an alternate SSH hostname that allows users to use SSH on port 443. An alternate SSH hostname will require a new virtual IP address compared to the other GitLab HTTP configuration above.
Configure DNS for an alternate SSH hostname such as altssh.gitlab.example.com
.
LB Port | Backend Port | Protocol |
---|---|---|
443 | 22 | TCP |
Configure the object storage
GitLab supports using an object storage service for holding numerous types of data. It's recommended over NFS and in general it's better in larger setups as object storage is typically much more performant, reliable, and scalable.
Object storage options that GitLab has tested, or is aware of customers using include:
- SaaS/Cloud solutions such as Amazon S3, Google cloud storage.
- On-premises hardware and appliances from various storage vendors.
- MinIO. There is a guide to deploying this within our Helm Chart documentation.
For configuring GitLab to use Object Storage refer to the following guides based on what features you intend to use:
- Configure object storage for backups.
- Configure object storage for job artifacts including incremental logging.
- Configure object storage for LFS objects.
- Configure object storage for uploads.
- Configure object storage for merge request diffs.
- Configure object storage for Container Registry (optional feature).
- Configure object storage for Mattermost (optional feature).
- Configure object storage for packages (optional feature). (PREMIUM ONLY)
- Configure object storage for Dependency Proxy (optional feature). (PREMIUM ONLY)
- Configure object storage for Pseudonymizer (optional feature). (ULTIMATE ONLY)
- Configure object storage for autoscale Runner caching (optional - for improved performance).
- Configure object storage for Terraform state files.
Using separate buckets for each data type is the recommended approach for GitLab.
A limitation of our configuration is that each use of object storage is separately configured. We have an issue for improving this and easily using one bucket with separate folders is one improvement that this might bring.
There is at least one specific issue with using the same bucket: when GitLab is deployed with the Helm chart restore from backup will not properly function unless separate buckets are used.
One risk of using a single bucket would be if your organization decided to migrate GitLab to the Helm deployment in the future. GitLab would run, but the situation with backups might not be realized until the organization had a critical requirement for the backups to work.
Configure NFS (optional)
Object storage, along with Gitaly are recommended over NFS wherever possible for improved performance. If you intend to use GitLab Pages, this currently requires NFS.
See how to configure NFS.
Configure PostgreSQL
In this section, you'll be guided through configuring an external PostgreSQL database to be used with GitLab.
Provide your own PostgreSQL instance
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:
- Set up PostgreSQL according to the database requirements document.
- Set up a
gitlab
username with a password of your choice. Thegitlab
user needs privileges to create thegitlabhq_production
database. - Configure the GitLab application servers with the appropriate details. This step is covered in Configuring the GitLab Rails application.
Standalone PostgreSQL using Omnibus GitLab
-
SSH into the PostgreSQL server.
-
Download/install the Omnibus GitLab package you want using steps 1 and 2 from the GitLab downloads page.
- Do not complete any other steps on the download page.
-
Generate a password hash for PostgreSQL. This assumes you will use the default username of
gitlab
(recommended). The command will request a password and confirmation. Use the value that is output by this command in the next step as the value ofPOSTGRESQL_PASSWORD_HASH
.sudo gitlab-ctl pg-password-md5 gitlab
-
Edit
/etc/gitlab/gitlab.rb
and add the contents below, updating placeholder values appropriately.POSTGRESQL_PASSWORD_HASH
- The value output from the previous stepAPPLICATION_SERVER_IP_BLOCKS
- A space delimited list of IP subnets or IP addresses of the GitLab application servers that will connect to the database. Example:%w(123.123.123.123/32 123.123.123.234/32)
# Disable all components except PostgreSQL roles ['postgres_role'] repmgr['enable'] = false consul['enable'] = false prometheus['enable'] = false alertmanager['enable'] = false pgbouncer_exporter['enable'] = false redis_exporter['enable'] = false gitlab_exporter['enable'] = false # Set the network addresses that the exporters used for monitoring will listen on node_exporter['listen_address'] = '0.0.0.0:9100' postgres_exporter['listen_address'] = '0.0.0.0:9187' postgres_exporter['dbname'] = 'gitlabhq_production' postgres_exporter['password'] = 'POSTGRESQL_PASSWORD_HASH' # Set the PostgreSQL address and port postgresql['listen_address'] = '0.0.0.0' postgresql['port'] = 5432 # Replace POSTGRESQL_PASSWORD_HASH with a generated md5 value postgresql['sql_user_password'] = 'POSTGRESQL_PASSWORD_HASH' # Replace APPLICATION_SERVER_IP_BLOCK with the CIDR address of the application node postgresql['trust_auth_cidr_addresses'] = %w(127.0.0.1/32 APPLICATION_SERVER_IP_BLOCK) # Disable automatic database migrations gitlab_rails['auto_migrate'] = false
-
Reconfigure GitLab for the changes to take effect.
-
Note the PostgreSQL node's IP address or hostname, port, and plain text password. These will be necessary when configuring the GitLab application server later.
Advanced configuration options are supported and can be added if needed.
Configure Redis
In this section, you'll be guided through configuring an external Redis instance to be used with GitLab.
Provide your own Redis instance
Redis version 5.0 or higher is required, as this is what ships with Omnibus GitLab packages starting with GitLab 13.0. Older Redis versions do not support an optional count argument to SPOP which is now required for Merge Trains.
In addition, GitLab makes use of certain commands like UNLINK
and USAGE
which
were introduced only in Redis 4.
Managed Redis from cloud providers such as AWS ElastiCache will work. If these services support high availability, be sure it is not the Redis Cluster type.
Note the Redis node's IP address or hostname, port, and password (if required). These will be necessary when configuring the GitLab application servers later.
Standalone Redis using Omnibus GitLab
The Omnibus GitLab package can be used to configure a standalone Redis server. The steps below are the minimum necessary to configure a Redis server with Omnibus:
-
SSH into the Redis server.
-
Download/install the Omnibus GitLab package you want using steps 1 and 2 from the GitLab downloads page.
- Do not complete any other steps on the download page.
-
Edit
/etc/gitlab/gitlab.rb
and add the contents:## Enable Redis redis['enable'] = true ## Disable all other services sidekiq['enable'] = false gitlab_workhorse['enable'] = false puma['enable'] = false unicorn['enable'] = false postgresql['enable'] = false nginx['enable'] = false prometheus['enable'] = false alertmanager['enable'] = false pgbouncer_exporter['enable'] = false gitlab_exporter['enable'] = false gitaly['enable'] = false grafana['enable'] = false redis['bind'] = '0.0.0.0' redis['port'] = 6379 redis['password'] = 'SECRET_PASSWORD_HERE' gitlab_rails['enable'] = false # Set the network addresses that the exporters used for monitoring will listen on node_exporter['listen_address'] = '0.0.0.0:9100' redis_exporter['listen_address'] = '0.0.0.0:9121' redis_exporter['flags'] = { 'redis.addr' => 'redis://0.0.0.0:6379', 'redis.password' => 'SECRET_PASSWORD_HERE', }
-
Reconfigure Omnibus GitLab for the changes to take effect.
-
Note the Redis node's IP address or hostname, port, and Redis password. These will be necessary when configuring the GitLab application servers later.
Advanced configuration options are supported and can be added if needed.
Configure Gitaly
Deploying Gitaly in its own server can benefit GitLab installations that are larger than a single machine. Gitaly node requirements are dependent on data, specifically the number of projects and their sizes. It's recommended that each Gitaly node store no more than 5TB of data. Your 2K setup may require one or more nodes depending on your repository storage requirements.
We strongly recommend that all Gitaly nodes should be set up with SSD disks with a throughput of at least 8,000 IOPS for read operations and 2,000 IOPS for write, as Gitaly has heavy I/O. These IOPS values are recommended only as a starter as with time they may be adjusted higher or lower depending on the scale of your environment's workload. If you're running the environment on a Cloud provider you may need to refer to their documentation on how configure IOPS correctly.
Some things to note:
- The GitLab Rails application shards repositories into repository storages.
- A Gitaly server can host one or more storages.
- A GitLab server can use one or more Gitaly servers.
- Gitaly addresses must be specified in such a way that they resolve correctly for ALL Gitaly clients.
- Gitaly servers must not be exposed to the public internet, as Gitaly's network traffic is unencrypted by default. The use of a firewall is highly recommended to restrict access to the Gitaly server. Another option is to use TLS.
TIP: Tip: For more information about Gitaly's history and network architecture see the standalone Gitaly documentation.
Note: Note: The token referred to throughout the Gitaly documentation is just an arbitrary password selected by the administrator. It is unrelated to tokens created for the GitLab API or other similar web API tokens.
Below we describe how to configure one Gitaly server gitaly1.internal
with
secret token gitalysecret
. We assume your GitLab installation has two
repository storages: default
and storage1
.
To configure the Gitaly server:
-
Download/Install the Omnibus GitLab package you want using steps 1 and 2 from the GitLab downloads page but without providing the
EXTERNAL_URL
value. -
Edit
/etc/gitlab/gitlab.rb
to configure storage paths, enable the network listener and configure the token:# /etc/gitlab/gitlab.rb # Gitaly and GitLab use two shared secrets for authentication, one to authenticate gRPC requests # to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API. # The following two values must be the same as their respective values # of the GitLab Rails application setup gitaly['auth_token'] = 'gitlaysecret' gitlab_shell['secret_token'] = 'shellsecret' # Avoid running unnecessary services on the Gitaly server postgresql['enable'] = false redis['enable'] = false nginx['enable'] = false puma['enable'] = false unicorn['enable'] = false sidekiq['enable'] = false gitlab_workhorse['enable'] = false grafana['enable'] = false # If you run a seperate monitoring node you can disable these services alertmanager['enable'] = false prometheus['enable'] = false # Prevent database connections during 'gitlab-ctl reconfigure' gitlab_rails['rake_cache_clear'] = false gitlab_rails['auto_migrate'] = false # Configure the gitlab-shell API callback URL. Without this, `git push` will # fail. This can be your 'front door' GitLab URL or an internal load # balancer. # Don't forget to copy `/etc/gitlab/gitlab-secrets.json` from web server to Gitaly server. gitlab_rails['internal_api_url'] = 'https://gitlab.example.com' # Make Gitaly accept connections on all network interfaces. You must use # firewalls to restrict access to this address/port. # Comment out following line if you only want to support TLS connections gitaly['listen_addr'] = "0.0.0.0:8075" gitaly['prometheus_listen_addr'] = "0.0.0.0:9236" # Set the network addresses that the exporters used for monitoring will listen on node_exporter['listen_address'] = '0.0.0.0:9100'
-
Append the following to
/etc/gitlab/gitlab.rb
ongitaly1.internal
:git_data_dirs({ 'default' => { 'path' => '/var/opt/gitlab/git-data' }, 'storage1' => { 'path' => '/mnt/gitlab/git-data' }, })
-
Save the file and reconfigure GitLab.
-
Confirm that Gitaly can perform callbacks to the internal API:
sudo /opt/gitlab/embedded/service/gitlab-shell/bin/check -config /opt/gitlab/embedded/service/gitlab-shell/config.yml
Gitaly TLS support
Gitaly supports TLS encryption. To be able to communicate
with a Gitaly instance that listens for secure connections you will need to use tls://
URL
scheme in the gitaly_address
of the corresponding storage entry in the GitLab configuration.
You will need to bring your own certificates as this isn't provided automatically. The certificate, or its certificate authority, must be installed on all Gitaly nodes (including the Gitaly node using the certificate) and on all client nodes that communicate with it following the procedure described in GitLab custom certificate configuration.
NOTE: Note The self-signed certificate must specify the address you use to access the Gitaly server. If you are addressing the Gitaly server by a hostname, you can either use the Common Name field for this, or add it as a Subject Alternative Name. If you are addressing the Gitaly server by its IP address, you must add it as a Subject Alternative Name to the certificate. gRPC does not support using an IP address as Common Name in a certificate.
NOTE: Note:
It is possible to configure Gitaly servers with both an
unencrypted listening address listen_addr
and an encrypted listening
address tls_listen_addr
at the same time. This allows you to do a
gradual transition from unencrypted to encrypted traffic, if necessary.
To configure Gitaly with TLS:
-
Create the
/etc/gitlab/ssl
directory and copy your key and certificate there:sudo mkdir -p /etc/gitlab/ssl sudo chmod 755 /etc/gitlab/ssl sudo cp key.pem cert.pem /etc/gitlab/ssl/ sudo chmod 644 key.pem cert.pem
-
Copy the cert to
/etc/gitlab/trusted-certs
so Gitaly will trust the cert when calling into itself:sudo cp /etc/gitlab/ssl/cert.pem /etc/gitlab/trusted-certs/
-
Edit
/etc/gitlab/gitlab.rb
and add:gitaly['tls_listen_addr'] = "0.0.0.0:9999" gitaly['certificate_path'] = "/etc/gitlab/ssl/cert.pem" gitaly['key_path'] = "/etc/gitlab/ssl/key.pem"
-
Delete
gitaly['listen_addr']
to allow only encrypted connections. -
Save the file and reconfigure GitLab.
Configure GitLab Rails
NOTE: Note: In our architectures we run each GitLab Rails node using the Puma webserver and have its number of workers set to 90% of available CPUs along with four threads. For nodes that are running Rails with other components the worker value should be reduced accordingly where we've found 50% achieves a good balance but this is dependent on workload.
This section describes how to configure the GitLab application (Rails) component. On each node perform the following:
-
If you're using NFS:
-
If necessary, install the NFS client utility packages using the following commands:
# Ubuntu/Debian apt-get install nfs-common # CentOS/Red Hat yum install nfs-utils nfs-utils-lib
-
Specify the necessary NFS mounts in
/etc/fstab
. The exact contents of/etc/fstab
will depend on how you chose to configure your NFS server. See the NFS documentation for examples and the various options. -
Create the shared directories. These may be different depending on your NFS mount locations.
mkdir -p /var/opt/gitlab/.ssh /var/opt/gitlab/gitlab-rails/uploads /var/opt/gitlab/gitlab-rails/shared /var/opt/gitlab/gitlab-ci/builds /var/opt/gitlab/git-data
-
-
Download/install Omnibus GitLab using steps 1 and 2 from GitLab downloads. Do not complete other steps on the download page.
-
Create/edit
/etc/gitlab/gitlab.rb
and use the following configuration. To maintain uniformity of links across nodes, theexternal_url
on the application server should point to the external URL that users will use to access GitLab. This would be the URL of the load balancer which will route traffic to the GitLab application server:external_url 'https://gitlab.example.com' # Gitaly and GitLab use two shared secrets for authentication, one to authenticate gRPC requests # to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API. # The following two values must be the same as their respective values # of the Gitaly setup gitlab_rails['gitaly_token'] = 'gitalyecret' gitlab_shell['secret_token'] = 'shellsecret' git_data_dirs({ 'default' => { 'gitaly_address' => 'tcp://gitaly1.internal:8075' }, 'storage1' => { 'gitaly_address' => 'tcp://gitaly1.internal:8075' }, 'storage2' => { 'gitaly_address' => 'tcp://gitaly2.internal:8075' }, }) ## Disable components that will not be on the GitLab application server roles ['application_role'] gitaly['enable'] = false nginx['enable'] = true ## PostgreSQL connection details gitlab_rails['db_adapter'] = 'postgresql' gitlab_rails['db_encoding'] = 'unicode' gitlab_rails['db_host'] = '10.1.0.5' # IP/hostname of database server gitlab_rails['db_password'] = 'DB password' ## Redis connection details gitlab_rails['redis_port'] = '6379' gitlab_rails['redis_host'] = '10.1.0.6' # IP/hostname of Redis server gitlab_rails['redis_password'] = 'Redis Password' # Set the network addresses that the exporters used for monitoring will listen on node_exporter['listen_address'] = '0.0.0.0:9100' gitlab_workhorse['prometheus_listen_addr'] = '0.0.0.0:9229' sidekiq['listen_address'] = "0.0.0.0" puma['listen'] = '0.0.0.0' # Add the monitoring node's IP address to the monitoring whitelist and allow it to # scrape the NGINX metrics. Replace placeholder `monitoring.gitlab.example.com` with # the address and/or subnets gathered from the monitoring node gitlab_rails['monitoring_whitelist'] = ['<MONITOR NODE IP>/32', '127.0.0.0/8'] nginx['status']['options']['allow'] = ['<MONITOR NODE IP>/32', '127.0.0.0/8'] ## Uncomment and edit the following options if you have set up NFS ## ## Prevent GitLab from starting if NFS data mounts are not available ## #high_availability['mountpoint'] = '/var/opt/gitlab/git-data' ## ## Ensure UIDs and GIDs match between servers for permissions via NFS ## #user['uid'] = 9000 #user['gid'] = 9000 #web_server['uid'] = 9001 #web_server['gid'] = 9001 #registry['uid'] = 9002 #registry['gid'] = 9002
-
If you're using Gitaly with TLS support, make sure the
git_data_dirs
entry is configured withtls
instead oftcp
:git_data_dirs({ 'default' => { 'gitaly_address' => 'tls://gitaly1.internal:9999' }, 'storage1' => { 'gitaly_address' => 'tls://gitaly1.internal:9999' }, 'storage2' => { 'gitaly_address' => 'tls://gitaly2.internal:9999' }, })
-
Copy the cert into
/etc/gitlab/trusted-certs
:sudo cp cert.pem /etc/gitlab/trusted-certs/
-
-
Save the file and reconfigure GitLab.
-
Run
sudo gitlab-rake gitlab:gitaly:check
to confirm the node can connect to Gitaly. -
Tail the logs to see the requests:
sudo gitlab-ctl tail gitaly
NOTE: Note: When you specify https
in the external_url
, as in the example
above, GitLab assumes you have SSL certificates in /etc/gitlab/ssl/
. If
certificates are not present, NGINX will fail to start. See the
NGINX documentation
for more information.
Configure Prometheus
The Omnibus GitLab package can be used to configure a standalone Monitoring node running Prometheus and Grafana:
-
SSH into the Monitoring node.
-
Download/install the Omnibus GitLab package you want using steps 1 and 2 from the GitLab downloads page. Do not complete any other steps on the download page.
-
Edit
/etc/gitlab/gitlab.rb
and add the contents:external_url 'http://gitlab.example.com' # Enable Prometheus prometheus['enable'] = true prometheus['listen_address'] = '0.0.0.0:9090' prometheus['monitor_kubernetes'] = false # Enable Login form grafana['disable_login_form'] = false # Enable Grafana grafana['enable'] = true grafana['admin_password'] = 'toomanysecrets' # Disable all other services gitlab_rails['auto_migrate'] = false alertmanager['enable'] = false gitaly['enable'] = false gitlab_exporter['enable'] = false gitlab_workhorse['enable'] = false nginx['enable'] = true postgres_exporter['enable'] = false postgresql['enable'] = false redis['enable'] = false redis_exporter['enable'] = false sidekiq['enable'] = false puma['enable'] = false unicorn['enable'] = false node_exporter['enable'] = false gitlab_exporter['enable'] = false
-
Prometheus also needs some scrape configs to pull all the data from the various nodes where we configured exporters. Assuming that your nodes' IPs are:
1.1.1.1: postgres 1.1.1.2: redis 1.1.1.3: gitaly1 1.1.1.4: rails1 1.1.1.5: rails2
Add the following to
/etc/gitlab/gitlab.rb
:prometheus['scrape_configs'] = [ { 'job_name': 'postgres', 'static_configs' => [ 'targets' => ['1.1.1.1:9187'], ], }, { 'job_name': 'redis', 'static_configs' => [ 'targets' => ['1.1.1.2:9121'], ], }, { 'job_name': 'gitaly', 'static_configs' => [ 'targets' => ['1.1.1.3:9236'], ], }, { 'job_name': 'gitlab-nginx', 'static_configs' => [ 'targets' => ['1.1.1.4:8060', '1.1.1.5:8060'], ], }, { 'job_name': 'gitlab-workhorse', 'static_configs' => [ 'targets' => ['1.1.1.4:9229', '1.1.1.5:9229'], ], }, { 'job_name': 'gitlab-rails', 'metrics_path': '/-/metrics', 'static_configs' => [ 'targets' => ['1.1.1.4:8080', '1.1.1.5:8080'], ], }, { 'job_name': 'gitlab-sidekiq', 'static_configs' => [ 'targets' => ['1.1.1.4:8082', '1.1.1.5:8082'], ], }, { 'job_name': 'node', 'static_configs' => [ 'targets' => ['1.1.1.1:9100', '1.1.1.2:9100', '1.1.1.3:9100', '1.1.1.4:9100', '1.1.1.5:9100'], ], }, ]
-
Save the file and reconfigure GitLab.
-
In the GitLab UI, set
admin/application_settings/metrics_and_profiling
> Metrics - Grafana to/-/grafana
tohttp[s]://<MONITOR NODE>/-/grafana
Troubleshooting
See the troubleshooting documentation.