728x90
반응형

 

 

Gitlab 사용시 자주 사용하는 다양한 명령어 사용법에 대해 작성한 글입니다. 

 

Gitlab 버전 정보 확인

gitlab-rake gitlab:env:info

gitlab 서비스 상태 확인 

gitlab-ctl status
root@ubuntu2004:/var/log# gitlab-ctl status
run: alertmanager: (pid 1473216) 7764s; run: log: (pid 1440782) 14293s
run: gitaly: (pid 1442283) 14000s; run: log: (pid 1438105) 14970s
run: gitlab-exporter: (pid 1473228) 7764s; run: log: (pid 1440657) 14312s
run: gitlab-kas: (pid 1473230) 7764s; run: log: (pid 1438363) 14948s
run: gitlab-workhorse: (pid 1473241) 7763s; run: log: (pid 1438889) 14659s
run: grafana: (pid 1473251) 7763s; run: log: (pid 1441383) 14201s
run: logrotate: (pid 1493932) 562s; run: log: (pid 1438049) 14982s
run: nginx: (pid 1473268) 7762s; run: log: (pid 1438932) 14648s
run: node-exporter: (pid 1473276) 7762s; run: log: (pid 1440636) 14315s
run: postgres-exporter: (pid 1473282) 7761s; run: log: (pid 1440816) 14287s
run: postgresql: (pid 1442385) 13995s; run: log: (pid 1438227) 14959s
run: prometheus: (pid 1473290) 7761s; run: log: (pid 1440757) 14298s
run: puma: (pid 1473300) 7760s; run: log: (pid 1438854) 14671s
run: redis: (pid 1442415) 13994s; run: log: (pid 1438068) 14976s
run: redis-exporter: (pid 1473306) 7760s; run: log: (pid 1440682) 14303s
run: sidekiq: (pid 1473315) 7759s; run: log: (pid 1438872) 14665s

Gitlab Log 확인

gitlab 사용시 로그 확인 방법에 대해 알아봅니다. 

gitlab 웹 로그 확인 

/var/log/gitlab/gitlab-rails/production.log  에 로그가 남습니다. tail 로 실시간 로그를 확인 할수 있습니다. 

tail -f  /var/log/gitlab/gitlab-rails/production.log

 

root@ubuntu2004:~# tail -f  /var/log/gitlab/gitlab-rails/production.log
Completed 200 OK in 34ms (Views: 0.5ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 814)
Started GET "/api/v4/geo/proxy" for 127.0.0.1 at 2022-04-16 12:36:37 +0900
Started GET "/-/metrics" for 127.0.0.1 at 2022-04-16 12:36:44 +0900
Processing by MetricsController#index as HTML
Completed 200 OK in 33ms (Views: 0.4ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 814)
Started GET "/api/v4/geo/proxy" for 127.0.0.1 at 2022-04-16 12:36:47 +0900
Started GET "/api/v4/geo/proxy" for 127.0.0.1 at 2022-04-16 12:36:57 +0900
Started GET "/-/metrics" for 127.0.0.1 at 2022-04-16 12:36:59 +0900
Processing by MetricsController#index as HTML
Completed 200 OK in 32ms (Views: 0.4ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 814)
Started GET "/api/v4/geo/proxy" for 127.0.0.1 at 2022-04-16 12:37:07 +0900
Started GET "/-/metrics" for 127.0.0.1 at 2022-04-16 12:37:14 +0900
Processing by MetricsController#index as HTML
Completed 200 OK in 36ms (Views: 0.5ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 814)

 

gitlab 서비스 로그 확인 

gitlab-ctl tail 명령을 통해  gitlab 서버에서 남기는 각종 로그를 확인할수 있습니다. 

  • gitlab-ctl tail [service 명]
  • 서비스명은 gitlab-ctl status 로 확인되는 서비스명입니다. 
gitlab-ctl tail
gitlab-ctl tail postgresql
gitlab-ctl tail ngix

gitlab-ctl tail

gitlab url 변경 방법 

  • 현재 저장소를 확인하고 변경된 주소로 지정 합니다. 
git remote -v 

git remote set-url origin https://gitlab.com/your-new-repo.git

 

 

728x90
반응형
728x90
반응형

GitLab 설치 버전 확인 

Ubuntu 20.04.4 LTS 버전에서 에서 GitLab 설치하는 방법에 대해 알아보겠습니다. 

설치는 우분투 공식 홈페이지 자료를 이용해 설치 하는 내용을 담아 보겠습니다. 

우분투 GiltLab 설치 가이드 (공식)

 

GitLab 는 EE(Enterprise Edition)  버전과 CE(Community Edition) 버전은로 나뉘는데 EE 버전은 30일 무료 사용후 유료 정책으로 전환 된다고 합니다. 

 

다만 30일 이후 유료로 전환 하지 않으면 CE 버전으로 자동 전환 된다고 합니다. 

그래서 저는 그냥 EE 버전을 사용해서 30일 이후 CE 버전으로 변경되는지 확인해 보겠습니다. 

 

GitLab  라이센스 쟁책

  • GitLab CE : Core (무료)
  • GitLab EE : Core ->STARTER ->  PREMIUM ->  ULTIMATE

GitLab-ee 설치

GitLab-ee 버전 설치하는 방법에 대해 자세히 알아보겠습니다. 

잘따라오시면 쉽게 설치가 가능 합니다. 

1.GitLab dependencies 팩키지 설치 

sudo apt-get update
sudo apt-get upgrade -y

sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

sudo apt-get install -y postfix

 

2.GitLab 팩키지 레파지토리 추가 및 설치

  • gitlab 레파지토리 추가
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
  • gitlab  설치
sudo apt-get install gitlab-ee

3.GitLab 환경파일 수정 (gitlab.rb)

/etc/gitlab/gitlab.rb 파일을 열어서 external_url 을 변경 합니다. 

해당 url 은 웹에서 접속할 URL 설정입니다. 

  • external_url 'http://116.121.154.196:6060'

4.GitLab 환경 파일 적용 및 상태 확인 

gitlab-ctl reconfigure 명령을 통해 환경파일을 재구성 하고 Gitlab 을 재시작 합니다. 

/etc/gitlab/gitlab.rb 파일이 변경 되었다면 gitlab-ctl reconfigure 명령을 수행해야만 적용이 됩니다. 

  • gitlab-ctl reconfigure :gitlab 변경 파일 재구성및 재기동 
  • gitlab-ctl stop :gitlab 중지
  • gitlab-ctl start :gitlab 시작
  • gitlab-ctl restart :gitlab 재시작 

gitlab-ctl status 명령으로 현재 gitlab 상태를 확인 합니다. 

웹서버 및 database 가 설치 되었습니다. 

gitlab 웹 접속이 안될때는 항상 상태를 먼저 확인해보세요 

gitlab 상태 확인

 

5.GitLab 접속

최초 설치 후 접속시 아래 initial_root_password 라는 파일에 패스워드가 작성됩니다.

  • root 접속 패스워드: /etc/gitlab/initial_root_password

external_url 에 설정했던 URL로 접속 합니다. 

접속은 root/[initial_root_password]파일 비밀번호 입니다. 

Ubuntu Gitlab connect

정상적으로 설치가 되고 접속이 된다면 이제 gitlab 을 사용할 준비가 끝났습니다. 

gitlab 접속화면

6.Gitlab 비밀번호 변경 

initial_root_password 를 기억하고 관리 하는 사람은 없겠죠?

마지막으로 root 비밀번호를 변경 하겠습니다. 

우측 상단 계정 관리 버튼을 눌러서 Edit Profile을 설정해서 비밀번호를 변경 합니다. 

관리계정 버튼 클릭 ->Edit Profile -> Password -> 비밀번호 변경 

 

7.GitLab 삭제 

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

 

 

728x90
반응형

+ Recent posts