Показаны различия между двумя версиями страницы.
Следующая версия | Предыдущая версия | ||
develop:gitlab [2022/08/31 04:47] admin создано |
develop:gitlab [2023/08/01 04:40] (текущий) admin |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
====== GitLab ====== | ====== GitLab ====== | ||
+ | |||
+ | |||
+ | |||
+ | ===== Общее ===== | ||
+ | < | ||
+ | < | ||
+ | |||
+ | Советуют установку доп компонентов | ||
+ | <code bash> | ||
+ | yum install curl policycoreutils-python postfix | ||
+ | apt install curl openssh-server ca-certificates | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | # Установка репозитория через скрипт | ||
+ | # Отличаются **gitlab-ce** и **gitlab-еe**- бесплатная и коммерческая с-но | ||
+ | curl https:// | ||
+ | |||
+ | # Далее ставим из пакета | ||
+ | apt install gitlab-ce | ||
+ | |||
+ | # Такой вариант тоже должен работать, | ||
+ | # EXTERNAL_URL=" | ||
+ | </ | ||
+ | |||
+ | Для указания адреса по которому будет доступен сервис | ||
+ | <code bash> | ||
+ | external_url ' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Утилита управления **gitlab-ctl**, | ||
+ | GitLab ставится с целым набором нужного себе софта, в т.ч. **postgres**, | ||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | [[https:// | ||
+ | Рассматриваем использование **Apache**\\ | ||
+ | В файле **/ | ||
+ | <code bash> | ||
+ | nginx[' | ||
+ | |||
+ | web_server[' | ||
+ | gitlab_workhorse[' | ||
+ | gitlab_workhorse[' | ||
+ | gitlab_workhorse[' | ||
+ | gitlab_workhorse[' | ||
+ | </ | ||
+ | |||
+ | Включаем модули apache **a2enmod proxy, rewrite, proxy_http**\\ | ||
+ | Создаем и включаем виртуальный хост | ||
+ | <code bash> | ||
+ | # This configuration has been tested on GitLab 8.2 | ||
+ | # Note this config assumes unicorn is listening on default port 8080 and | ||
+ | # gitlab-workhorse is listening on port 8181. To allow gitlab-workhorse to | ||
+ | # listen on port 8181, edit / | ||
+ | # | ||
+ | # gitlab_workhorse[' | ||
+ | # gitlab_workhorse[' | ||
+ | # | ||
+ | #Module dependencies | ||
+ | # mod_rewrite | ||
+ | # mod_proxy | ||
+ | # mod_proxy_http | ||
+ | < | ||
+ | ServerName < | ||
+ | ServerSignature Off | ||
+ | |||
+ | ProxyPreserveHost On | ||
+ | |||
+ | # Ensure that encoded slashes are not decoded but left in their encoded state. | ||
+ | # http:// | ||
+ | AllowEncodedSlashes NoDecode | ||
+ | |||
+ | < | ||
+ | # New authorization commands for apache 2.4 and up | ||
+ | # http:// | ||
+ | Require all granted | ||
+ | |||
+ | #Allow forwarding to gitlab-workhorse | ||
+ | ProxyPassReverse http:// | ||
+ | ProxyPassReverse http://< | ||
+ | </ | ||
+ | |||
+ | # Apache equivalent of nginx try files | ||
+ | # http:// | ||
+ | # http:// | ||
+ | RewriteEngine on | ||
+ | |||
+ | #Forward all requests to gitlab-workhorse except existing files like error documents | ||
+ | RewriteCond %{DOCUMENT_ROOT}/ | ||
+ | RewriteCond %{REQUEST_URI} ^/ | ||
+ | RewriteRule .* http:// | ||
+ | |||
+ | # needed for downloading attachments | ||
+ | DocumentRoot / | ||
+ | |||
+ | #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/ | ||
+ | ErrorDocument 404 /404.html | ||
+ | ErrorDocument 422 /422.html | ||
+ | ErrorDocument 500 /500.html | ||
+ | ErrorDocument 502 /502.html | ||
+ | ErrorDocument 503 /503.html | ||
+ | |||
+ | # Debian and CentOS distribution defaults provided below | ||
+ | LogFormat " | ||
+ | |||
+ | #For CentOS distributions use | ||
+ | #ErrorLog / | ||
+ | #CustomLog / | ||
+ | #CustomLog / | ||
+ | #CustomLog / | ||
+ | |||
+ | #For Debian distributions use | ||
+ | ErrorLog / | ||
+ | CustomLog / | ||
+ | CustomLog / | ||
+ | CustomLog / | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Удаление**\\ | ||
+ | т.к. вместе с ним ставится много всякого, | ||
+ | <code bash> | ||
+ | |||
+ | rpm -e gitlab-ce / apt purge gitlab-ce | ||
+ | |||
+ | find / -name gitlab | xargs rm -rf | ||
+ | |||
+ | # Просмотр | ||
+ | ps aux | grep gitlab | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | В дженкинсе создан спец пользователь | ||
+ | |||
+ | В проект добавлен пользователь дженкинса, | ||
+ | вкладка " | ||
+ | в интеграциях, | ||
+ | |||
+ | В проекте генерируем токен доступа, | ||
+ | после этого, в участниках проекта добавляется пользователь, | ||
+ | В дженкинсе, | ||
+ | выбираем тип " | ||
+ | В джобе выбран " | ||
+ | и выбрана "Use alternative credentials", | ||
+ | |||
+ | |||
+ | в пайплайне выполняются джобы | ||
+ | эти джобы транслиются на дженкинс джобы | ||
+ | в качестве раннеров должна выступать джобы дженкинса | ||
+ | |||
+ | <code bash> | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||