User Tools

Site Tools


инструмент_gitlab

Инструмент GitLab

Установка

Настройка

Файл конфигурации

# cat /etc/gitlab/gitlab.rb
# gitlab-ctl reconfigure

GitLab Docker Registry

# cat /etc/gitlab/gitlab.rb
...
registry_external_url 'http://server.corpX.un'
...
gitlab_rails['registry_enabled'] = true
...
gitlab_rails['registry_host'] = "server.corpX.un"
...
registry['registry_http_addr'] = "server.corpX.un:5000"
...

GitLab Grafana

# cat /etc/gitlab/gitlab.rb
...
grafana['http_addr'] = '0.0.0.0'
...

Управление пользователями

Использование LDAP

# cat /etc/gitlab/gitlab.rb
...
gitlab_rails['ldap_enabled'] = true

gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
  main:
    label: 'LDAP'
    host: 'server.corpX.un'
    port: 389
#    port: 636
    uid: 'uid'
    bind_dn: 'cn=admin,dc=corpX,dc=un'
    password: 'secret'
    encryption: 'plain'
#    encryption: 'simple_tls'
    active_directory: false
    base: 'ou=People,dc=corpX,dc=un'
...

GitLab Runner

root@node2:~# gitlab-runner register
shell или docker

root@node2:~# cat /etc/gitlab-runner/config.toml
log_level = "debug"
...
root@node2:~# systemctl start gitlab-runner

GitLab CI/CD

Пример shell make

student@gate:~/dhcp$ cat .gitlab-ci.yml
test1:
  stage: test
  script:
    - echo $(date) "Do test dhcpd" >> /tmp/Bash.gitlab-ci.log
    - make test
  tags:
    - dhcptest

deploy1:
  stage: deploy
  script:
    - echo $(date) "Do deploy dhcpd" >> /tmp/Bash.gitlab-ci.log
    - sudo make install
  tags:
    - dhcpdeploy

Пример shell ansible

root@server:~/openvpn1# cat .gitlab-ci.yml
deploy_test:
  stage: deploy
  script:
    - echo $(date) "Deploy TEST openvpn1" >> /tmp/Bash.gitlab-ci.log
    - ansible-playbook openvpn1.yaml -i inventory.yaml -e "variable_host=test_nodes"
  tags:
    - openvpn1deploy
  rules:
    - if: ($CI_COMMIT_BRANCH == "test" && $CI_COMMIT_REF_NAME == "test")

deploy_prod:
  stage: deploy
  script:
    - echo $(date) "Deploy PROD openvpn1" >> /tmp/Bash.gitlab-ci.log
    - ansible-playbook openvpn1.yaml -i inventory.yaml
  tags:
    - openvpn1deploy
  rules:
    - if: ($CI_COMMIT_BRANCH == "main" && $CI_COMMIT_REF_NAME == "main")

Пример docker

vagrant@node1:~/project1$ cat .gitlab-ci.yml
test1:
  stage: test
  script:
    - echo $(date) "Do a test here" >> /tmp/Bash.gitlab-ci.log
    - shellcheck webd/webd
  tags:
    - shellcheck

deploy1:
  stage: deploy
  script:
    - echo $(date) "Do your deploy here" >> /tmp/Bash.gitlab-ci.log
    - docker-compose up -d
  tags:
    - webddeploy

Сервер OAuth2

  • !!! URL без финального “/” !!!
Admin Area-> Applications-> val-auth-test
  Callback URL: https://val.bmstu.ru/auth-test
  Trusted: Yes
инструмент_gitlab.txt · Last modified: 2022/06/26 18:55 by val