Reference architecture: up to 2,000 users

Reference architecture: up to 2,000 users

该页面描述了最多可容纳 2,000 位用户的 GitLab 参考架构. 有关参考架构的完整列表,请参见 .

  • 支持的用户(大约): 2,000
  • 高可用性: False
  • 每秒测试请求(RPS)速率: API:40 RPS,Web:4 RPS,Git:4 RPS

Google Cloud Platform(GCP)架构是使用Intel Xeon E5 v3(Haswell) CPU 平台构建和测试的. 在不同的硬件上,您可能会发现需要对 CPU 或节点数进行更低或更高的调整. 有关更多信息,请参见我们基于的CPU 基准测试 .

由于具有更好的性能和可用性,对于数据对象(例如 LFS,上载或工件),建议使用而不是 NFS. 使用对象存储服务也不需要您配置和维护节点.

设置 GitLab 及其组件以容纳多达 2,000 个用户:

  1. 配置外部负载平衡节点以处理两个 GitLab 应用程序服务节点的负载平衡.
  2. (GitLab 的数据库).
  3. Configure Redis.
  4. ,它提供对 Git 存储库的访问.
  5. 配置主要的 GitLab Rails 应用程序以运行 Puma / Unicorn,Workhorse,GitLab Shell,并满足所有前端请求(包括 UI,API 和基于 HTTP / SSH 的 Git).
  6. 来监视您的 GitLab 环境.
  7. 配置用于共享数据对象 .
  8. 配置 NFS (可选,不建议使用)以具有共享磁盘存储服务,以替代 Gitaly 或对象存储. 如果您不使用 GitLab 页面(需要 NFS),则可以跳过此步骤.

Configure the load balancer

注意:此体系结构已经过HAProxy 的测试和验证. 尽管您可以使用具有类似功能的负载均衡器,但 GitLab 尚未验证其他负载均衡器.

在主动/主动 GitLab 配置中,您需要一个负载平衡器才能将流量路由到应用程序服务器. GitLab 文档超出了使用负载平衡器或其确切配置的详细信息. 如果要管理多节点系统(包括 GitLab),则可能已经选择了负载均衡器. 一些示例包括 HAProxy(开源),F5 Big-IP LTM 和 Citrix Net Scaler. 本文档包括与 GitLab 一起使用的端口和协议.

下一个问题是如何在环境中处理 SSL. 有几种不同的选择:

配置您的负载均衡器以将端口 443 上的连接作为TCP而不是HTTP(S)传递. 这会将连接保持不变地传递到应用程序节点的 NGINX 服务,该服务具有 SSL 证书并侦听端口 443.

有关管理 SSL 证书和配置 NGINX 的详细信息,请参见NGINX HTTPS 文档 .

Load balancer terminates SSL without backend SSL

将负载平衡器配置为使用HTTP(S)协议而不是TCP . 负载平衡器将负责管理 SSL 证书和终止 SSL.

由于负载平衡器和 GitLab 之间的通信不安全,因此您需要完成一些其他配置. 有关详细信息,请参见NGINX 代理的 SSL 文档 .

Load balancer terminates SSL with backend SSL

配置您的负载平衡器(如果只有一个,则为单个平衡器)以使用HTTP(S)协议而不是TCP . 负载平衡器将负责为最终用户管理 SSL 证书.

在这种情况下,负载平衡器和 NGINX 之间的流量将是安全的,并且无需为代理 SSL 添加配置. 但是,您需要向 GitLab 添加配置以配置 SSL 证书. 有关管理 SSL 证书和配置 NGINX 的详细信息,请参见NGINX HTTPS 文档 .

The basic load balancer ports you should use are described in the following table:

  • 1 ): 支持要求您的负载平衡器正确处理 WebSocket 连接. 当使用 HTTP 或 HTTPS 代理,负载平衡器必须被配置为通过ConnectionUpgrade逐跳头. 有关详细信息,请参见Web 终端集成指南.
  • 2 ):在端口 443 上使用 HTTPS 协议时,您需要向负载均衡器添加 SSL 证书. 如果需要在 GitLab 应用程序服务器上终止 SSL,请使用 TCP 协议.

如果您使用具有自定义域支持的 GitLab 页面,则将需要一些其他端口配置. GitLab 页面需要一个单独的虚拟 IP 地址. 配置 DNS,以将pages_external_url/etc/gitlab/gitlab.rb指向新的虚拟 IP 地址. 有关更多信息,请参见 .

  • 1 ):GitLab 页面的后端端口取决于gitlab_pages['external_http']gitlab_pages['external_https']设置. 有关详细信息,请参见GitLab 页面文档 .
  • 2 ):GitLab 页面的端口 443 必须使用 TCP 协议. 用户可以使用自定义 SSL 配置自定义域,如果 SSL 在负载均衡器处终止,则无法实现.

Alternate SSH Port

某些组织有禁止打开 SSH 端口 22 的策略.在这种情况下,配置备用 SSH 主机名可能会有所帮助,该主机名改为允许用户通过端口 443 使用 SSH.与先前描述的相比,备用 SSH 主机名需要新的虚拟 IP 地址. GitLab HTTP 配置.

为备用 SSH 主机名配置 DNS,例如altssh.gitlab.example.com

Back to setup components

Configure PostgreSQL

在本节中,将指导您配置与 GitLab 一起使用的外部 PostgreSQL 数据库.

Provide your own PostgreSQL instance

如果您将 GitLab 托管在云提供商上,则可以选择将托管服务用于 PostgreSQL. 例如,AWS 提供了运行 PostgreSQL 的托管关系数据库服务(RDS).

如果您使用云托管服务,或提供自己的 PostgreSQL:

  1. 根据设置 PostgreSQL.
  2. 使用您选择的密码创建一个gitlab用户名. gitlab用户需要特权才能创建gitlabhq_production数据库.
  3. 使用适当的详细信息配置 GitLab 应用程序服务器. 配置 GitLab Rails 应用程序涵盖了此步骤.

Standalone PostgreSQL using Omnibus GitLab

  1. SSH 进入 PostgreSQL 服务器.
  2. 从 GitLab 下载页面使用步骤 1 和 2 下载/安装所需的 Omnibus GitLab 软件包.
    • 不要完成下载页面上的任何其他步骤.
  3. 为 PostgreSQL 生成密码哈希. 假设您将使用默认用户名gitlab (推荐). 该命令将要求输入密码和确认. 将此命令在下一步中输出的值用作POSTGRESQL_PASSWORD_HASH的值.

  4. 编辑/etc/gitlab/gitlab.rb并添加以下内容,以适当地更新占位符值.

    • POSTGRESQL_PASSWORD_HASH上一步的输出值
    • APPLICATION_SERVER_IP_BLOCKS将连接到数据库的 GitLab 应用程序服务器的 IP 子网或 IP 地址的空格分隔列表. 示例: %w(123.123.123.123/32 123.123.123.234/32)
    1. # Disable all components except PostgreSQL
    2. roles ['postgres_role']
    3. repmgr['enable'] = false
    4. consul['enable'] = false
    5. prometheus['enable'] = false
    6. alertmanager['enable'] = false
    7. pgbouncer_exporter['enable'] = false
    8. redis_exporter['enable'] = false
    9. gitlab_exporter['enable'] = false
    10. # Set the network addresses that the exporters used for monitoring will listen on
    11. node_exporter['listen_address'] = '0.0.0.0:9100'
    12. postgres_exporter['listen_address'] = '0.0.0.0:9187'
    13. postgres_exporter['dbname'] = 'gitlabhq_production'
    14. postgres_exporter['password'] = 'POSTGRESQL_PASSWORD_HASH'
    15. # Set the PostgreSQL address and port
    16. postgresql['listen_address'] = '0.0.0.0'
    17. postgresql['port'] = 5432
    18. # Replace POSTGRESQL_PASSWORD_HASH with a generated md5 value
    19. postgresql['sql_user_password'] = 'POSTGRESQL_PASSWORD_HASH'
    20. # Replace APPLICATION_SERVER_IP_BLOCK with the CIDR address of the application node
    21. postgresql['trust_auth_cidr_addresses'] = %w(127.0.0.1/32 APPLICATION_SERVER_IP_BLOCK)
    22. # Disable automatic database migrations
    23. gitlab_rails['auto_migrate'] = false
  5. 以使更改生效.

  6. 注意 PostgreSQL 节点的 IP 地址或主机名,端口和纯文本密码. 这些在以后配置GitLab 应用程序服务器时是必需的.

支持高级 ,可以根据需要添加.

Back to setup components

在本节中,将指导您配置与 GitLab 一起使用的外部 Redis 实例.

需要 Redis 5.0 或更高版本,因为这是从 GitLab 13.0 开始的 Omnibus GitLab 软件包附带的版本. 较旧的 Redis 版本不支持 SPOP 的可选 count 参数,这对于现在是必需的.

来自云提供商(例如 AWS ElastiCache)的托管 Redis 将可以使用. 如果这些服务支持高可用性,请确保它不是 Redis 群集类型.

注意 Redis 节点的 IP 地址或主机名,端口和密码(如果需要). 这些在以后配置GitLab 应用程序服务器时是必需的.

Standalone Redis using Omnibus GitLab

Omnibus GitLab 软件包可用于配置独立的 Redis 服务器. 以下步骤是使用 Omnibus 配置 Redis 服务器的最低必需步骤:

  1. SSH 进入 Redis 服务器.
  2. 从 GitLab 下载页面使用步骤 1 和 2 下载/安装所需的 Omnibus GitLab 软件包.
    • 不要完成下载页面上的任何其他步骤.
  3. 编辑/etc/gitlab/gitlab.rb并添加内容:

    1. ## Enable Redis
    2. redis['enable'] = true
    3. ## Disable all other services
    4. sidekiq['enable'] = false
    5. gitlab_workhorse['enable'] = false
    6. puma['enable'] = false
    7. unicorn['enable'] = false
    8. postgresql['enable'] = false
    9. nginx['enable'] = false
    10. prometheus['enable'] = false
    11. alertmanager['enable'] = false
    12. pgbouncer_exporter['enable'] = false
    13. gitlab_exporter['enable'] = false
    14. gitaly['enable'] = false
    15. grafana['enable'] = false
    16. redis['bind'] = '0.0.0.0'
    17. redis['port'] = 6379
    18. redis['password'] = 'SECRET_PASSWORD_HERE'
    19. gitlab_rails['enable'] = false
    20. # Set the network addresses that the exporters used for monitoring will listen on
    21. node_exporter['listen_address'] = '0.0.0.0:9100'
    22. redis_exporter['flags'] = {
    23. 'redis.addr' => 'redis://0.0.0.0:6379',
    24. 'redis.password' => 'SECRET_PASSWORD_HERE',
    25. }
  4. 以使更改生效.

  5. 注意 Redis 节点的 IP 地址或主机名,端口和 Redis 密码. 这些在以后配置 GitLab 应用程序服务器时是必需的.

支持高级 ,可以根据需要添加.

Back to setup components

Configure Gitaly

在自己的服务器上部署 Gitaly 可以使大于单个计算机的 GitLab 安装受益. Gitaly 节点的要求取决于数据,特别是项目的数量及其大小. 建议每个 Gitaly 节点存储的数据量不得超过 5TB. 您的 2K 设置可能需要一个或多个节点,具体取决于您的存储库存储要求.

我们强烈建议所有 Gitaly 节点都安装 SSD 磁盘,因为 Gitaly I / O 繁重,因此其读取操作的吞吐量至少为 8,000 IOPS,写入操作的吞吐量至少为 2,000 IOPS. 这些 IOPS 值仅建议作为启动器使用,因为随着时间的推移,它们可能会根据环境工作负载的规模而调整得更高或更低. 如果您正在 Cloud provider 上运行环境,则可能需要参考其文档以了解如何正确配置 IOPS.

Some things to note:

  • GitLab Rails 应用程序将存储库分片到 .
  • A Gitaly server can host one or more storages.
  • 一个 GitLab 服务器可以使用一个或多个 Gitaly 服务器.
  • 必须以对所有 Gitaly 客户端正确解析的方式指定 Gitaly 地址.
  • Gitaly 服务器一定不能暴露在公共互联网上,因为默认情况下,Gitaly 的网络流量是未加密的. 强烈建议使用防火墙以限制对 Gitaly 服务器的访问. 另一种选择是使用 TLS .

提示:有关 Gitaly 历史和网络体系结构的更多信息,请参见 .

注意: 注意: Gitaly 文档中引用的令牌只是管理员选择的任意密码. 它与为 GitLab API 创建的令牌或其他类似的 Web API 令牌无关.

下面我们将介绍如何配置一个 Gitaly 服务器gitaly1.internal与秘密令牌gitalysecret . 我们假设您的 GitLab 安装有两个存储库存储: defaultstorage1 .

要配置 Gitaly 服务器:

  1. 从 GitLab 下载页面使用步骤 1 和 2 下载/安装所需的 Omnibus GitLab 软件包,但提供EXTERNAL_URL值.
  2. 编辑/etc/gitlab/gitlab.rb以配置存储路径,启用网络侦听器并配置令牌:

    1. # /etc/gitlab/gitlab.rb
    2. # Gitaly and GitLab use two shared secrets for authentication, one to authenticate gRPC requests
    3. # to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
    4. # of the GitLab Rails application setup
    5. gitaly['auth_token'] = 'gitlaysecret'
    6. gitlab_shell['secret_token'] = 'shellsecret'
    7. # Avoid running unnecessary services on the Gitaly server
    8. postgresql['enable'] = false
    9. redis['enable'] = false
    10. nginx['enable'] = false
    11. puma['enable'] = false
    12. unicorn['enable'] = false
    13. sidekiq['enable'] = false
    14. gitlab_workhorse['enable'] = false
    15. grafana['enable'] = false
    16. # If you run a seperate monitoring node you can disable these services
    17. alertmanager['enable'] = false
    18. prometheus['enable'] = false
    19. # Prevent database connections during 'gitlab-ctl reconfigure'
    20. gitlab_rails['rake_cache_clear'] = false
    21. gitlab_rails['auto_migrate'] = false
    22. # Configure the gitlab-shell API callback URL. Without this, `git push` will
    23. # fail. This can be your 'front door' GitLab URL or an internal load
    24. # balancer.
    25. # Don't forget to copy `/etc/gitlab/gitlab-secrets.json` from web server to Gitaly server.
    26. gitlab_rails['internal_api_url'] = 'https://gitlab.example.com'
    27. # Make Gitaly accept connections on all network interfaces. You must use
    28. # firewalls to restrict access to this address/port.
    29. # Comment out following line if you only want to support TLS connections
    30. gitaly['listen_addr'] = "0.0.0.0:8075"
    31. gitaly['prometheus_listen_addr'] = "0.0.0.0:9236"
    32. # Set the network addresses that the exporters used for monitoring will listen on
    33. node_exporter['listen_address'] = '0.0.0.0:9100'
  3. 将以下内容添加到/etc/gitlab/gitlab.rb上的gitaly1.internal

    1. git_data_dirs({
    2. 'default' => {
    3. 'path' => '/var/opt/gitlab/git-data'
    4. },
    5. 'storage1' => {
    6. 'path' => '/mnt/gitlab/git-data'
    7. },
    8. })
  4. 保存文件并 .

  5. 确认 Gitaly 可以执行对内部 API 的回调:

    1. sudo /opt/gitlab/embedded/service/gitlab-shell/bin/check -config /opt/gitlab/embedded/service/gitlab-shell/config.yml

Gitaly TLS support

Gitaly 支持 TLS 加密. 为了能够与侦听安全连接的 Gitaly 实例进行通信,您将需要在 GitLab 配置中相应存储条目的gitaly_address中使用tls:// URL 方案.

您将需要携带自己的证书,因为该证书不会自动提供. 证书或其证书颁发机构必须按照所述的步骤,安装在所有 Gitaly 节点(包括使用证书的 Gitaly 节点)上,以及与之通信的所有客户端节点上.

注意:自签名证书必须指定用于访问 Gitaly 服务器的地址. 如果要通过主机名寻址 Gitaly 服务器,则可以为此使用”公用名”字段,也可以将其添加为”使用者备用名”. 如果要通过 Gitaly 服务器的 IP 地址对其进行寻址,则必须将其作为主题备用名称添加到证书中. gRPC 不支持在证书中使用 IP 地址作为公用名 .注意:可以同时为 Gitaly 服务器配置未加密的侦听地址listen_addr和已加密的侦听地址tls_listen_addr . 如果需要,这使您可以从未加密的流量逐渐过渡到加密的流量.

要使用 TLS 配置 Gitaly:

  1. 创建/etc/gitlab/ssl目录,并在其中复制密钥和证书:

  2. 将证书复制到/etc/gitlab/trusted-certs以便 Gitaly 在调用自身时信任该证书:

    1. sudo cp /etc/gitlab/ssl/cert.pem /etc/gitlab/trusted-certs/
  3. 编辑/etc/gitlab/gitlab.rb并添加:

    1. gitaly['tls_listen_addr'] = "0.0.0.0:9999"
    2. gitaly['certificate_path'] = "/etc/gitlab/ssl/cert.pem"
    3. gitaly['key_path'] = "/etc/gitlab/ssl/key.pem"
  4. Delete gitaly['listen_addr'] to allow only encrypted connections.

  5. 保存文件并 .

Back to setup components

Configure GitLab Rails

注意:在我们的体系结构中,我们使用 Puma Web 服务器运行每个 GitLab Rails 节点,并将其工作程序数设置为可用 CPU 的 90%以及四个线程. 对于运行带有其他组件的 Rails 的节点,应该相应地降低 worker 的值,我们发现 50%达到了很好的平衡,但这取决于工作量.

  1. 如果您使用的是 NFS

    1. 如有必要,请使用以下命令安装 NFS 客户端实用程序软件包:

      1. # Ubuntu/Debian
      2. apt-get install nfs-common
      3. # CentOS/Red Hat
      4. yum install nfs-utils nfs-utils-lib
    2. /etc/fstab指定必要的 NFS 挂载. /etc/fstab的确切内容取决于您选择配置 NFS 服务器的方式. 有关示例和各种选项,请参见 .

    3. 创建共享目录. 这些可能会有所不同,具体取决于您的 NFS 安装位置.

      1. 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
  2. 使用GitLab 下载中的 步骤 1 和 2下载/安装 Omnibus GitLab. 不要完成下载页面上的其他步骤.

  3. 创建/编辑/etc/gitlab/gitlab.rb并使用以下配置. 为了保持整个节点的链接均匀性, external_url在应用服务器上应指向外部 URL,用户将用来访问 GitLab. 这将是的 URL,它将把流量路由到 GitLab 应用程序服务器:

    1. external_url 'https://gitlab.example.com'
    2. # Gitaly and GitLab use two shared secrets for authentication, one to authenticate gRPC requests
    3. # to Gitaly, and a second for authentication callbacks from GitLab-Shell to the GitLab internal API.
    4. # The following two values must be the same as their respective values
    5. # of the Gitaly setup
    6. gitlab_rails['gitaly_token'] = 'gitalyecret'
    7. gitlab_shell['secret_token'] = 'shellsecret'
    8. git_data_dirs({
    9. 'default' => { 'gitaly_address' => 'tcp://gitaly1.internal:8075' },
    10. 'storage1' => { 'gitaly_address' => 'tcp://gitaly1.internal:8075' },
    11. 'storage2' => { 'gitaly_address' => 'tcp://gitaly2.internal:8075' },
    12. })
    13. ## Disable components that will not be on the GitLab application server
    14. roles ['application_role']
    15. gitaly['enable'] = false
    16. nginx['enable'] = true
    17. ## PostgreSQL connection details
    18. gitlab_rails['db_adapter'] = 'postgresql'
    19. gitlab_rails['db_encoding'] = 'unicode'
    20. gitlab_rails['db_host'] = '10.1.0.5' # IP/hostname of database server
    21. gitlab_rails['db_password'] = 'DB password'
    22. ## Redis connection details
    23. gitlab_rails['redis_port'] = '6379'
    24. gitlab_rails['redis_host'] = '10.1.0.6' # IP/hostname of Redis server
    25. gitlab_rails['redis_password'] = 'Redis Password'
    26. # Set the network addresses that the exporters used for monitoring will listen on
    27. node_exporter['listen_address'] = '0.0.0.0:9100'
    28. gitlab_workhorse['prometheus_listen_addr'] = '0.0.0.0:9229'
    29. sidekiq['listen_address'] = "0.0.0.0"
    30. puma['listen'] = '0.0.0.0'
    31. # Add the monitoring node's IP address to the monitoring whitelist and allow it to
    32. # scrape the NGINX metrics. Replace placeholder `monitoring.gitlab.example.com` with
    33. # the address and/or subnets gathered from the monitoring node
    34. gitlab_rails['monitoring_whitelist'] = ['<MONITOR NODE IP>/32', '127.0.0.0/8']
    35. ## Uncomment and edit the following options if you have set up NFS
    36. ## Prevent GitLab from starting if NFS data mounts are not available
    37. ##
    38. #high_availability['mountpoint'] = '/var/opt/gitlab/git-data'
    39. ##
    40. ## Ensure UIDs and GIDs match between servers for permissions via NFS
    41. ##
    42. #user['uid'] = 9000
    43. #user['gid'] = 9000
    44. #web_server['uid'] = 9001
    45. #web_server['gid'] = 9001
    46. #registry['uid'] = 9002
    47. #registry['gid'] = 9002
  4. 如果您正在使用具有 TLS 支持git_data_dirs ,请确保git_data_dirs条目配置了tls而不是tcp

    1. 将证书复制到/etc/gitlab/trusted-certs

      1. sudo cp cert.pem /etc/gitlab/trusted-certs/
  5. 保存文件并 .

  6. 运行sudo gitlab-rake gitlab:gitaly:check确认节点可以连接到 Gitaly.
  7. 拖尾日志以查看请求:

    1. sudo gitlab-ctl tail gitaly

注意:如上例所示,当在external_url指定https时,GitLab 会假定您在/etc/gitlab/ssl/具有 SSL 证书. 如果没有证书,NGINX 将无法启动. 有关更多信息,请参见NGINX 文档 .

The Omnibus GitLab package can be used to configure a standalone Monitoring node running Prometheus and :

  1. SSH 进入”监视”节点.
  2. 从 GitLab 下载页面使用步骤 1 和 2 下载/安装所需的 Omnibus GitLab 软件包. 不要完成下载页面上的任何其他步骤.
  3. 编辑/etc/gitlab/gitlab.rb并添加内容:

    1. external_url 'http://gitlab.example.com'
    2. # Enable Prometheus
    3. prometheus['enable'] = true
    4. prometheus['listen_address'] = '0.0.0.0:9090'
    5. prometheus['monitor_kubernetes'] = false
    6. # Enable Login form
    7. grafana['disable_login_form'] = false
    8. # Enable Grafana
    9. grafana['enable'] = true
    10. grafana['admin_password'] = 'toomanysecrets'
    11. # Disable all other services
    12. gitlab_rails['auto_migrate'] = false
    13. alertmanager['enable'] = false
    14. gitaly['enable'] = false
    15. gitlab_exporter['enable'] = false
    16. gitlab_workhorse['enable'] = false
    17. nginx['enable'] = true
    18. postgres_exporter['enable'] = false
    19. postgresql['enable'] = false
    20. redis['enable'] = false
    21. redis_exporter['enable'] = false
    22. sidekiq['enable'] = false
    23. puma['enable'] = false
    24. unicorn['enable'] = false
    25. node_exporter['enable'] = false
    26. gitlab_exporter['enable'] = false
  4. Prometheus 还需要一些抓取配置,以从我们配置了导出器的各个节点中提取所有数据. 假设您节点的 IP 为:

    1. 1.1.1.1: postgres
    2. 1.1.1.2: redis
    3. 1.1.1.3: gitaly1
    4. 1.1.1.4: rails1
    5. 1.1.1.5: rails2

    将以下内容添加到/etc/gitlab/gitlab.rb

    1. prometheus['scrape_configs'] = [
    2. {
    3. 'job_name': 'postgres',
    4. 'static_configs' => [
    5. 'targets' => ['1.1.1.1:9187'],
    6. ],
    7. },
    8. {
    9. 'job_name': 'redis',
    10. 'static_configs' => [
    11. 'targets' => ['1.1.1.2:9121'],
    12. ],
    13. },
    14. {
    15. 'job_name': 'gitaly',
    16. 'static_configs' => [
    17. 'targets' => ['1.1.1.3:9236'],
    18. ],
    19. },
    20. {
    21. 'job_name': 'gitlab-nginx',
    22. 'static_configs' => [
    23. 'targets' => ['1.1.1.4:8060', '1.1.1.5:8060'],
    24. ],
    25. },
    26. {
    27. 'job_name': 'gitlab-workhorse',
    28. 'static_configs' => [
    29. 'targets' => ['1.1.1.4:9229', '1.1.1.5:9229'],
    30. ],
    31. },
    32. {
    33. 'job_name': 'gitlab-rails',
    34. 'metrics_path': '/-/metrics',
    35. 'static_configs' => [
    36. 'targets' => ['1.1.1.4:8080', '1.1.1.5:8080'],
    37. ],
    38. },
    39. {
    40. 'job_name': 'gitlab-sidekiq',
    41. 'static_configs' => [
    42. 'targets' => ['1.1.1.4:8082', '1.1.1.5:8082'],
    43. ],
    44. },
    45. {
    46. 'job_name': 'node',
    47. 'static_configs' => [
    48. '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'],
    49. ],
    50. },
    51. ]
  5. 保存文件并 .

  6. 在 GitLab 用户界面中,将admin/application_settings/metrics_and_profiling >指标-Grafana 设置为/-/grafana

Back to setup components

Configure the object storage

GitLab 支持使用对象存储服务来保存多种类型的数据,建议在NFS 上使用 . 通常,对象存储服务更适合较大的环境,因为对象存储通常具有更高的性能,可靠性和可伸缩性.

GitLab 已测试或了解客户使用的对象存储选项包括:

  • SaaS / Cloud 解决方案(例如或Google Cloud Storage ).
  • 来自各种存储供应商的本地硬件和设备.
  • MinIO( ).

要将 GitLab 配置为使用对象存储,请根据要使用的功能参考以下指南:

  1. Object storage for backups.
  2. including incremental logging.
  3. .
  4. Object storage for uploads.
  5. .
  6. 容器注册表的对象存储 (可选功能).
  7. (可选功能).
  8. 包的对象存储 (可选功能).
  9. (可选功能).
  10. Pseudonymizer 的对象存储 (可选功能).
  11. (可选,以提高性能).

对于 GitLab,建议为每种数据类型使用单独的存储桶.

我们的配置的局限性是对象存储的每次使用都是单独配置的. 我们有一个问题需要改进,那就是允许一个存储桶具有单独的文件夹.

在通过 Helm 图表部署 GitLab 时使用单个存储桶会导致从备份还原 . 尽管您可能暂时不使用 Helm 部署,但是如果稍后将 GitLab 迁移到 Helm 部署,GitLab 仍然可以工作,但是您可能不会意识到备份无法正常工作,直到遇到对备份起作用的关键要求.

Back to setup components

Configure NFS (optional)

为了提高性能,建议尽可能使用对象存储以及 ,而不是使用 NFS. 但是,如果您打算使用 GitLab 页面,则必须使用 NFS .

有关配置 NFS 的信息,请参阅 .

Back to setup components

请参阅 .