# GitLab Architecture Overview
> 原文:[https://docs.gitlab.com/ee/development/architecture.html](https://docs.gitlab.com/ee/development/architecture.html)
* [Software delivery](#software-delivery)
* [Components](#components)
* [Simplified Component Overview](#simplified-component-overview)
* [Component diagram](#component-diagram)
* [Component legend](#component-legend)
* [Component list](#component-list)
* [Component details](#component-details)
* [Alertmanager](#alertmanager)
* [Certificate management](#certificate-management)
* [Consul](#consul)
* [Database migrations](#database-migrations)
* [Elasticsearch](#elasticsearch)
* [Gitaly](#gitaly)
* [Praefect](#praefect)
* [GitLab Geo](#gitlab-geo)
* [GitLab Exporter](#gitlab-exporter)
* [GitLab Pages](#gitlab-pages)
* [GitLab Runner](#gitlab-runner)
* [GitLab Shell](#gitlab-shell)
* [GitLab Workhorse](#gitlab-workhorse)
* [Grafana](#grafana)
* [Jaeger](#jaeger)
* [Logrotate](#logrotate)
* [Mattermost](#mattermost)
* [MinIO](#minio)
* [NGINX](#nginx)
* [Node Exporter](#node-exporter)
* [PgBouncer](#pgbouncer)
* [PgBouncer Exporter](#pgbouncer-exporter)
* [PostgreSQL](#postgresql)
* [PostgreSQL Exporter](#postgresql-exporter)
* [Prometheus](#prometheus)
* [Redis](#redis)
* [Redis Exporter](#redis-exporter)
* [Registry](#registry)
* [Sentry](#sentry)
* [Sidekiq](#sidekiq)
* [Unicorn](#unicorn)
* [LDAP Authentication](#ldap-authentication)
* [Outbound Email](#outbound-email)
* [Inbound Email](#inbound-email)
* [GitLab Managed Apps](#gitlab-managed-apps)
* [GitLab by Request Type](#gitlab-by-request-type)
* [GitLab Web HTTP Request Cycle](#gitlab-web-http-request-cycle)
* [GitLab Git Request Cycle](#gitlab-git-request-cycle)
* [Web Request (80/443)](#web-request-80443)
* [SSH Request (22)](#ssh-request-22)
* [System Layout](#system-layout)
* [Installation Folder Summary](#installation-folder-summary)
* [Processes](#processes)
* [Repository access](#repository-access)
* [Troubleshooting](#troubleshooting)
* [Init scripts of the services](#init-scripts-of-the-services)
* [Log locations of the services](#log-locations-of-the-services)
* [GitLab specific configuration files](#gitlab-specific-configuration-files)
* [Maintenance Tasks](#maintenance-tasks)
* [GitLab.com](#gitlabcom)
# GitLab Architecture Overview[](#gitlab-architecture-overview "Permalink")
## Software delivery[](#software-delivery "Permalink")
GitLab 有兩種軟件發行[版](https://gitlab.com/gitlab-org/gitlab-foss/) :開源[社區版](https://gitlab.com/gitlab-org/gitlab-foss/) (CE)和開放核心[企業版](https://gitlab.com/gitlab-org/gitlab/) (EE). GitLab 在[不同的訂閱下](https://about.gitlab.com/pricing/)可用.
GitLab 的新版本在穩定的分支中發布,而 master 分支則用于前沿開發.
有關信息,請參見[GitLab 發布過程](https://gitlab.com/gitlab-org/release/docs/-/tree/master#gitlab-release-process) .
EE 和 CE 都需要一些名為 GitLab Shell 和 Gitaly 的附加組件. 這些組件分別可從[GitLab Shell](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/master)和[Gitaly](https://gitlab.com/gitlab-org/gitaly/-/tree/master)存儲庫中獲得. 新版本通常是標簽,但是停留在 master 分支上將為您提供最新的穩定版本. 新版本通常與 GitLab CE 發布大約相同的時間,但非正式的安全更新被認為很重要.
## Components[](#components "Permalink")
A typical install of GitLab will be on GNU/Linux. It uses NGINX or Apache as a web front end to proxypass the Unicorn web server. By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and pre-compiled assets. GitLab serves web pages and the [GitLab API](../api/README.html) using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses Redis as a non-persistent database backend for job information, meta data, and incoming jobs.
我們還支持使用我們的[GitLab Helm 圖表](https://docs.gitlab.com/charts/)在 Kubernetes 上部署 GitLab.
GitLab Web 應用程序將 PostgreSQL 用于持久數據庫信息(例如,用戶,權限,問題,其他元數據). GitLab 默認將其服務的裸 Git 存儲庫存儲在`/home/git/repositories` . 它還使用裸存儲庫保留默認的分支和掛鉤信息.
通過 HTTP / HTTPS 提供存儲庫時,GitLab 利用 GitLab API 來解析授權和訪問以及提供 Git 對象.
附加組件 GitLab Shell 通過 SSH 提供存儲庫. 它管理`/home/git/.ssh/authorized_keys`的 SSH 密鑰,不應手動對其進行編輯. GitLab Shell 通過 Gitaly 訪問裸倉庫以提供 Git 對象,并與 Redis 進行通信以將作業提交給 Sidekiq,以供 GitLab 處理. GitLab Shell 查詢 GitLab API 以確定授權和訪問權限.
Gitaly 從 GitLab Shell 和 GitLab Web 應用程序執行 Git 操作,并向 GitLab Web 應用程序提供 API,以從 Git 獲取屬性(例如標題,分支,標簽,其他元數據),并獲取 Blob(例如 diff,commit,文件).
您可能也[對 GitLab.com](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/)的[生產體系結構感興趣](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/) .
### Simplified Component Overview[](#simplified-component-overview "Permalink")
這是一個簡化的架構圖,可用于了解 GitLab 的架構.
下面的[組件圖](#component-diagram)中提供了完整的架構圖.
[](img/architecture_simplified.png)
### Component diagram[](#component-diagram "Permalink")
圖 TB HTTP [HTTP / HTTPS]-TCP 80、443-> NGINX [NGINX] SSH-TCP 22-> GitLabShell [GitLab Shell] SMTP [SMTP Gateway] Geo [GitLab Geo Node]-TCP 22, 80,443-> NGINX GitLabShell --TCP 8080-> Unicorn [" Unicorn(GitLab Rails)"] GitLabShell-> Praefect GitLabShell-> Redis Unicorn-> PgBouncer [PgBouncer] Unicorn-> Redis Unicorn- -> Praefect Sidekiq-> Redis Sidekiq-> PgBouncer Sidekiq-> Praefect GitLabWorkhorse [GitLab Workhorse]-> Unicorn GitLabWorkhorse-> Redis GitLabWorkhorse-> Praefect Praefect-> Gitaly NGINX-> GitLabWorkhorse NGINX- TCP 8090-> GitLabPages [GitLab 頁面] NGINX-> Grafana [Grafana] Grafana-TCP 9090-> Prometheus [Prometheus] Prometheus-TCP 80,443-> Unicorn RedisExporter [Redis Exporter]-> Redis Prometheus-TCP 9121-> RedisExporter PostgreSQLExporter [PostgreSQL 導出器]-> PostgreSQL PgBouncerExporter [PgBouncer 導出器]-> PgBouncer Prometheus-TCP 9187-> PostgreSQLExporter Prometheus-TCP 9100-> NodeExporter [Node Exp orter] Prometheus-TCP 9168-> GitLabExporter [GitLab Exporter] Prometheus-TCP 9127-> PgBouncerExporter GitLabExporter-> PostgreSQL GitLabExporter-> GitLabShell GitLabExporter-> Sidekiq PgBouncer-> Consul PostgreSQL-> Consul PgBouncer -> PostgreSQL NGINX->注冊表 Unicorn->注冊表 NGINX-> Mattermost Mattermost --- Unicorn Prometheus-> Alertmanager 遷移-> PostgreSQL Runner-TCP 443-> NGINX Unicorn-TCP 9200- > Elasticsearch Sidekiq-TCP 9200-> Elasticsearch Sidekiq-TCP 80,443-> Sentry Unicorn-TCP 80,443-> Sentry Sidekiq-UDP 6831-> Jaeger Unicorn-UDP 6831-> Jaeger Gitaly-UDP 6831-> Jaeger GitLabShell-UDP 6831-> Jaeger GitLabWorkhorse-UDP 6831-> Jaeger Alertmanager-TCP 25-> SMTP Sidekiq-TCP 25-> SMTP Unicorn-TCP 25-> SMTP Unicorn-TCP 369-> LDAP Sidekiq-TCP 369-> LDAP Unicorn-TCP 443-> ObjectStorage [" Object Storage"] Sidekiq-TCP 443-> ObjectStorage GitLabWorkhorse- TCP 協議 443-> ObjectStorage 注冊表-TCP 443-> ObjectStorage Geo-TCP 5432-> PostgreSQL
### Component legend[](#component-legend "Permalink")
* ?-默認安裝
* ?-需要其他配置或 GitLab 托管應用
* ?-需要手動安裝
* ?-不支持或無可用說明
* 不適用-不適用
組件狀態鏈接到每個組件的配置文檔.
### Component list[](#component-list "Permalink")
表描述鏈接:
* [Omnibus GitLab](https://docs.gitlab.com/omnibus/)
* [GitLab chart](https://docs.gitlab.com/charts/)
* [Minikube Minimal](https://docs.gitlab.com/charts/development/minikube/)
* [GitLab.com](https://gitlab.com)
* [Source](../install/installation.html)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit)
| Component | Description | 所有的 GitLab | GitLab 圖表 | Minikube 最小 | GitLab.com | Source | GDK | CE/EE |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| [Certificate Management](#certificate-management) | TLS 設置,讓我們加密 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Consul](#consul) | 數據庫節點發現,故障轉移 | ? | ? | ? | ? | ? | ? | 僅 EE |
| [Database Migrations](#database-migrations) | 數據庫遷移 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Elasticsearch](#elasticsearch) | 改進了 GitLab 中的搜索 | ? | ? | ? | ? | ? | ? | 僅 EE |
| [Gitaly](#gitaly) | Git RPC 服務,用于處理 GitLab 進行的所有 Git 調用 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab Exporter](#gitlab-exporter) | 生成各種 GitLab 指標 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab Geo Node](#gitlab-geo) | 地理分布的 GitLab 節點 | ? | ? | ? | ? | ? | ? | 僅 EE |
| [GitLab Managed Apps](#gitlab-managed-apps) | 將 Helm,Ingress,Cert-Manager,Prometheus,Runner,JupyterHub 或 Knative 部署到集群 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab Pages](#gitlab-pages) | 托管靜態網站 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab self-monitoring: Alertmanager](#alertmanager) | 來自 Prometheus 的重復數據刪除,分組和路由警報 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab self-monitoring: Grafana](#grafana) | 指標儀表板 | ? | ? | ? | ? | ? | ? | CE & EE |
| [GitLab self-monitoring: Jaeger](#jaeger) | 查看由 GitLab 實例生成的跟蹤 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab self-monitoring: Prometheus](#prometheus) | 時間序列數據庫,指標收集和查詢服務 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab self-monitoring: Sentry](#sentry) | 跟蹤 GitLab 實例生成的錯誤 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab Shell](#gitlab-shell) | 通過 SSH 會話處理`git` | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [GitLab Workhorse](#gitlab-workhorse) | 智能反向代理,處理大型 HTTP 請求 | ? | ? | ? | ? | ? | ? | CE & EE |
| [Inbound email (SMTP)](#inbound-email) | 接收消息以更新問題 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Jaeger integration](#jaeger) | 部署的應用程序的分布式跟蹤 | ? | ? | ? | ? | ? | ? | 僅 EE |
| [LDAP Authentication](#ldap-authentication) | 根據集中的 LDAP 目錄對用戶進行身份驗證 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Mattermost](#mattermost) | 開源 Slack 替代方案 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [MinIO](#minio) | 對象存儲服務 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [NGINX](#nginx) | 將請求路由到適當的組件,終止 SSL | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Node Exporter](#node-exporter) | 具有系統指標的 Prometheus 端點 | ? | N/A | N/A | ? | ? | ? | CE 和 EE |
| [Outbound email (SMTP)](#outbound-email) | 向用戶發送電子郵件 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [PgBouncer Exporter](#pgbouncer-exporter) | 具有 PgBouncer 指標的 Prometheus 端點 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [PgBouncer](#pgbouncer) | 數據庫連接池,故障轉移 | ? | ? | ? | ? | ? | ? | 僅 EE |
| [PostgreSQL Exporter](#postgresql-exporter) | 帶有 PostgreSQL 指標的 Prometheus 端點 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [PostgreSQL](#postgresql) | Database | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Praefect](#praefect) | 任何 Git 客戶端和 Gitaly 存儲節點之間的透明代理. | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Redis Exporter](#redis-exporter) | 具有 Redis 指標的 Prometheus 端點 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Redis](#redis) | 緩存服務 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Registry](#registry) | 容器注冊表,允許推和拉圖像 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Runner](#gitlab-runner) | 執行 GitLab CI / CD 作業 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Sentry integration](#sentry) | 跟蹤已部署應用程序的錯誤 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Sidekiq](#sidekiq) | 后臺作業處理器 | ? | ? | ? | ? | ? | ? | CE 和 EE |
| [Unicorn (GitLab Rails)](#unicorn) | 處理對 Web 界面和 API 的請求 | ? | ? | ? | ? | ? | ? | CE 和 EE |
### Component details[](#component-details "Permalink")
本文檔供系統管理員和 GitLab 支持工程師使用,他們希望進一步了解 GitLab 的內部結構以及如何協同工作.
部署后,應將 GitLab 視為以下過程的合并. 在進行故障排除或調試時,請盡可能明確地指出要引用的組件. 那應該增加清晰度并減少混亂.
**Layers**
從流程的角度來看,可以認為 GitLab 具有兩層:
* **監視** :不需要任何層來交付 GitLab 應用程序,但是它將允許管理員更深入地了解他們的基礎結構以及整個服務在做什么.
* **核心** :對 GitLab 作為平臺交付至關重要的任何過程. 如果這些過程中的任何一個停止,都將導致 GitLab 中斷. 對于核心層,您可以進一步分為:
* **處理器** :這些進程負責實際執行操作并提供服務.
* **數據** :這些服務為 GitLab 服務存儲/公開結構化數據.
#### Alertmanager[](#alertmanager "Permalink")
* [Project page](https://github.com/prometheus/alertmanager/blob/master/README.md)
* Configuration:
* [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template)
* [Charts](https://github.com/helm/charts/tree/master/stable/prometheus)
* 層:監控
* Process: `alertmanager`
* GitLab.com: [Monitoring of GitLab.com](https://about.gitlab.com/handbook/engineering/monitoring/)
[警報管理器](https://s0prometheus0io.icopy.site/docs/alerting/latest/alertmanager/)是 Prometheus 提供的工具,用于*"處理由客戶端應用程序(例如 Prometheus 服務器)發送的警報.* *它負責將重復數據刪除,分組和路由到正確的接收者集成,例如電子郵件,PagerDuty 或 Opsgenie.* *它還負責沉默和禁止警報."* 您可以在[問題#45740 中](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/45740)閱讀更多有關我們將要[發出](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/45740)警報的內容.
#### Certificate management[](#certificate-management "Permalink")
* 項目頁面:
* [綜合巴士](https://github.com/certbot/certbot/blob/master/README.rst)
* [圖表](https://github.com/jetstack/cert-manager/blob/master/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/ssl.html)
* [Charts](https://docs.gitlab.com/charts/installation/tls.html)
* [Source](../install/installation.html#using-https)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/https.md)
* 層:核心服務(處理器)
* GitLab.com: [Secrets Management](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#secrets-management)
#### Consul[](#consul "Permalink")
* [Project page](https://github.com/hashicorp/consul/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/high_availability/consul.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* 層:核心服務(數據)
* GitLab.com: [Consul](../user/gitlab_com/index.html#consul)
Consul 是用于服務發現和配置的工具. Consul 是分布式的,高度可用的,并且具有極高的可伸縮性.
#### Database migrations[](#database-migrations "Permalink")
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/database.html)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/migrations/)
* [Source](../update/upgrading_from_source.html#13-install-libraries-migrations-etc)
* Layer: Core Service (Data)
#### Elasticsearch[](#elasticsearch "Permalink")
* [Project page](https://github.com/elastic/elasticsearch/)
* Configuration:
* [Omnibus](../integration/elasticsearch.html)
* [Charts](../integration/elasticsearch.html)
* [Source](../integration/elasticsearch.html)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/elasticsearch.md)
* 層:核心服務(數據)
* GitLab.com: [Get Advanced Global Search working on GitLab.com](https://gitlab.com/groups/gitlab-org/-/epics/153) epic.
Elasticsearch 是為云構建的分布式 RESTful 搜索引擎.
#### Gitaly[](#gitaly "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitaly/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/gitaly/index.html)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/gitaly/)
* [Source](../install/installation.html#install-gitaly)
* 層:核心服務(數據)
* Process: `gitaly`
* GitLab.com: [Service Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#service-architecture)
Gitaly 是一項由 GitLab 設計的服務,旨在消除我們在 GitLab 的分布式部署(請考慮 GitLab.com 或高可用性部署)中對 Git 存儲使用 NFS 的需求. 從 11.3.0 開始,此服務處理 GitLab 中的所有 Git 級別訪問. 您可以[在項目的 README 中](https://gitlab.com/gitlab-org/gitaly)閱讀有關該項目的更多信息.
#### Praefect[](#praefect "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitaly/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/gitaly/index.html)
* [Source](../install/installation.html#install-gitaly)
* 層:核心服務(數據)
* Process: `praefect`
* GitLab.com: [Service Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#service-architecture)
Praefect 是每個 Git 客戶端和 Gitaly 之間的透明代理,用于協調將存儲庫更新復制到輔助節點.
#### GitLab Geo[](#gitlab-geo "Permalink")
* Configuration:
* [Omnibus](../administration/geo/replication/index.html#setup-instructions)
* [Charts](https://docs.gitlab.com/charts/advanced/geo/)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/geo.md)
* 層:核心服務(處理器)
#### GitLab Exporter[](#gitlab-exporter "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitlab-exporter)
* Configuration:
* [Omnibus](../administration/monitoring/prometheus/gitlab_exporter.html)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/gitlab-exporter/index.html)
* 層:監控
* Process: `gitlab-exporter`
* GitLab.com: [Monitoring of GitLab.com](https://about.gitlab.com/handbook/engineering/monitoring/)
GitLab Exporter 是一個內部設計的流程,允許我們將有關 GitLab 應用程序內部的度量導出到 Prometheus. 您可以[在項目的 README 中](https://gitlab.com/gitlab-org/gitlab-exporter)閱讀更多內容.
#### GitLab Pages[](#gitlab-pages "Permalink")
* Configuration:
* [Omnibus](../administration/pages/index.html)
* [Charts](https://gitlab.com/gitlab-org/charts/gitlab/-/issues/37)
* [Source](../install/installation.html#install-gitlab-pages)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/pages.md)
* 層:核心服務(處理器)
* GitLab.com: [GitLab Pages](../user/gitlab_com/index.html#gitlab-pages)
GitLab 頁面是一項功能,可讓您直接從 GitLab 中的存儲庫發布靜態網站.
您可以將其用于個人或企業網站,例如投資組合,文檔,清單和業務演示. 您還可以將任何許可證歸于您的內容.
#### GitLab Runner[](#gitlab-runner "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitlab-runner/blob/master/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/runner/)
* [Charts](https://docs.gitlab.com/runner/install/kubernetes.html)
* [Source](https://docs.gitlab.com/runner/)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/runner.md)
* 層:核心服務(處理器)
* GitLab.com: [Runner](../user/gitlab_com/index.html#shared-runners)
GitLab Runner 運行作業并將結果發送到 GitLab.
GitLab CI / CD 是 GitLab 附帶的開源持續集成服務,用于協調測試. 該項目的舊名稱是`GitLab CI Multi Runner`但從現在開始,請使用`GitLab Runner` (不帶 CI).
#### GitLab Shell[](#gitlab-shell "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitlab-shell/blob/master/README.md)
* Configuration:
* [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/gitlab-shell/)
* [Source](../install/installation.html#install-gitlab-shell)
* [GDK](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* 層:核心服務(處理器)
* GitLab.com: [Service Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#service-architecture)
[GitLab Shell](https://gitlab.com/gitlab-org/gitlab-shell)是[GitLab](https://gitlab.com/gitlab-org/gitlab-shell)設計的程序,用于處理基于 SSH 的`git`會話,并修改授權密鑰的列表. GitLab Shell 不是 Unix Shell,也不是 Bash 或 Zsh 的替代品.
#### GitLab Workhorse[](#gitlab-workhorse "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitlab-workhorse/blob/master/README.md)
* Configuration:
* [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/unicorn/)
* [Source](../install/installation.html#install-gitlab-workhorse)
* 層:核心服務(處理器)
* Process: `gitlab-workhorse`
* GitLab.com: [Service Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#service-architecture)
[GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse)是由 GitLab 設計的程序,可幫助緩解 Unicorn 的壓力. 您可以閱讀有關發展的[歷史原因的](https://about.gitlab.com/blog/2016/04/12/a-brief-history-of-gitlab-workhorse/)更多信息. 它旨在充當智能反向代理,以幫助整體上加快 GitLab 的速度.
#### Grafana[](#grafana "Permalink")
* [Project page](https://github.com/grafana/grafana/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/monitoring/performance/grafana_configuration.html)
* [Charts](https://docs.gitlab.com/charts/charts/globals)
* 層:監控
* GitLab.com: [GitLab triage Grafana dashboard](https://dashboards.gitlab.com/d/RZmbBr7mk/gitlab-triage?refresh=30s)
Grafana 是適用于 Graphite,Elasticsearch,OpenTSDB,Prometheus 和 InfluxDB 的開源,功能豐富的指標儀表板和圖形編輯器.
#### Jaeger[](#jaeger "Permalink")
* [Project page](https://github.com/jaegertracing/jaeger/blob/master/README.md)
* Configuration:
* [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4104)
* [Charts](https://docs.gitlab.com/charts/charts/globals)
* [Source](../development/distributed_tracing.html#enabling-distributed-tracing)
* [GDK](../development/distributed_tracing.html#using-jaeger-in-the-gitlab-development-kit)
* 層:監控
* GitLab.com: [Configuration to enable Tracing for a GitLab instance](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4104) issue.
受到 Dapper 和 OpenZipkin 啟發的 Jaeger 是一個分布式跟蹤系統. 它可以用于監視基于微服務的分布式系統.
有關監視已部署的應用程序,請參閱[Jaeger 跟蹤文檔.](../operations/tracing.html)
#### Logrotate[](#logrotate "Permalink")
* [Project page](https://github.com/logrotate/logrotate/blob/master/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/logs.html)
* 層:核心服務
* Process: `logrotate`
GitLab 包含大量全部記錄的服務. 從 7.4 開始,我們開始捆綁自己的 logrotate,以確保我們負責任地進行日志記錄. 這只是普通開源產品的打包版本.
#### Mattermost[](#mattermost "Permalink")
* [Project page](https://github.com/mattermost/mattermost-server/blob/master/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/gitlab-mattermost/)
* [Charts](https://docs.mattermost.com/install/install-mmte-helm-gitlab-helm.html)
* 層:核心服務(處理器)
* GitLab.com: [Mattermost](../user/project/integrations/mattermost.html)
Mattermost 是一種開放源代碼的私有云,是[https://mattermost.com 上的](https://mattermost.com) Slack 替代品.
#### MinIO[](#minio "Permalink")
* [Project page](https://github.com/minio/minio/blob/master/README.md)
* Configuration:
* [Omnibus](https://min.io/download)
* [Charts](https://docs.gitlab.com/charts/charts/minio/)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/object_storage.md)
* 層:核心服務(數據)
* GitLab.com: [Storage Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#storage-architecture)
MinIO 是根據 Apache License v2.0 發布的對象存儲服務器. 它與 Amazon S3 云存儲服務兼容. 它最適合存儲非結構化數據,例如照片,視頻,日志文件,備份和容器/ VM 映像. 一個對象的大小范圍可以從幾個 KB 到最大 5TB.
#### NGINX[](#nginx "Permalink")
* 項目頁面:
* [綜合巴士](https://github.com/nginx/nginx)
* [圖表](https://github.com/kubernetes/ingress-nginx/blob/master/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/)
* [Charts](https://docs.gitlab.com/charts/charts/nginx/)
* [Source](../install/installation.html#9-nginx)
* 層:核心服務(處理器)
* Process: `nginx`
* GitLab.com: [Service Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#service-architecture)
NGINX 有一個用于所有 HTTP 請求的 Ingress 端口,并將它們路由到 GitLab 中的相應子系統. 我們捆綁了流行的開源 Web 服務器的未修改版本.
#### Node Exporter[](#node-exporter "Permalink")
* [Project page](https://github.com/prometheus/node_exporter/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/monitoring/prometheus/node_exporter.html)
* [Charts](https://gitlab.com/gitlab-org/charts/gitlab/-/issues/1332)
* 層:監控
* Process: `node-exporter`
* GitLab.com: [Monitoring of GitLab.com](https://about.gitlab.com/handbook/engineering/monitoring/)
[Node Exporter](https://github.com/prometheus/node_exporter)是 Prometheus 工具,可為我們提供底層計算機的指標(以 CPU /磁盤/負載為例). 它只是 Prometheus 項目中常見開源產品的打包版本.
#### PgBouncer[](#pgbouncer "Permalink")
* [Project page](https://github.com/pgbouncer/pgbouncer/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/high_availability/pgbouncer.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* 層:核心服務(數據)
* GitLab.com: [Database Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#database-architecture)
PostgreSQL 的輕量級連接池.
#### PgBouncer Exporter[](#pgbouncer-exporter "Permalink")
* [Project page](https://github.com/prometheus-community/pgbouncer_exporter/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/monitoring/prometheus/pgbouncer_exporter.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* 層:監控
* GitLab.com: [Monitoring of GitLab.com](https://about.gitlab.com/handbook/engineering/monitoring/)
Prometheus PgBouncer 的出口商. 導出指標為 9127 / metrics.
#### PostgreSQL[](#postgresql "Permalink")
* [Project page](https://github.com/postgres/postgres/blob/master/README)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/database.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* [Source](../install/installation.html#6-database)
* 層:核心服務(數據)
* Process: `postgresql`
* GitLab.com: [PostgreSQL](../user/gitlab_com/index.html#postgresql)
GitLab 打包了流行的數據庫,以存儲應用程序元數據和用戶信息.
#### PostgreSQL Exporter[](#postgresql-exporter "Permalink")
* [Project page](https://github.com/wrouesnel/postgres_exporter/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/monitoring/prometheus/postgres_exporter.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* 層:監控
* Process: `postgres-exporter`
* GitLab.com: [Monitoring of GitLab.com](https://about.gitlab.com/handbook/engineering/monitoring/)
[`postgres_exporter`](https://github.com/wrouesnel/postgres_exporter)是社區提供的 Prometheus 導出器,它將 PostgreSQL 的有關數據傳遞給 Prometheus,以在 Grafana 儀表板中使用.
#### Prometheus[](#prometheus "Permalink")
* [Project page](https://github.com/prometheus/prometheus/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/monitoring/prometheus/index.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* 層:監控
* Process: `prometheus`
* GitLab.com: [Prometheus](../user/gitlab_com/index.html#prometheus)
Prometheus 是一個時序工具,可幫助 GitLab 管理員公開有關用于向 GitLab 提供服務的各個流程的指標.
#### Redis[](#redis "Permalink")
* [Project page](https://github.com/antirez/redis/blob/unstable/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/redis.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* [Source](../install/installation.html#7-redis)
* 層:核心服務(數據)
* Process: `redis`
* GitLab.com: [Service Architecture](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/#service-architecture)
Redis 被打包以提供存儲位置:
* 會話數據
* 臨時緩存信息
* 后臺作業隊列
#### Redis Exporter[](#redis-exporter "Permalink")
* [Project page](https://github.com/oliver006/redis_exporter/blob/master/README.md)
* Configuration:
* [Omnibus](../administration/monitoring/prometheus/redis_exporter.html)
* [Charts](https://docs.gitlab.com/charts/installation/deployment.html)
* 層:監控
* Process: `redis-exporter`
* GitLab.com: [Monitoring of GitLab.com](https://about.gitlab.com/handbook/engineering/monitoring/)
[Redis Exporter](https://github.com/oliver006/redis_exporter)旨在向 Prometheus 提供有關 Redis 流程的特定指標,以便我們可以在 Grafana 中繪制這些指標.
#### Registry[](#registry "Permalink")
* [Project page](https://github.com/docker/distribution/blob/master/README.md)
* Configuration:
* [Omnibus](../update/upgrading_from_source.html#13-install-libraries-migrations-etc)
* [Charts](https://docs.gitlab.com/charts/charts/registry/)
* [Source](../administration/packages/container_registry.html#enable-the-container-registry)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/registry.md)
* 層:核心服務(處理器)
* GitLab.com: [GitLab Container Registry](../user/packages/container_registry/index.html#build-and-push-images-using-gitlab-cicd)
用戶使用注冊表來存儲自己的 Docker 映像. 捆綁的注冊表使用 NGINX 作為負載平衡器,并使用 Gi??tLab 作為身份驗證管理器. 每當客戶端請求從注冊表中拉出或推送圖像時,客戶端都會返回`401`響應以及標頭,其中詳細說明了從何處獲取身份驗證令牌(在本例中為 GitLab 實例). 然后,客戶端將向 GitLab 請求"拉"或"推"身份驗證令牌,然后將原始請求重試到注冊表. 了解有關[令牌認證的](https://docs.docker.com/registry/spec/auth/token/)更多信息.
也可以將外部注冊表配置為將 GitLab 用作身份驗證端點.
#### Sentry[](#sentry "Permalink")
* [Project page](https://github.com/getsentry/sentry/)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/configuration.html)
* [Charts](https://docs.gitlab.com/charts/charts/globals)
* [Source](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* [GDK](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* 層:監控
* GitLab.com: [Searching Sentry](https://about.gitlab.com/handbook/support/workflows/500_errors.html#searching-sentry)
從根本上說,Sentry 是一項服務,可幫助您實時監視和修復崩潰. 該服務器使用 Python,但是它包含用于在任何應用程序中從任何語言發送事件的完整 API.
有關監視已部署的應用程序,請參閱[Sentry 集成文檔](../user/project/operations/error_tracking.html)
#### Sidekiq[](#sidekiq "Permalink")
* [Project page](https://github.com/mperham/sidekiq/blob/master/README.md)
* Configuration:
* [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/sidekiq/)
* [Minikube Minimal](https://docs.gitlab.com/charts/charts/gitlab/sidekiq/index.html)
* [Source](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* [GDK](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* 層:核心服務(處理器)
* Process: `sidekiq`
* GitLab.com: [Sidekiq](../user/gitlab_com/index.html#sidekiq)
Sidekiq 是 Ruby 后臺作業處理器,可從 Redis 隊列中提取作業并進行處理. 后臺作業使 GitLab 通過將工作移至后臺來提供更快的請求/響應周期.
#### Unicorn[](#unicorn "Permalink")
* [Project page](https://gitlab.com/gitlab-org/gitlab/blob/master/README.md)
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/unicorn.html)
* [Charts](https://docs.gitlab.com/charts/charts/gitlab/webservice/)
* [Source](../install/installation.html#configure-it)
* [GDK](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* 層:核心服務(處理器)
* Process: `unicorn`
* GitLab.com: [Unicorn](../user/gitlab_com/index.html#unicorn)
[Unicorn](https://yhbt.net/unicorn/)是一個 Ruby 應用程序服務器,用于運行核心的 Rails 應用程序,該應用程序在 GitLab 中提供面向用戶的功能. 通常,根據 GitLab 版本,您會看到此輸出為`bundle`或`config.ru` .
#### LDAP Authentication[](#ldap-authentication "Permalink")
* Configuration:
* [Omnibus](../administration/auth/ldap/index.html)
* [Charts](https://docs.gitlab.com/charts/charts/globals.html)
* [Source](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/ldap.md)
* 層:核心服務(處理器)
* GitLab.com: [Product Tiers](https://about.gitlab.com/pricing/#gitlab-com)
#### Outbound Email[](#outbound-email "Permalink")
* Configuration:
* [Omnibus](https://docs.gitlab.com/omnibus/settings/smtp.html)
* [Charts](https://docs.gitlab.com/charts/installation/command-line-options.html)
* [Source](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* [GDK](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* 層:核心服務(處理器)
* GitLab.com: [Mail configuration](../user/gitlab_com/index.html#mail-configuration)
#### Inbound Email[](#inbound-email "Permalink")
* Configuration:
* [Omnibus](../administration/incoming_email.html)
* [Charts](https://docs.gitlab.com/charts/installation/command-line-options.html)
* [Source](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* [GDK](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)
* 層:核心服務(處理器)
* GitLab.com: [Mail configuration](../user/gitlab_com/index.html#mail-configuration)
#### GitLab Managed Apps[](#gitlab-managed-apps "Permalink")
* Configuration:
* [Omnibus](../user/project/clusters/index.html#installing-applications)
* [Charts](../user/project/clusters/index.html#installing-applications)
* [Source](../user/project/clusters/index.html#installing-applications)
* [GDK](../user/project/clusters/index.html#installing-applications)
* 層:核心服務(處理器)
GitLab 提供[GitLab 托管應用程序](../user/project/clusters/index.html#installing-applications) ,一鍵安裝各種應用程序,可以直接將其添加到配置的集群中. 使用 Auto DevOps 時,Review Apps 和部署需要這些應用程序. 您可以在創建集群后安裝它們. 這包括:
* [Helm](https://helm.sh/docs/)
* [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/)
* [Cert-Manager](https://cert-manager.io/docs/)
* [Prometheus](https://s0prometheus0io.icopy.site/docs/introduction/overview/)
* a [Runner](https://docs.gitlab.com/runner/)
* [JupyterHub](https://jupyter.org)
* [Knative](https://cloud.google.com/knative/)
## GitLab by Request Type[](#gitlab-by-request-type "Permalink")
GitLab 為最終用戶提供了兩個"接口"來訪問服務:
* Web HTTP 請求(查看 UI / API)
* Git HTTP / SSH 請求(推/拉 Git 數據)
了解兩者之間的區別很重要,因為某些過程在兩種過程中都使用,而另一些過程則是特定請求類型所獨有的.
### GitLab Web HTTP Request Cycle[](#gitlab-web-http-request-cycle "Permalink")
向 HTTP 端點發出請求(認為`/users/sign_in` )時,請求將通過 GitLab 服務采用以下路徑:
* NGINX-充當我們的第一線反向代理.
* GitLab Workhorse-確定是否需要轉到 Rails 應用程序或其他地方以減少 Unicorn 上的負載.
* Unicorn-由于這是一個 Web 請求,并且需要訪問該應用程序,因此它將轉到 Unicorn.
* PostgreSQL / Gitaly / Redis-根據請求的類型,它可能會通過這些服務來存儲或檢索數據.
### GitLab Git Request Cycle[](#gitlab-git-request-cycle "Permalink")
下面我們描述 HTTP 與 SSH Git 請求將采用的不同路徑. Web 請求周期有一些重疊,但也有一些差異.
### Web Request (80/443)[](#web-request-80443 "Permalink")
通過 HTTP 進行的 Git 操作使用[Git 文檔中](https://git-scm.com/docs/http-protocol)描述的無狀態"智能"協議,但處理這些操作的職責分散在多個 GitLab 組件中.
這是`git fetch`的序列圖. 請注意,所有請求都會通過 NGINX 以及任何其他 HTTP 負載平衡器傳遞,但不會以任何方式進行轉換. 所有路徑都相對于`/namespace/project.git` URL 呈現.
sequenceDiagram 參與者客戶端參與者上的 Git NGINX 參與者 Workhorse 參與者 Rails 參與者 Gitaly 參與者服務器上的 Git 注意客戶端上的 Git 左側:git fetch
客戶端上的 info-refs Git->> + Workhorse:GET / info / refs?service = git-upload-pack Workhorse->> + Rails:GET / info / refs?service = git-upload-pack 注意 Rails 的右側:驗證檢查 Rails->>-Workhorse:Gitlab :: Workhorse.git_http_ok?? Workhorse->> + Gitaly:SmartHTTPService.InfoRefsUploadPack 請求服務器上的 Gitaly->> + Git:git upload-pack --stateless-rpc --advertise-refs 服務器上的 Git->>-Gitaly:git upload-pack 響應 Gitaly->>-工作馬:SmartHTTPService.InfoRefsUploadPack 響應 Workhorse->>-客戶端上的 Git:200 OK 注意客戶端上的 Git 左側:git fetch
在客戶端上獲取包裝 Git->> + Workhorse:POST / git-upload-pack Workhorse->> + Rails:POST / git-upload-pack 注意 Rails 的權利:Auth check Rails->>-Workhorse:Gitlab: :Workhorse.git_http_ok?? Workhorse->> + Gitaly:SmartHTTPService.PostUploadPack 請求 Gitaly->> + Git 在服務器上:git upload-pack --stateless-rpc 服務器上的 Git->>-Gitaly:git upload-pack 響應 Gitaly- ->>-Workhorse:SmartHTTPService.PostUploadPack 響應 Workhorse->>-客戶端上的 Git:200 OK
該序列與`git push`相似,除了使用`git-receive-pack`代替`git-upload-pack` .
### SSH Request (22)[](#ssh-request-22 "Permalink")
通過 SSH 進行的 Git 操作可以使用[Git 文檔中](https://git-scm.com/docs/pack-protocol#_ssh_transport)描述的有狀態協議,但是處理它們的職責分散在多個 GitLab 組件中.
沒有任何 GitLab 組件直接使用 SSH-所有 SSH 連接都是在客戶端計算機上的 Git 與 SSH 服務器之間建立的,從而終止了連接. 對于 SSH 服務器,所有連接均以`git`用戶身份進行身份驗證; GitLab 用戶通過客戶端提供的 SSH 密鑰來區分.
這是`git fetch`的序列圖,假設啟用了[快速 SSH 密鑰查找](../administration/operations/fast_ssh_key_lookup.html) . 請注意, `AuthorizedKeysCommand`是[GitLab Shell](#gitlab-shell)提供的可執行文件:
sequenceDiagram 參與者客戶端參與者上的 Git SSH 服務器參與者 AuthorizedKeysCommand 參與者 GitLab Shell 參與者 Rails 參與者 Gitaly 參與者服務器上的 Git 注意客戶端上的 Git 左側:git fetch 客戶端上的 Git->> + SSH 服務器:ssh git fetch-pack request SSH 服務器-> > + AuthorizedKeysCommand:gitlab-shell-authorized-keys-check git AAAA ... AuthorizedKeysCommand->> + Rails:GET / internal / api / authorized_keys?key = AAAA ...注意 Rails 的右邊:查找密鑰 ID Rails-- >>-AuthorizedKeysCommand:200 OK,command =" gitlab-shell upload-pack key_id = 1" AuthorizedKeysCommand->>-SSH 服務器:command =" gitlab-shell upload-pack key_id = 1" SSH 服務器->> + GitLab Shell:gitlab-shell upload-pack key_id = 1 GitLab Shell->> + Rails:GET / internal / api / allowed?action = upload_pack&key_id = 1 注意 Rails 的權利:Auth check Rails->>-GitLab Shell:200 OK ,{gitaly:...} GitLab Shell->> + Gitaly:SSHService.SSHUploadPack 請求服務器上的 Gitaly->> + Git:git upload-pack 請求注意客戶端上的 Git,Git on 服務器:Git 客戶端和服務器上服務器 Git 之間的雙向通信->>-Gitaly:git upload-pack 響應 Gitaly->>-GitLab Shell:SSHService.SSHUploadPack 響應 GitLab Shell->>-SSH 服務器:gitlab-shell 上載 SSH 伺服器的上載回應->>-Git 使用者:ssh git fetch-pack 回應
`git push`操作非常相似,除了使用`git receive-pack`代替`git upload-pack` .
如果未啟用快速 SSH 密鑰查找,則 SSH 服務器將從`~git/.ssh/authorized_keys`文件讀取,以確定為給定的 SSH 會話運行什么命令. 它由 Rails 中的[`AuthorizedKeysWorker`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/workers/authorized_keys_worker.rb)保持最新狀態,并計劃在用戶修改 SSH 密鑰時運行.
可以使用[SSH 證書](../administration/operations/ssh_certificates.html)代替密鑰. 在這種情況下, `AuthorizedKeysCommand`替換為`AuthorizedPrincipalsCommand` . 這將從證書中提取用戶名,而無需使用 Rails 內部 API,該 API 稍后將代替`/api/internal/allowed`調用中的`key_id`使用.
GitLab Shell 還具有一些不涉及 Gitaly 的操作,例如重置兩因素身份驗證代碼. 這些操作以相同的方式處理,除了沒有往返 Gitaly 的往返-Rails 作為[內部 API](internal_api.html)調用的一部分執行操作,并且 GitLab Shell 將響應直接流回用戶.
## System Layout[](#system-layout "Permalink")
在圖片中引用`~git`時,它表示 Git 用戶的主目錄,通常是`/home/git` .
GitLab 主要以`git`用戶身份安裝在`/home/git`用戶主目錄中. GitLab 服務器軟件以及存儲庫都位于主目錄中(盡管存儲庫位置是可配置的).
裸存儲庫位于`/home/git/repositories` . GitLab 是 Ruby on Rails 應用程序,因此可以通過研究 Ruby on Rails 應用程序的工作方式來了解內部工作的細節.
為了通過 SSH 提供存儲庫,有一個名為 GitLab Shell 的附加應用程序,它安裝在`/home/git/gitlab-shell` .
### Installation Folder Summary[](#installation-folder-summary "Permalink")
總結一下,這里是[`git`用戶主目錄](../install/structure.html)的[目錄結構](../install/structure.html) .
### Processes[](#processes "Permalink")
```
ps aux | grep '^git'
```
GitLab 有幾個要運行的組件. 它需要一個持久數據庫(PostgreSQL)和 Redis 數據庫,并使用 Apache `httpd`或 NGINX 代理傳遞 Unicorn. 所有這些組件都應以與 GitLab 不同的系統用戶身份運行(例如, `postgres` , `redis`和`www-data` ,而不是`git` ).
作為`git`用戶,它將啟動 Sidekiq 和 Unicorn(默認情況下在端口`8080`上運行的簡單 Ruby HTTP 服務器). 在 GitLab 用戶下,通常有 4 個進程: `unicorn_rails master` (1 個進程), `unicorn_rails worker` (2 個進程), `sidekiq` (1 個進程).
### Repository access[](#repository-access "Permalink")
可以通過 HTTP 或 SSH 訪問存儲庫. HTTP 克隆/推/拉使用 GitLab API,而 SSH 克隆由 GitLab Shell 處理(先前已說明).
## Troubleshooting[](#troubleshooting "Permalink")
有關更多信息,請參見自述文件.
### Init scripts of the services[](#init-scripts-of-the-services "Permalink")
GitLab 初始化腳本啟動和停止 Unicorn 和 Sidekiq:
```
/etc/init.d/gitlab
Usage: service gitlab {start|stop|restart|reload|status}
```
Redis(鍵值存儲/非持久數據庫):
```
/etc/init.d/redis
Usage: /etc/init.d/redis {start|stop|status|restart|condrestart|try-restart}
```
SSH daemon:
```
/etc/init.d/sshd
Usage: /etc/init.d/sshd {start|stop|restart|reload|force-reload|condrestart|try-restart|status}
```
Web 服務器(以下之一):
```
/etc/init.d/httpd
Usage: httpd {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}
$ /etc/init.d/nginx
Usage: nginx {start|stop|restart|reload|force-reload|status|configtest}
```
永久數據庫:
```
$ /etc/init.d/postgresql
Usage: /etc/init.d/postgresql {start|stop|restart|reload|force-reload|status} [version ..]
```
### Log locations of the services[](#log-locations-of-the-services "Permalink")
GitLab(包括 Unicorn 和 Sidekiq 日志):
* `/home/git/gitlab/log/` contains `application.log`, `production.log`, `sidekiq.log`, `unicorn.stdout.log`, `git_json.log` and `unicorn.stderr.log` normally.
GitLab 外殼:
* `/home/git/gitlab-shell/gitlab-shell.log`
SSH:
* `/var/log/auth.log`身份驗證日志(在 Ubuntu 上).
* `/var/log/secure`身份驗證日志(在 RHEL 上).
NGINX:
* `/var/log/nginx/`包含錯誤和訪問日志.
Apache `httpd`:
* [Explanation of Apache logs](https://httpd.apache.org/docs/2.2/logs.html).
* `/var/log/apache2/`包含錯誤和輸出日志(在 Ubuntu 上).
* `/var/log/httpd/`包含錯誤和輸出日志(在 RHEL 上).
Redis:
* `/var/log/redis/redis.log`那里還有日志循環日志.
PostgreSQL:
* `/var/log/postgresql/*`
### GitLab specific configuration files[](#gitlab-specific-configuration-files "Permalink")
GitLab 的配置文件位于`/home/git/gitlab/config/*` . 常用的配置文件包括:
* `gitlab.yml` -GitLab 配置.
* `unicorn.rb` -Unicorn Web 服務器設置.
* `database.yml`數據庫連接設置.
GitLab Shell 在`/home/git/gitlab-shell/config.yml`有一個配置文件.
### Maintenance Tasks[](#maintenance-tasks "Permalink")
[GitLab](https://gitlab.com/gitlab-org/gitlab/tree/master)提供 Rake 任務,您可以在其中查看版本信息,并對配置進行快速檢查以確保在應用程序中正確配置了它. 請參閱[維護 Rake 任務](../raketasks/maintenance.html) . 簡而言之,請執行以下操作:
```
sudo -i -u git
cd gitlab
bundle exec rake gitlab:env:info RAILS_ENV=production
bundle exec rake gitlab:check RAILS_ENV=production
```
注意:建議使用`sudo -i -u git`或`sudo su - git`登錄`git`用戶. 盡管 GitLab 提供的 sudo 命令可在 Ubuntu 中運行,但它們并不總是在 RHEL 中運行.
## GitLab.com[](#gitlabcom "Permalink")
我們還詳細介紹[了 GitLab.com 的體系結構,](https://about.gitlab.com/handbook/engineering/infrastructure/production/architecture/)但是除非您擁有數百萬的用戶,否則這可能是最重要的.
- GitLab Docs
- Installation
- Requirements
- GitLab cloud native Helm Chart
- Install GitLab with Docker
- Installation from source
- Install GitLab on Microsoft Azure
- Installing GitLab on Google Cloud Platform
- Installing GitLab on Amazon Web Services (AWS)
- Analytics
- Code Review Analytics
- Productivity Analytics
- Value Stream Analytics
- Kubernetes clusters
- Adding and removing Kubernetes clusters
- Adding EKS clusters
- Adding GKE clusters
- Group-level Kubernetes clusters
- Instance-level Kubernetes clusters
- Canary Deployments
- Cluster Environments
- Deploy Boards
- GitLab Managed Apps
- Crossplane configuration
- Cluster management project (alpha)
- Kubernetes Logs
- Runbooks
- Serverless
- Deploying AWS Lambda function using GitLab CI/CD
- Securing your deployed applications
- Groups
- Contribution Analytics
- Custom group-level project templates
- Epics
- Manage epics
- Group Import/Export
- Insights
- Issues Analytics
- Iterations
- Public access
- SAML SSO for GitLab.com groups
- SCIM provisioning using SAML SSO for GitLab.com groups
- Subgroups
- Roadmap
- Projects
- GitLab Secure
- Security Configuration
- Container Scanning
- Dependency Scanning
- Dependency List
- Static Application Security Testing (SAST)
- Secret Detection
- Dynamic Application Security Testing (DAST)
- GitLab Security Dashboard
- Offline environments
- Standalone Vulnerability pages
- Security scanner integration
- Badges
- Bulk editing issues and merge requests at the project level
- Code Owners
- Compliance
- License Compliance
- Compliance Dashboard
- Create a project
- Description templates
- Deploy Keys
- Deploy Tokens
- File finder
- Project integrations
- Integrations
- Atlassian Bamboo CI Service
- Bugzilla Service
- Custom Issue Tracker service
- Discord Notifications service
- Enabling emails on push
- GitHub project integration
- Hangouts Chat service
- Atlassian HipChat
- Irker IRC Gateway
- GitLab Jira integration
- Mattermost Notifications Service
- Mattermost slash commands
- Microsoft Teams service
- Mock CI Service
- Prometheus integration
- Redmine Service
- Slack Notifications Service
- Slack slash commands
- GitLab Slack application
- Webhooks
- YouTrack Service
- Insights
- Issues
- Crosslinking Issues
- Design Management
- Confidential issues
- Due dates
- Issue Boards
- Issue Data and Actions
- Labels
- Managing issues
- Milestones
- Multiple Assignees for Issues
- Related issues
- Service Desk
- Sorting and ordering issue lists
- Issue weight
- Associate a Zoom meeting with an issue
- Merge requests
- Allow collaboration on merge requests across forks
- Merge Request Approvals
- Browser Performance Testing
- How to create a merge request
- Cherry-pick changes
- Code Quality
- Load Performance Testing
- Merge Request dependencies
- Fast-forward merge requests
- Merge when pipeline succeeds
- Merge request conflict resolution
- Reverting changes
- Reviewing and managing merge requests
- Squash and merge
- Merge requests versions
- Draft merge requests
- Members of a project
- Migrating projects to a GitLab instance
- Import your project from Bitbucket Cloud to GitLab
- Import your project from Bitbucket Server to GitLab
- Migrating from ClearCase
- Migrating from CVS
- Import your project from FogBugz to GitLab
- Gemnasium
- Import your project from GitHub to GitLab
- Project importing from GitLab.com to your private GitLab instance
- Import your project from Gitea to GitLab
- Import your Jira project issues to GitLab
- Migrating from Perforce Helix
- Import Phabricator tasks into a GitLab project
- Import multiple repositories by uploading a manifest file
- Import project from repo by URL
- Migrating from SVN to GitLab
- Migrating from TFVC to Git
- Push Options
- Releases
- Repository
- Branches
- Git Attributes
- File Locking
- Git file blame
- Git file history
- Repository mirroring
- Protected branches
- Protected tags
- Push Rules
- Reduce repository size
- Signing commits with GPG
- Syntax Highlighting
- GitLab Web Editor
- Web IDE
- Requirements Management
- Project settings
- Project import/export
- Project access tokens (Alpha)
- Share Projects with other Groups
- Snippets
- Static Site Editor
- Wiki
- Project operations
- Monitor metrics for your CI/CD environment
- Set up alerts for Prometheus metrics
- Embedding metric charts within GitLab-flavored Markdown
- Embedding Grafana charts
- Using the Metrics Dashboard
- Dashboard YAML properties
- Metrics dashboard settings
- Panel types for dashboards
- Using Variables
- Templating variables for metrics dashboards
- Prometheus Metrics library
- Monitoring AWS Resources
- Monitoring HAProxy
- Monitoring Kubernetes
- Monitoring NGINX
- Monitoring NGINX Ingress Controller
- Monitoring NGINX Ingress Controller with VTS metrics
- Alert Management
- Error Tracking
- Tracing
- Incident Management
- GitLab Status Page
- Feature Flags
- GitLab CI/CD
- GitLab CI/CD pipeline configuration reference
- GitLab CI/CD include examples
- Introduction to CI/CD with GitLab
- Getting started with GitLab CI/CD
- How to enable or disable GitLab CI/CD
- Using SSH keys with GitLab CI/CD
- Migrating from CircleCI
- Migrating from Jenkins
- Auto DevOps
- Getting started with Auto DevOps
- Requirements for Auto DevOps
- Customizing Auto DevOps
- Stages of Auto DevOps
- Upgrading PostgreSQL for Auto DevOps
- Cache dependencies in GitLab CI/CD
- GitLab ChatOps
- Cloud deployment
- Docker integration
- Building Docker images with GitLab CI/CD
- Using Docker images
- Building images with kaniko and GitLab CI/CD
- GitLab CI/CD environment variables
- Predefined environment variables reference
- Where variables can be used
- Deprecated GitLab CI/CD variables
- Environments and deployments
- Protected Environments
- GitLab CI/CD Examples
- Test a Clojure application with GitLab CI/CD
- Using Dpl as deployment tool
- Testing a Phoenix application with GitLab CI/CD
- End-to-end testing with GitLab CI/CD and WebdriverIO
- DevOps and Game Dev with GitLab CI/CD
- Deploy a Spring Boot application to Cloud Foundry with GitLab CI/CD
- How to deploy Maven projects to Artifactory with GitLab CI/CD
- Testing PHP projects
- Running Composer and NPM scripts with deployment via SCP in GitLab CI/CD
- Test and deploy Laravel applications with GitLab CI/CD and Envoy
- Test and deploy a Python application with GitLab CI/CD
- Test and deploy a Ruby application with GitLab CI/CD
- Test and deploy a Scala application to Heroku
- GitLab CI/CD for external repositories
- Using GitLab CI/CD with a Bitbucket Cloud repository
- Using GitLab CI/CD with a GitHub repository
- GitLab Pages
- GitLab Pages
- GitLab Pages domain names, URLs, and baseurls
- Create a GitLab Pages website from scratch
- Custom domains and SSL/TLS Certificates
- GitLab Pages integration with Let's Encrypt
- GitLab Pages Access Control
- Exploring GitLab Pages
- Incremental Rollouts with GitLab CI/CD
- Interactive Web Terminals
- Optimizing GitLab for large repositories
- Metrics Reports
- CI/CD pipelines
- Pipeline Architecture
- Directed Acyclic Graph
- Multi-project pipelines
- Parent-child pipelines
- Pipelines for Merge Requests
- Pipelines for Merged Results
- Merge Trains
- Job artifacts
- Pipeline schedules
- Pipeline settings
- Triggering pipelines through the API
- Review Apps
- Configuring GitLab Runners
- GitLab CI services examples
- Using MySQL
- Using PostgreSQL
- Using Redis
- Troubleshooting CI/CD
- GitLab Package Registry
- GitLab Container Registry
- Dependency Proxy
- GitLab Composer Repository
- GitLab Conan Repository
- GitLab Maven Repository
- GitLab NPM Registry
- GitLab NuGet Repository
- GitLab PyPi Repository
- API Docs
- API resources
- .gitignore API
- GitLab CI YMLs API
- Group and project access requests API
- Appearance API
- Applications API
- Audit Events API
- Avatar API
- Award Emoji API
- Project badges API
- Group badges API
- Branches API
- Broadcast Messages API
- Project clusters API
- Group clusters API
- Instance clusters API
- Commits API
- Container Registry API
- Custom Attributes API
- Dashboard annotations API
- Dependencies API
- Deploy Keys API
- Deployments API
- Discussions API
- Dockerfiles API
- Environments API
- Epics API
- Events
- Feature Flags API
- Feature flag user lists API
- Freeze Periods API
- Geo Nodes API
- Group Activity Analytics API
- Groups API
- Import API
- Issue Boards API
- Group Issue Boards API
- Issues API
- Epic Issues API
- Issues Statistics API
- Jobs API
- Keys API
- Labels API
- Group Labels API
- License
- Licenses API
- Issue links API
- Epic Links API
- Managed Licenses API
- Markdown API
- Group and project members API
- Merge request approvals API
- Merge requests API
- Project milestones API
- Group milestones API
- Namespaces API
- Notes API
- Notification settings API
- Packages API
- Pages domains API
- Pipeline schedules API
- Pipeline triggers API
- Pipelines API
- Project Aliases API
- Project import/export API
- Project repository storage moves API
- Project statistics API
- Project templates API
- Projects API
- Protected branches API
- Protected tags API
- Releases API
- Release links API
- Repositories API
- Repository files API
- Repository submodules API
- Resource label events API
- Resource milestone events API
- Resource weight events API
- Runners API
- SCIM API
- Search API
- Services API
- Application settings API
- Sidekiq Metrics API
- Snippets API
- Project snippets
- Application statistics API
- Suggest Changes API
- System hooks API
- Tags API
- Todos API
- Users API
- Project-level Variables API
- Group-level Variables API
- Version API
- Vulnerabilities API
- Vulnerability Findings API
- Wikis API
- GraphQL API
- Getting started with GitLab GraphQL API
- GraphQL API Resources
- API V3 to API V4
- Validate the .gitlab-ci.yml (API)
- User Docs
- Abuse reports
- User account
- Active sessions
- Deleting a User account
- Permissions
- Personal access tokens
- Profile preferences
- Threads
- GitLab and SSH keys
- GitLab integrations
- Git
- GitLab.com settings
- Infrastructure as code with Terraform and GitLab
- GitLab keyboard shortcuts
- GitLab Markdown
- AsciiDoc
- GitLab Notification Emails
- GitLab Quick Actions
- Autocomplete characters
- Reserved project and group names
- Search through GitLab
- Advanced Global Search
- Advanced Syntax Search
- Time Tracking
- GitLab To-Do List
- Administrator Docs
- Reference architectures
- Reference architecture: up to 1,000 users
- Reference architecture: up to 2,000 users
- Reference architecture: up to 3,000 users
- Reference architecture: up to 5,000 users
- Reference architecture: up to 10,000 users
- Reference architecture: up to 25,000 users
- Reference architecture: up to 50,000 users
- Troubleshooting a reference architecture set up
- Working with the bundled Consul service
- Configuring PostgreSQL for scaling
- Configuring GitLab application (Rails)
- Load Balancer for multi-node GitLab
- Configuring a Monitoring node for Scaling and High Availability
- NFS
- Working with the bundled PgBouncer service
- Configuring Redis for scaling
- Configuring Sidekiq
- Admin Area settings
- Continuous Integration and Deployment Admin settings
- Custom instance-level project templates
- Diff limits administration
- Enable and disable GitLab features deployed behind feature flags
- Geo nodes Admin Area
- GitLab Pages administration
- Health Check
- Job logs
- Labels administration
- Log system
- PlantUML & GitLab
- Repository checks
- Repository storage paths
- Repository storage types
- Account and limit settings
- Service templates
- System hooks
- Changing your time zone
- Uploads administration
- Abuse reports
- Activating and deactivating users
- Audit Events
- Blocking and unblocking users
- Broadcast Messages
- Elasticsearch integration
- Gitaly
- Gitaly Cluster
- Gitaly reference
- Monitoring GitLab
- Monitoring GitLab with Prometheus
- Performance Bar
- Usage statistics
- Object Storage
- Performing Operations in GitLab
- Cleaning up stale Redis sessions
- Fast lookup of authorized SSH keys in the database
- Filesystem Performance Benchmarking
- Moving repositories managed by GitLab
- Run multiple Sidekiq processes
- Sidekiq MemoryKiller
- Switching to Puma
- Understanding Unicorn and unicorn-worker-killer
- User lookup via OpenSSH's AuthorizedPrincipalsCommand
- GitLab Package Registry administration
- GitLab Container Registry administration
- Replication (Geo)
- Geo database replication
- Geo with external PostgreSQL instances
- Geo configuration
- Using a Geo Server
- Updating the Geo nodes
- Geo with Object storage
- Docker Registry for a secondary node
- Geo for multiple nodes
- Geo security review (Q&A)
- Location-aware Git remote URL with AWS Route53
- Tuning Geo
- Removing secondary Geo nodes
- Geo data types support
- Geo Frequently Asked Questions
- Geo Troubleshooting
- Geo validation tests
- Disaster Recovery (Geo)
- Disaster recovery for planned failover
- Bring a demoted primary node back online
- Automatic background verification
- Rake tasks
- Back up and restore GitLab
- Clean up
- Namespaces
- Maintenance Rake tasks
- Geo Rake Tasks
- GitHub import
- Import bare repositories
- Integrity check Rake task
- LDAP Rake tasks
- Listing repository directories
- Praefect Rake tasks
- Project import/export administration
- Repository storage Rake tasks
- Generate sample Prometheus data
- Uploads migrate Rake tasks
- Uploads sanitize Rake tasks
- User management
- Webhooks administration
- X.509 signatures
- Server hooks
- Static objects external storage
- Updating GitLab
- GitLab release and maintenance policy
- Security
- Password Storage
- Custom password length limits
- Restrict allowed SSH key technologies and minimum length
- Rate limits
- Webhooks and insecure internal web services
- Information exclusivity
- How to reset your root password
- How to unlock a locked user from the command line
- User File Uploads
- How we manage the TLS protocol CRIME vulnerability
- User email confirmation at sign-up
- Security of running jobs
- Proxying assets
- CI/CD Environment Variables
- Contributor and Development Docs
- Contribute to GitLab
- Community members & roles
- Implement design & UI elements
- Issues workflow
- Merge requests workflow
- Code Review Guidelines
- Style guides
- GitLab Architecture Overview
- CI/CD development documentation
- Database guides
- Database Review Guidelines
- Database Review Guidelines
- Migration Style Guide
- What requires downtime?
- Understanding EXPLAIN plans
- Rake tasks for developers
- Mass inserting Rails models
- GitLab Documentation guidelines
- Documentation Style Guide
- Documentation structure and template
- Documentation process
- Documentation site architecture
- Global navigation
- GitLab Docs monthly release process
- Telemetry Guide
- Usage Ping Guide
- Snowplow Guide
- Experiment Guide
- Feature flags in development of GitLab
- Feature flags process
- Developing with feature flags
- Feature flag controls
- Document features deployed behind feature flags
- Frontend Development Guidelines
- Accessibility & Readability
- Ajax
- Architecture
- Axios
- Design Patterns
- Frontend Development Process
- DropLab
- Emojis
- Filter
- Frontend FAQ
- GraphQL
- Icons and SVG Illustrations
- InputSetter
- Performance
- Principles
- Security
- Tooling
- Vuex
- Vue
- Geo (development)
- Geo self-service framework (alpha)
- Gitaly developers guide
- GitLab development style guides
- API style guide
- Go standards and style guidelines
- GraphQL API style guide
- Guidelines for shell commands in the GitLab codebase
- HTML style guide
- JavaScript style guide
- Migration Style Guide
- Newlines style guide
- Python Development Guidelines
- SCSS style guide
- Shell scripting standards and style guidelines
- Sidekiq debugging
- Sidekiq Style Guide
- SQL Query Guidelines
- Vue.js style guide
- Instrumenting Ruby code
- Testing standards and style guidelines
- Flaky tests
- Frontend testing standards and style guidelines
- GitLab tests in the Continuous Integration (CI) context
- Review Apps
- Smoke Tests
- Testing best practices
- Testing levels
- Testing Rails migrations at GitLab
- Testing Rake tasks
- End-to-end Testing
- Beginner's guide to writing end-to-end tests
- End-to-end testing Best Practices
- Dynamic Element Validation
- Flows in GitLab QA
- Page objects in GitLab QA
- Resource class in GitLab QA
- Style guide for writing end-to-end tests
- Testing with feature flags
- Translate GitLab to your language
- Internationalization for GitLab
- Translating GitLab
- Proofread Translations
- Merging translations from CrowdIn
- Value Stream Analytics development guide
- GitLab subscription
- Activate GitLab EE with a license