GitLab:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→參考資料) |
|||
(未显示同一用户的10个中间版本) | |||
第7行: | 第7行: | ||
== 安裝 == | == 安裝 == | ||
官方 | 官方 的 建議 是 ( 服務500人 )<ref>{{Cite web |url=https://docs.gitlab.com/ee/install/requirements.html |title=Requirements |accessdate=2023-03-08}}</ref> : | ||
* 4 CPU cores | |||
* 4 GB RAM | |||
* 2 GB Swap | |||
實際測試發現剛裝完大約吃1.5 GB的記憶體,一個人自己用之後會 到3 GB左右。 | |||
這邊介紹的是[[Ubuntu]]下的安裝過程<ref>{{Cite web |url=https://about.gitlab.com/install/?version=ce#ubuntu |title=GitLab Installation |accessdate=2019-12-10}}</ref>: | 這邊介紹的是[[Ubuntu]]下的安裝過程<ref>{{Cite web |url=https://about.gitlab.com/install/?version=ce#ubuntu |title=GitLab Installation |accessdate=2019-12-10}}</ref>: | ||
第31行: | 第37行: | ||
=== 帳號 === | === 帳號 === | ||
* 安裝完 | * 安裝完 後console會出現指示初始 密碼 ,目前 的 版本會在<code>/etc/gitlab/initial_root_password</codE> 。 | ||
* 通常會關閉註冊(在網頁界面上就可以關閉)。 | * 通常會關閉註冊(在網頁界面上就可以關閉)。 | ||
* 使用LDAP認證的設定需要透過<code>/etc/gitlab/gitlab.rb</code>修改,使用LDAPS的需要改設定使用<code>port: 636</code>與<code>encryption: 'simple_tls'</code>: | * 使用LDAP認證的設定需要透過<code>/etc/gitlab/gitlab.rb</code>修改,使用LDAPS的需要改設定使用<code>port: 636</code>與<code>encryption: 'simple_tls'</code>: | ||
第74行: | 第80行: | ||
=== 自己的nginx === | === 自己的nginx === | ||
官方有文件說明如何修改<ref>{{Cite web| url=https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server| title=Using a non-bundled web-server |language=en |accessdate=2021-06-24}}</ref>,先從<code>/etc/gitlab/gitlab.rb</code>裡關閉[[nginx]]相關設定。找到對應的區塊加上對應的設定: | 官方有文件說明如何修改<ref>{{Cite web| url=https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server| title=Using a non-bundled web-server |language=en |accessdate=2021-06-24}}</ref>,先從<code>/etc/gitlab/gitlab.rb</code>裡關閉[[nginx]]相關設定。找到 各自 對應的區塊加上對應的設定: | ||
<syntaxhighlight lang="ruby"> | <syntaxhighlight lang="ruby"> | ||
第87行: | 第93行: | ||
sudo gitlab-ctl reconfigure | sudo gitlab-ctl reconfigure | ||
</syntaxhighlight> | </syntaxhighlight> | ||
後續就可以設定自己的nginx了。 | |||
== 常用指令 == | == 常用指令 == | ||
重新讀取設定檔並且更新環境: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo gitlab-ctl reconfigure | sudo gitlab-ctl reconfigure | ||
</syntaxhighlight> | </syntaxhighlight> | ||
更新[[Let's Encrypt]]的憑證: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
第98行: | 第110行: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 相關連結 == | |||
* [[GitLab/Runner]] | |||
== 參考資料 == | == 參考資料 == |
2023年5月26日 (五) 13:30的最新版本
GitLab是一套以Git为中心而发展出来的软件。
简介
GitLab算是目前功能性与社群数量都比较成熟的方案。
安装
官方的建议是(服务500人)[1]:
- 4 CPU cores
- 4 GB RAM
- 2 GB Swap
实际测试发现刚装完大约吃1.5 GB的内存,一个人自己用之后会到3 GB左右。
sudo apt install -y ca-certificates curl openssh-server postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" apt install gitlab-ce
最近的版本可能会需要处理安装时Let's Encrypt凭证申请失败的相关的问题[3]。
移除
移除需要多个步骤[4]:
sudo gitlab-ctl uninstall; sudo gitlab-ctl cleanse; sudo gitlab-ctl remove-accounts; sudo apt purge -y gitlab-ce; sudo rm -rf /etc/gitlab /opt/gitlab /var/log/gitlab /var/opt/gitlab
设定
账号
- 安装完后console会出现指示初始密码,目前的版本会在
/etc/gitlab/initial_root_password
。 - 通常会关闭注册(在网页界面上就可以关闭)。
- 使用LDAP认证的设定需要透过
/etc/gitlab/gitlab.rb
修改,使用LDAPS的需要改设定使用port: 636
与encryption: 'simple_tls'
:
gitlab_rails['ldap_enabled'] = true
gitlab_rails['prevent_ldap_sign_in'] = false
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main:
label: 'LDAP'
host: 'ldap.example.com'
port: 389
uid: 'uid'
bind_dn: ''
password: ''
encryption: 'plain'
verify_certificates: true
smartcard_auth: false
active_directory: false
allow_username_or_email_login: true
lowercase_usernames: true
block_auto_created_users: false
base: 'ou=People,dc=example,dc=com'
user_filter: ''
attributes:
email: ['mail', 'email', 'userPrincipalName']
EOS
记录档
最容易爆掉的是Prometheus的TSDB资料[5],这点可以设定/etc/gitlab/gitlab.rb
内的prometheus['flags']
限缩大小:
prometheus['flags'] = {
'storage.tsdb.path' => "/var/opt/gitlab/prometheus/data",
'storage.tsdb.retention.time' => "15d",
'config.file' => "/var/opt/gitlab/prometheus/prometheus.yml",
}
自己的nginx
官方有文件说明如何修改[6],先从/etc/gitlab/gitlab.rb
里关闭nginx相关设定。找到各自对应的区块加上对应的设定:
nginx['enable'] = false
web_server['external_users'] = ['www-data']
gitlab_rails['trusted_proxies'] = [ '127.0.0.0/8' ]
接下来让设定生效:
sudo gitlab-ctl reconfigure
后续就可以设定自己的nginx了。
常用指令
重新读取设定档并且更新环境:
sudo gitlab-ctl reconfigure
更新Let's Encrypt的凭证:
sudo gitlab-ctl renew-le-certs
相关连结
参考资料
- ↑ Requirements. [2023-03-08].
- ↑ GitLab Installation. [2019-12-10].
- ↑ Unable to renew letsencrypt certificate anymore. [2019-12-18].
- ↑ Is it fine to remove the /opt/gitlab/ directory manually after removing the gitlab package from the system?. 2016-09-14 [2019-12-10].
- ↑ Clear up Postges / Prometheus data. 2020-05-29 [2020-08-03] (English).
- ↑ Using a non-bundled web-server. [2021-06-24] (English).
外部链接
- 官方网站 (英文)