This is an old revision of the document!
# ansible-playbook conf/ansible/roles/mail.yml # cat /etc/apache2/ports.conf ... 81 ... # service apache2 restart # apt-get install -y curl ca-certificates perl # curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash # time EXTERNAL_URL="http://server.corpX.un" apt-get install gitlab-ce ... real 15m49.787s ..
# cat /etc/gitlab/initial_root_password
root@node2:~# curl --header "PRIVATE-TOKEN: NNNNNNNNNNNNNNNNNNNNN" "http://server.corp13.un/api/v4/projects/4/repository/files/docker-compose.yml/raw?ref=master" | tee docker-compose.yml
# cat /etc/gitlab/gitlab.rb
# gitlab-ctl reconfigure
# 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" ...
# cat /etc/gitlab/gitlab.rb
... grafana['http_addr'] = '0.0.0.0' ...
# 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' ...
# wget http://gate.isp.un/unix/Git/gitlab-runner_amd64.deb # dpkg -i gitlab-runner_amd64.deb # gitlab-runner register ... Enter the GitLab instance URL: http://server.corpX.un Enter the registration token: ... ... Enter tags for the runner: dhcptest, dhcpdeploy или Enter tags for the runner: openvpn1deploy ... Enter an executor: shell ... # cat /etc/gitlab-runner/config.toml log_level = "debug" ...
root@node2:~# systemctl restart gitlab-runner
IDE GitLab->New File: .gitlab-ci.yml или CI/CD -> Editor -> Configure Pipelines
test1-job: stage: test script: - echo $(date) "Do test dhcpd" >> /tmp/Bash.gitlab-ci.log - make test tags: - dhcptest deploy1-job: stage: deploy script: - echo $(date) "Do deploy dhcpd" >> /tmp/Bash.gitlab-ci.log - sudo make install tags: - dhcpdeploy
Administrator@Ra-master ~/openvpn1 (test) λ npp .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 only: - 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 only: # - master # - main
vagrant@node1:~/project1$ cat .gitlab-ci.yml
test1-job: stage: test script: - echo $(date) "Do a test here" >> /tmp/Bash.gitlab-ci.log - shellcheck webd/webd tags: - shellcheck deploy1-job: stage: deploy script: - echo $(date) "Do your deploy here" >> /tmp/Bash.gitlab-ci.log - docker-compose up -d tags: - webddeploy
CI_REGISTRY: server.corp13.un:5000 CI_REGISTRY_IMAGE: student/webd CI_REGISTRY_USER: student CI_REGISTRY_PASSWORD: password
gitlab-runner@gate:~/webd$ cat build.sh
#!/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
gitlab-runner@gate:~/webd$ cat my-webd-deployment-env.yaml
... image: server.corp13.un:5000/student/webd:$VER
gitlab-runner@gate:~/webd$ cat deploy.sh
#!/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
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 - sh build.sh tags: - webdbuild #deploy1: # stage: deploy # script: # - echo $(date) "Do your deploy k8s here" >> /tmp/Bash.gitlab-ci.log # - sh deploy.sh # tags: # - webddeploy
Admin Area-> Applications-> val-auth-test Callback URL: https://val.bmstu.ru/auth-test Trusted: Yes