Gitlab

Установка

Установка на хост машине

$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash $ sudo EXTERNAL_URL="https://gitlab.da57.ru" apt install gitlab-ce=16.9.1-ce.0

Установка в контейнере

Контейнер

version: "3.7" services: service: # Old: gitlab/gitlab-ce:17.3.7-ce.0 image: gitlab/gitlab-ce:17.7.0-ce.0 restart: always environment: TZ: 'Europe/Moscow' GITLAB_OMNIBUS_CONFIG: | external_url 'http://192.168.1.2' registry_external_url 'http://192.168.1.2' gitlab_rails['backup_keep_time'] = 172800 postgresql['enable'] = true postgresql['port'] = 5432 postgresql['listen_address'] = "*" postgresql['md5_auth_cidr_addresses'] = ['127.0.0.1/32','0.0.0.0/0','::1/128'] postgresql['trust_auth_cidr_addresses'] = ['127.0.0.1/32','::1/128'] gitlab_rails['db_adapter'] = 'postgresql' gitlab_rails['db_encoding'] = 'unicode' gitlab_rails['db_database'] = 'gitlabhq_production' gitlab_rails['db_host'] = '127.0.0.1' gitlab_rails['db_port'] = '5432' gitlab_rails['db_username'] = 'gitlab' # Database owner. gitlab_rails['db_password'] = 'gitlab' # Database owner's password." volumes: - "gitlab-etc:/etc/gitlab" - "gitlab-opt:/opt/gitlab" - "gitlab-var:/var/opt/gitlab" - "gitlab-log:/var/log/gitlab" networks: localnetwork: ipv4_address: "192.168.1.2" ports: - '192.168.1.2:5432:5432' volumes: gitlab-etc: {} gitlab-opt: {} gitlab-var: {} gitlab-log: {} gitlab-runner: {} networks: localnetwork: name: localnetwork driver: ipvlan driver_opts: parent: eno1 ipvlan_mode: l3 ipam: config: - subnet: "192.168.1.0/24" ip_range: "192.168.1.1/24" gateway: "192.168.1.1"

Установка Runners

Контейнер

version: "3.7" services: service: runner: image: 'gitlab/gitlab-runner:latest' container_name: gitlab-runner restart: always volumes: - 'gitlab-runner:/etc/gitlab-runner' networks: localnetwork: ipv4_address: "192.168.1.5"

ssh

parallels

kubernetes - Запуск runner / обработчика внутри машины с kubernetes (клиент)

docker-autoscaler

custom

virtualbox

docker - Запуск runner / обработчика внутри контейнера (ubuntu:latest)

docker-windows

docker+machine

instance

shell - Запуск runner / обработчика внутри машины с gitlab-runner

Обслужинание

$ systemctl stop gitlab-runner $ systemctl stop gitlab-runsvdir $ systemctl start gitlab-runsvdir $ gitlab-ctl reconfigure

Migrate all

В контейнере

$ gitlab-rake gitlab:uploads:migrate:all $ gitlab-rake db:migrate:status $ gitlab-rake db:migrate $ gitlab-ctl hup puma $ gitlab-ctl restart sidekiq

Check / Проверка / Инструменты

В контейнере

$ gitlab-rake gitlab:gitlab_shell:check $ gitlab-rake gitlab:gitaly:check $ gitlab-rake gitlab:sidekiq:check $ gitlab-rake gitlab:incoming_email:check $ gitlab-rake gitlab:ldap:check $ gitlab-rake gitlab:app:check $ gitlab-rake gitlab:check $ gitlab-rake cache:clear $ gitlab-rake gitlab:check SANITIZE=true $ gitlab-ctl restart

PostgresQL

В контейнере

$ gitlab-psql -d gitlabhq_production $ \l

pg_hba.conf

host all all 0.0.0.0/0	trust

postgresql.conf

listen_addresses = '127.0.0.1'

Ошибки

ci/cd

- Clear project tokens UPDATE projects SET runners_token = NULL, runners_token_encrypted = NULL; -- Clear group tokens UPDATE namespaces SET runners_token = NULL, runners_token_encrypted = NULL; -- Clear instance tokens UPDATE application_settings SET runners_registration_token_encrypted = NULL; -- Clear key used for JWT authentication -- This may break the $CI_JWT_TOKEN job variable: -- https://gitlab.com/gitlab-org/gitlab/-/issues/325965 UPDATE application_settings SET encrypted_ci_jwt_signing_key = NULL; -- Clear runner tokens UPDATE ci_runners SET token = NULL, token_encrypted = NULL; -- UPDATE ci_builds SET token_encrypted = NULL WHERE STATUS IN ('created', 'pending');

Документация

[https://docs.gitlab.com/ee/administration/package_information/postgresql_versions.html|Какая версия PostgreSQL подходит к версии Gitlab]