This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
инструмент_gitlab [2022/06/26 18:55] val |
инструмент_gitlab [2022/07/17 11:39] val [Установка] |
||
---|---|---|---|
Line 6: | Line 6: | ||
===== Установка ===== | ===== Установка ===== | ||
+ | * RAM от 4Gb | ||
* [[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]] | ||
+ | * [[https://www.techbeatly.com/configure-custom-ssl-to-secure-gitlab-server/|Configure Custom SSL to Secure GitLab Server]] | ||
+ | |||
+ | <code> | ||
+ | # ansible-playbook conf/ansible/roles/mail.yml | ||
+ | |||
+ | # cat /etc/apache2/ports.conf | ||
+ | ... | ||
+ | 81 | ||
+ | ... | ||
+ | |||
+ | # apt-get install -y curl openssh-server ca-certificates perl | ||
+ | |||
+ | # curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash | ||
+ | |||
+ | # time EXTERNAL_URL="http://server.corp13.un" apt-get install gitlab-ce | ||
+ | ... | ||
+ | real 15m49.787s | ||
+ | .. | ||
+ | </code> | ||
+ | ===== Подключение ===== | ||
+ | |||
+ | * [[https://stackoverflow.com/questions/60062065/gitlab-initial-root-password|gitlab initial root password]] | ||
<code> | <code> | ||
Line 13: | Line 36: | ||
</code> | </code> | ||
- | * [[https://www.techbeatly.com/configure-custom-ssl-to-secure-gitlab-server/|Configure Custom SSL to Secure GitLab Server]] | + | |
===== Настройка ===== | ===== Настройка ===== | ||
Line 99: | Line 122: | ||
* [[https://docs.gitlab.com/ee/ci/examples/#cicd-templates|CI/CD templates]] | * [[https://docs.gitlab.com/ee/ci/examples/#cicd-templates|CI/CD templates]] | ||
+ | * [[https://stackoverflow.com/questions/64725914/how-to-disable-auto-pipelines-in-gitlab|How to disable auto pipelines in gitlab]] | ||
==== Пример shell make ==== | ==== Пример shell make ==== | ||
Line 149: | Line 173: | ||
</code> | </code> | ||
- | ==== Пример docker ==== | + | ==== Пример shell docker ==== |
* Технология Docker [[Технология Docker#Предоставление прав непривилегированным пользователям]] | * Технология Docker [[Технология Docker#Предоставление прав непривилегированным пользователям]] | ||
Line 169: | Line 193: | ||
- echo $(date) "Do your deploy here" >> /tmp/Bash.gitlab-ci.log | - echo $(date) "Do your deploy here" >> /tmp/Bash.gitlab-ci.log | ||
- docker-compose up -d | - docker-compose up -d | ||
+ | tags: | ||
+ | - webddeploy | ||
+ | </code> | ||
+ | |||
+ | ==== Пример shell Kubernetes ==== | ||
+ | <code> | ||
+ | gitlab-runner@gate:~/webd$ cat build.sh | ||
+ | </code><code> | ||
+ | #!/bin/sh | ||
+ | |||
+ | VER="$(echo $CI_COMMIT_MESSAGE | sed 's/[^a-zA-Z0-9\.]//g')" | ||
+ | |||
+ | docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD http://$CI_REGISTRY | ||
+ | docker build -t $CI_REGISTRY/$CI_REGISTRY_IMAGE:$VER webd | ||
+ | docker push $CI_REGISTRY/$CI_REGISTRY_IMAGE:$VER | ||
+ | </code><code> | ||
+ | gitlab-runner@gate:~/webd$ cat my-webd-deployment-env.yaml | ||
+ | </code><code> | ||
+ | ... | ||
+ | image: server.corp13.un:5000/student/webd:$VER | ||
+ | </code><code> | ||
+ | gitlab-runner@gate:~/webd$ cat deploy.sh | ||
+ | </code><code> | ||
+ | #!/bin/sh | ||
+ | |||
+ | export VER="$(echo $CI_COMMIT_MESSAGE | sed 's/[^a-zA-Z0-9\.]//g')" | ||
+ | |||
+ | #envsubst < my-webd-deployment-env.yaml | kubectl apply -f - | ||
+ | #kubectl apply -f my-webd-service.yaml,my-webd-ingress.yaml | ||
+ | |||
+ | #export HELM_NAMESPACE=my-ns | ||
+ | #helm test my-webd && helm upgrade my-webd webd-chart/ --set=image.tag=$VER || helm install my-webd webd-chart/ --set=image.tag=$VER | ||
+ | </code><code> | ||
+ | gitlab-runner@gate:~/webd$ cat .gitlab-ci.yml | ||
+ | stages: | ||
+ | - lintertest | ||
+ | - build | ||
+ | - deploy | ||
+ | |||
+ | lintertest1: | ||
+ | stage: lintertest | ||
+ | script: | ||
+ | - echo $(date) "Do a test here" >> /tmp/Bash.gitlab-ci.log | ||
+ | - shellcheck webd/webd | ||
+ | tags: | ||
+ | - shellcheck | ||
+ | |||
+ | build1: | ||
+ | stage: build | ||
+ | script: | ||
+ | - echo $(date) "Do a build here" >> /tmp/Bash.gitlab-ci.log | ||
+ | - ./build.sh | ||
+ | tags: | ||
+ | - webddeploy | ||
+ | |||
+ | deploy1: | ||
+ | stage: deploy | ||
+ | script: | ||
+ | - echo $(date) "Do your deploy k8s here" >> /tmp/Bash.gitlab-ci.log | ||
+ | - ./deploy.sh | ||
tags: | tags: | ||
- webddeploy | - webddeploy |