User Tools

Site Tools


инструмент_gitlab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
инструмент_gitlab [2022/06/15 09:18]
val [GitLab CI/CD]
инструмент_gitlab [2022/06/26 18:55]
val
Line 8: Line 8:
   * [[https://​about.gitlab.com/​install/​|Install self-managed GitLab]]   * [[https://​about.gitlab.com/​install/​|Install self-managed GitLab]]
   * Доступно из РФ: [[https://​packages.gitlab.com/​gitlab/​gitlab-ce]]   * Доступно из РФ: [[https://​packages.gitlab.com/​gitlab/​gitlab-ce]]
 +
 +<​code>​
 +# cat /​etc/​gitlab/​initial_root_password
 +</​code>​
  
   * [[https://​www.techbeatly.com/​configure-custom-ssl-to-secure-gitlab-server/​|Configure Custom SSL to Secure GitLab Server]]   * [[https://​www.techbeatly.com/​configure-custom-ssl-to-secure-gitlab-server/​|Configure Custom SSL to Secure GitLab Server]]
Line 13: Line 17:
 ===== Настройка ===== ===== Настройка =====
  
 +==== Файл конфигурации ====
 <​code>​ <​code>​
 # cat /​etc/​gitlab/​gitlab.rb # cat /​etc/​gitlab/​gitlab.rb
 +</​code><​code>​
 +# gitlab-ctl reconfigure
 </​code>​ </​code>​
  
-==== GitLab ​Runner ​==== +==== GitLab ​Docker Registry ​====
- +
-  * [[https://​docs.gitlab.com/​runner/​install/​linux-manually.html|Install GitLab Runner manually on GNU/​Linux]] +
-  * [[https://​val.bmstu.ru/​unix/​Git/​gitlab-runner_amd64.deb]] (15.0.0)  +
 <​code>​ <​code>​
-root@node2:​~# gitlab-runner register +cat /etc/gitlab/gitlab.rb 
-shell +</​code><​code>​ 
- +... 
-root@node2:~# cat /etc/gitlab-runner/​config.toml +registry_external_url 'http://server.corpX.un'​ 
-log_level ​= "debug"+... 
 +gitlab_rails['​registry_enabled'​] = true 
 +... 
 +gitlab_rails['​registry_host'​] ​= "server.corpX.un"​ 
 +... 
 +registry['​registry_http_addr'​] = "​server.corpX.un:​5000"
 ... ...
-</​code>​ 
-  * Технология Docker [[Технология Docker#​Предоставление прав непривилегированным пользователям]] 
-<​code>​ 
-root@node2:​~#​ systemctl start gitlab-runner 
 </​code>​ </​code>​
  
-==== GitLab ​CI/CD ==== +==== GitLab ​Grafana ​====
- +
-  * [[https://​docs.gitlab.com/​ee/​ci/​examples/​|GitLab CI/CD Examples]] +
 <​code>​ <​code>​
-vagrant@node1:​~/​project1$ ​cat .gitlab-ci.yml +cat /etc/gitlab/gitlab.rb 
-#​before_script:​ +</code><code> 
-#  - echo $(date) "​Before script section"​ >> ​/tmp/Bash.gitlab-ci.log +... 
- +grafana['​http_addr'​] = '0.0.0.0' 
-#​after_script:​ +...
-#  - echo $(date) "After script section" ​>> ​/tmp/Bash.gitlab-ci.log +
- +
-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+
 </​code>​ </​code>​
- 
 ==== Управление пользователями ==== ==== Управление пользователями ====
  
Line 91: Line 74:
     active_directory:​ false     active_directory:​ false
     base: '​ou=People,​dc=corpX,​dc=un'​     base: '​ou=People,​dc=corpX,​dc=un'​
 +...
 +</​code>​
 +
 +===== GitLab Runner =====
 +
 +  * [[https://​docs.gitlab.com/​runner/​install/​linux-manually.html|Install GitLab Runner manually on GNU/Linux]]
 +
 +  * [[https://​medium.com/​@ryzmen/​gitlab-fast-pipelines-stages-jobs-c51c829b9aa1|GitLab:​ understanding pipelines, stages, jobs and organising them efficiently for speed and feedback loop]]
 +
 +  * [[https://​val.bmstu.ru/​unix/​Git/​gitlab-runner_amd64.deb]] (15.0.0) ​
 +
 +<​code>​
 +root@node2:​~#​ gitlab-runner register
 +shell или docker
 +
 +root@node2:​~#​ cat /​etc/​gitlab-runner/​config.toml
 +log_level = "​debug"​
 ... ...
 </​code><​code>​ </​code><​code>​
-# gitlab-ctl reconfigure+root@node2:​~systemctl start gitlab-runner 
 +</​code>​ 
 + 
 +===== GitLab CI/CD ===== 
 + 
 +  * [[https://​docs.gitlab.com/​ee/​ci/​examples/#​cicd-templates|CI/​CD templates]] 
 + 
 +==== Пример shell make ==== 
 + 
 +<​code>​ 
 +student@gate:​~/​dhcp$ cat .gitlab-ci.yml 
 +</​code><​code>​ 
 +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 
 + 
 +</​code>​ 
 + 
 +==== Пример shell ansible ==== 
 + 
 +<​code>​ 
 +root@server:​~/​openvpn1#​ cat .gitlab-ci.yml 
 +</​code><​code>​ 
 +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"​) 
 +</​code>​ 
 + 
 +==== Пример docker ==== 
 + 
 +  * Технология Docker [[Технология Docker#​Предоставление прав непривилегированным пользователям]] 
 + 
 +<​code>​ 
 +vagrant@node1:​~/​project1$ cat .gitlab-ci.yml 
 +</​code><​code>​ 
 +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
 </​code>​ </​code>​
  
-==== Сервер OAuth2 ====+===== Сервер OAuth2 ​=====
  
   * !!! URL без финального "/"​ !!!   * !!! URL без финального "/"​ !!!
инструмент_gitlab.txt · Last modified: 2024/06/13 08:39 by val