2019/12/03

gitlab-ce 설치

apt-get install gitlab-ce

/etc/gitlab/gitlab.rb

에다가
external_url "http://gitlab.example.com:4554"
# Disable nginx
nginx['enable'] = false
# Give apache user privileges to listen to GitLab
web_server['external_users'] = ['www-data']


unicorn['port'] = 7979

추가 후

적용
sudo gitlab-ctl reconfigure

아피치 적용파일 확인.
https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server/apache

sudo vi /etc/apache2/site-enable

<VirtualHost *:80>
  ServerName gitlab.fair.lan
  ServerSignature Off

  ProxyPreserveHost On

  # Ensure that encoded slashes are not decoded but left in their encoded state.
  # http://doc.gitlab.com/ce/api/projects.html#get-single-project
  AllowEncodedSlashes NoDecode

  <Location />
    Order deny,allow
    Allow from all

    #Allow forwarding to gitlab-workhorse
    ProxyPassReverse http://127.0.0.1:8181
    ProxyPassReverse http://gitlab.fair.lan/
  </Location>

  # Apache equivalent of nginx try files
  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
  RewriteEngine on

  #Forward all requests to gitlab-workhorse except existing files like error documents
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
  RewriteCond %{REQUEST_URI} ^/uploads/.*
  RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]

  # needed for downloading attachments
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
  ErrorDocument 404 /404.html
  ErrorDocument 422 /422.html
  ErrorDocument 500 /500.html
  ErrorDocument 502 /502.html
  ErrorDocument 503 /503.html

  # It is assumed that the log directory is in /var/log/apache2.
  # For Debian distributions you might want to change this to
  # /var/log/apache2.
  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  ErrorLog /var/log/apache2/gitlab.fair.lan_error.log
  CustomLog /var/log/apache2/gitlab.fair.lan_forwarded.log common_forwarded
  CustomLog /var/log/apache2/gitlab.fair.lan_access.log combined env=!dontlog
  CustomLog /var/log/apache2/gitlab.fair.lan.log combined

</VirtualHost>

즉 gitlab 에서 7979이용해 사용하며,
웹에서는 80으로 동작한다.

사용자 인터페이스 80 포트
gitlab 은 7979 포트로 사용.

시작 및 환경 재 설정
sudo gitlab-ctl reconfigure 

sudo gitlab-ctl restart

gitlab 삭제
sudo deluser --remove-all-files gitlab-www
sudo deluser --remove-all-files git gitlab-redis gitlab-psql gitlab-prometheus
sudo deluser --remove-all-files git
sudo deluser --remove-all-files gitlab-redis gitlab-psql gitlab-prometheus
sudo deluser --remove-all-files gitlab-redis
sudo deluser --remove-all-files gitlab-psql gitlab-prometheus
sudo deluser --remove-all-files gitlab-psql
sudo deluser --remove-all-files gitlab-prometheus

댓글 없음:

댓글 쓰기