060 Gitlab - kimdonggwan337/dongdong GitHub Wiki
[๊ฐ์]
- ๋ฐ๋ธ์ต์ค ํ๋ซํผ Gitlab์ ๋ชจ๋ํฐ๋ง ๊ตฌ์ถ์ ์ํด ํ์ต.
[GitLab]
- "GitLab" ๊ฒ์ฆ๋ ์น ๊ธฐ๋ฐ์ ๋ฐ๋ธ์ต์ค ํ๋ซํผ.
- Git ์ ์ฅ์ ๋ฐ CI/CD, ์ด์ ์ถ์ , ๋ณด์์ฑ ํ ์คํธ ๋ฑ์ ๊ธฐ๋ฅ์ ๊ฐ์ถ์๋ค.
- GitLab์ ์์ฒด์ ์ผ๋ก ํธ์คํ ํด์ ์ธ ์ ์๊ธฐ์ ์ฌ์ค Git ์ ์ฅ์๋ก ํ์ฉํ๊ธฐ๊ฐ ์ข๋ค.
- GitLab ๋ผ์ด์ผ์ค๋ ์ปค๋ฎค๋ํฐ ์๋์ (Community Edition ,CE)๊ณผ ์ํฐํ๋ผ์ด์ฆ ์๋์ (Enterprise Edition, EE) ๋ฑ์ด ์๋๋ฐ ์ปค๋ฎค๋ํฐ ์๋์ ์ ๊ฒฝ์ฐ ๋ฌด๋ฃ๋ก ์ฌ์ฉ์ด ๊ฐ๋ฅํ๋ค.
[ํ๊ฒฝ]
- OS: ubuntu:20.04
- Infra: Azure Cloud VM(Standard D2as v5)
- vCPU: 2
- RAM: 8GiB
- ์ํํธ์จ์ด: Prometheus, Grafana
[Gitlab ์ฐธ์กฐ ์ฌ์ดํธ]
- https://about.gitlab.com/install
- ์๋ ํ๋ฉด์์ ์๋ฒ ํ๊ฒฝ์ ๋ง๊ฒ ํด๋ฆญ
[Gitlab ์ค์น]
# [GitLab dependencies ํฉํค์ง ์ค์น]
$ sudo apt-get update
$ sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
$ sudo apt-get install -y postfix
# [GitLab ๋ ํ์งํ ๋ฆฌ ์ถ๊ฐ]
$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
# [GitLab ์ค์น]
$ sudo apt-get install gitlab-ee
# [GitLab ํ๊ฒฝํ์ผ ์์ (gitlab.rb)]
$ sudo vi /etc/gitlab/gitlab.rb
# [์น์์ ์ ์ํ URL ์ค์ ]
external_url 'http://20.214.182.191:6060'
# [GitLab ํ๊ฒฝ ํ์ผ ์ ์ฉ ๋ฐ ์ํ ํ์ธ] /etc/gitlab/gitlab.rb ํ์ผ ๋ณ๊ฒฝ ํ gitlab-ctl reconfigure ๋ช
๋ น ์ํ
$ gitlab-ctl reconfigure: gitlab ๋ณ๊ฒฝ ํ์ผ ์ฌ๊ตฌ์ฑ ๋ฐ ์ฌ๊ธฐ๋
$ gitlab-ctl stop: ์ค์ง
$ gitlab-ctl start: ์์
$ gitlab-ctl restart: ์ฌ์์
$ gitlab-ctl status: ์ํ ํ์ธ
# [GitLab ์ ์ ํจ์ค์๋ ํ์ธ]
$ sudo cat /etc/gitlab/initial_root_password
----------------------์๋ต----------------------
Password: EB1uIyqRx0gKHufzCqLui4UgRd/8++zv2NRQDHYZTks=
------------------------------------------------
[Gitlab ์ ์]
- ID: root
- PWD: [initial_root_password]
[Gitlab ์ญ์ ]
$ sudo gitlab-ctl cleanse
$ sudo gitlab-ctl uninstall
$ sudo apt remove gitlab-ee
$ sudo apt purge gitlab-ee
$ rm -rf /opt/gitlab
$ rm -rf /var/opt/gitlab
$ rm -rf /etc/gitlab
$ rm -rf /var/log/gitlab
[Gitlab prometheus ์ค์ ํ์ฑํ] "Linux ํจํค์ง"๋ฅผ ์ฌ์ฉํ๋ ๋ ๋ฆฝํ Prometheus
$ sudo vi /etc/gitlab/gitlab.rb
roles ['monitoring_role']
# Prometheus
prometheus['listen_address'] = '0.0.0.0:9090'
prometheus['monitor_kubernetes'] = false
# ์๋ ๊ทธ๋ผํ๋๋ ์ฐธ์กฐ ๋ฌธ์์๋ ๋์์์ง๋ง gitlab 16.0 ์ด์ ๋ฒ์ ์์๋ ์ฌ์ฉ ๋ถ๊ฐํ๋ฏ๋ก ์ ๊ฑฐ
# Grafana
# grafana['enable'] = true
# grafana['admin_password'] = 'toomanysecrets'
# grafana['disable_login_form'] = false
# Enable service discovery for Prometheus
consul['enable'] = true
consul['monitoring_service_discovery'] = true
consul['configuration'] = {
retry_join: %w(10.0.0.1 10.0.0.2 10.0.0.3), # The addresses can be IPs or FQDNs
}
# Nginx - For Grafana access
nginx['enable'] = true
gitlab_rails['prometheus_address'] = 'localhost:9090'