酷!學園
技術討論區 => DevOps 討論版 => 主題作者是: netman 於 2016-01-01 10:47
-
step1: goto download website:
https://about.gitlab.com/downloads/#centos7
step2: preparation:
sudo yum install curl openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
step3: installation:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
*note: curl may fails if behide proxy/firewall.
- setup proxy environment and use wget to download the script.rpm.sh, then run
step4: configuration:
sudo gitlab-ctl reconfigure
*note: you may want to change the URL if your servername is localhost.localdomain.
- Edit /etc/gitlab/gitlab.rb and change the following:
external_url "http://your.servername.or.ip.address"
step5: login
use browser to connect to the ip address, login with root (password: 5iveL!fe)
step6: getting start
GitLab Documentation (http://doc.gitlab.com/omnibus/)
連猴子都能懂的Git入門指南 (https://backlogtool.com/git-guide/tw/)
-
To enable HTTPS:
Ref: http://www.bonusbits.com/wiki/HowTo:Setup_HTTPS_for_Gitlab
1. Prepare Certs (Please generate them first!):
mkdir -p /etc/gitlab/ssl
cp /some/where/stores/ca.crt /etc/gitlab/ssl
cp /some/where/stores/gitlab.example.com.crt /etc/gitlab/ssl
cp /some/where/stores/gitlab.example.com.key /etc/gitlab/ssl
chmod 600 /etc/gitlab/ssl/gitlab.example.com.key
2. Edit gitlab.rb:
vim /etc/gitlab/gitlab.rb
external_url 'https://gitlab.example.com'
...
nginx['redirect_http_to_https'] = true
nginx['ssl_client_certificate'] = "/etc/gitlab/ssl/ca.crt" # Most root CA's are included by default
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key"
...
3. Restart gitlab:
gitlab-ctl reconfigure
gitlab-ctl restart
-
所以它自動會幫你處理PostgreSQL的部份?!
MTA只能用Postfix嗎?還是它也自動幫你生Config檔?!
-
1.安裝的時候我記得預設是PostgreSQL,當然也可以改MySql
2.MTA就隨意,你只要指定一個有效的MTA 就可以了
官方安裝文件
http://doc.gitlab.com/ce/install/installation.html
若擔心細節問題,我會建議用虛擬機做
我的作法是,直接找virtual machine的image file,改成自己要的來用,這樣就可以省去安裝與測試時的一些手工錯誤
當然啦,還要花時間調整,但速度就比較快了
Docker 版 https://hub.docker.com/r/gitlab/gitlab-ce/
Vagrant版 https://github.com/tuminoid/gitlab-installer
-
To Enable LDAP Accounts:
vi /etc/gitlab/gitlab.rb
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'saLAB'
host: 'gw.lab.sa'
port: 389
uid: 'uid'
method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: 'cn=Manager,dc=lab,dc=sa'
password: 'S@123$%^Admin'
active_directory: false
allow_username_or_email_login: false
base: 'ou=People,dc=lab,dc=sa'
user_filter: '(objectClass=posixAccount)'
EOS
gitlab-ctl reconfigure
gitlab-rake gitlab:ldap:check
gitlab-ctl restart
* FAQ:
Error:
Could not authorize you from Ldapmain because "Undefined method 'provider' for nil:nilclass".
Cause:
No email attribute in ldap entry
Solution:
smbldap-usermod -M <email> <username> # To allow Gitlab
-
所以它自動會幫你處理PostgreSQL的部份?!
MTA只能用Postfix嗎?還是它也自動幫你生Config檔?!
是的,用懶人包的方式都不用自己從頭配置了...
MTA部份可以用外部的,也可以用本機的,看你喜歡。
不妨先看看官方的Docs:
http://doc.gitlab.com/omnibus/
-
剛看一下system requirements要求不高,
可以用虛擬機練習安裝一下...
-
也有包好的 docker,不過要介接外面的 sql 就是了...
-
建議可以用docker-compose.yml這個來做,會較方便
docker-compose -f docker-compose.yml build
就可以幫你把volume & link都做好。
-
用sameersbn/docker-gitlab是拆成三個Docker.
但gitlab/gitlab-ce是不是有內建PostgreSQL?!
還是一樣把DB拆出來?!
-
又要自問自答!!
gitlab/gitlab-ce 是 all-in-one 的 docker image 包,除了 smtp 沒有外,其他都幫你包好了。
假如出現 Container 一直在 restart 的現象,就手動把 /var/log/gitlab/reconfigure 目錄先解出來,
再重新起應該就可以。
Install Ref:
http://doc.gitlab.com/omnibus/docker/README.html