From 8e702cf3c909103705f8d09e7297ae334ddf46a5 Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:43:38 +0300 Subject: [PATCH 01/13] Add files via upload From 4d997f0f84286f227ce2025d15af09863896fbbb Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:46:33 +0300 Subject: [PATCH 02/13] Add files via upload From 866e3ed526bf3e4c55c89788d4f471e3edf93f09 Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Fri, 25 Nov 2022 17:43:04 +0300 Subject: [PATCH 03/13] Update README.md changed link to repo in freestyle job --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bac776..b91842d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ pipeline { agent any stages { stage('Git') { - steps {git 'https://github.com/kozl/netology-devops.git'} + steps {git 'https://github.com/netology-code/sdvps-materials.git'} } stage('Test') { steps { From 06eb7ab2bd913dbc1a91ff69273f0fbb0ca8054e Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Sun, 27 Nov 2022 16:57:20 +0300 Subject: [PATCH 04/13] Add files via upload added gitlab notes --- GITLAB.md | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 GITLAB.md diff --git a/GITLAB.md b/GITLAB.md new file mode 100644 index 0000000..9df3750 --- /dev/null +++ b/GITLAB.md @@ -0,0 +1,163 @@ +# Gitlab + +## Развернуть инсталляцию + +1. Добавить запись в локальный /etc/hosts: + +```bash +echo '192.168.56.10 gitlab.localdomain gitlab' >> /etc/hosts +``` + +2. Запустить инсталляцию: + +```bash +VAGRANT_EXPERIMENTAL="disks" vagrant up +``` +Переменная окружения VAGRANT_EXPERIMENTAL нужна для того, чтобы vagrant настроил виртуалку с нестандартным размером диска. + +После успешного завершения Gitlab будет доступен по адресу http://gitlab.localdomain + +Получить первичный пароль для пользователя root: + +```bash +vagrant ssh -- sudo cat /etc/gitlab/initial_root_password +``` + +### Возможные проблемы + +1. В Vagrantfile определено, что виртуальная машина, которая будет поднята — получит адрес 192.168.56.10. Возможна ситуация, когда сетевой интерфейс virtualbox, vboxnet0, использует другую подсеть: + +```bash +$ ip -br -c a sh vboxnet2 +vboxnet2 UP 192.168.100.1/24 fe80::800:27ff:fe00:2/64 +``` + +В этом случае нужно исправить адрес на тот, что будет соответствовать сети интерфейса и добавить запись для него в /etc/hosts + +2. Недостаточно ресурсов. Для разворачивания инсталляции потребуется как минимум 6GB памяти, следует учитывать это при запуске. Если ресурсов недостаточно — можно попробовать подправить Vagrantfile, но работоспособность инсталляции при этом не гарантируется. + +## Gitlab runner + +Регистрация раннера: +```bash + docker run -ti --rm --name gitlab-runner \ + --network host \ + -v /srv/gitlab-runner/config:/etc/gitlab-runner \ + -v /var/run/docker.sock:/var/run/docker.sock \ + gitlab/gitlab-runner:latest register +``` + +Конфигурация раннера для docker-in-docker: +```yaml + volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"] + extra_hosts = ["gitlab.localdomain:192.168.56.10"] +``` + +Запуск: +```bash + docker run -d --name gitlab-runner --restart always \ + --network host \ + -v /srv/gitlab-runner/config:/etc/gitlab-runner \ + -v /var/run/docker.sock:/var/run/docker.sock \ + gitlab/gitlab-runner:latest +``` + +## Pipeline + +```yaml +stages: + - test + - build + +test: + stage: test + image: golang:1.17 + script: + - go test . + +build: + stage: build + image: docker:latest + script: + - docker build . +``` + +## Sonarqube + +```bash +vagrant ssh +cd /vagrant +docker-compose up -d +``` + +Sonarqube будет доступен по адресу http://gitlab.localdomain:9000 + +## Pipeline with sonarqube-check + +```yaml +stages: + - test + - static-analysis + - build + +test: + stage: test + image: golang:1.16 + script: + - go test . + +static-analysis: + stage: test + image: + name: sonarsource/sonar-scanner-cli + entrypoint: [""] + variables: + script: + - sonar-scanner -Dsonar.projectKey=netology-gitlab -Dsonar.sources=. -Dsonar.host.url=http://gitlab.localdomain:9000 -Dsonar.login=a778675a32f0d9d6455a3d502f4e2838e784994d + +build: + stage: build + image: docker:latest + script: + - docker build . +``` + +## Pipeline with manual run + +```yaml +stages: + - test + - build + +test: + stage: test + image: golang:1.16 + script: + - go test . + +sonarqube-check: + stage: test + image: + name: sonarsource/sonar-scanner-cli + entrypoint: [""] + variables: + script: + - sonar-scanner -Dsonar.projectKey=netology-gitlab -Dsonar.sources=. -Dsonar.host.url=http://gitlab.localdomain:9000 -Dsonar.login=a778675a32f0d9d6455a3d502f4e2838e784994d + +build: + stage: build + image: docker:latest + only: + - master + script: + - docker build . + +build: + stage: build + image: docker:latest + when: manual + except: + - master + script: + - docker build . +``` \ No newline at end of file From d6c2b9517a92c992df95bd5950bdbca93e9046e2 Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Sun, 27 Nov 2022 17:03:33 +0300 Subject: [PATCH 05/13] Add files via upload added compose for sonarqube --- docker-compose.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..d3b327a --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,32 @@ +version: "3" + +services: + sonarqube: + image: sonarqube:community + depends_on: + - db + environment: + SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar + SONAR_JDBC_USERNAME: sonar + SONAR_JDBC_PASSWORD: sonar + volumes: + - sonarqube_data:/opt/sonarqube/data + - sonarqube_extensions:/opt/sonarqube/extensions + - sonarqube_logs:/opt/sonarqube/logs + ports: + - "9000:9000" + db: + image: postgres:12 + environment: + POSTGRES_USER: sonar + POSTGRES_PASSWORD: sonar + volumes: + - postgresql:/var/lib/postgresql + - postgresql_data:/var/lib/postgresql/data + +volumes: + sonarqube_data: + sonarqube_extensions: + sonarqube_logs: + postgresql: + postgresql_data: \ No newline at end of file From de8a2b6346964661420ee8a25778bee90814df22 Mon Sep 17 00:00:00 2001 From: Dmitrii_Tomin Date: Sun, 27 Nov 2022 17:19:58 +0300 Subject: [PATCH 06/13] add dir gitlab --- gitlab/GITLAB.md | 163 +++++++++++++++++++++++++++++++++++++ gitlab/Vagrantfile | 90 ++++++++++++++++++++ gitlab/docker-compose.yaml | 32 ++++++++ 3 files changed, 285 insertions(+) create mode 100644 gitlab/GITLAB.md create mode 100644 gitlab/Vagrantfile create mode 100644 gitlab/docker-compose.yaml diff --git a/gitlab/GITLAB.md b/gitlab/GITLAB.md new file mode 100644 index 0000000..9df3750 --- /dev/null +++ b/gitlab/GITLAB.md @@ -0,0 +1,163 @@ +# Gitlab + +## Развернуть инсталляцию + +1. Добавить запись в локальный /etc/hosts: + +```bash +echo '192.168.56.10 gitlab.localdomain gitlab' >> /etc/hosts +``` + +2. Запустить инсталляцию: + +```bash +VAGRANT_EXPERIMENTAL="disks" vagrant up +``` +Переменная окружения VAGRANT_EXPERIMENTAL нужна для того, чтобы vagrant настроил виртуалку с нестандартным размером диска. + +После успешного завершения Gitlab будет доступен по адресу http://gitlab.localdomain + +Получить первичный пароль для пользователя root: + +```bash +vagrant ssh -- sudo cat /etc/gitlab/initial_root_password +``` + +### Возможные проблемы + +1. В Vagrantfile определено, что виртуальная машина, которая будет поднята — получит адрес 192.168.56.10. Возможна ситуация, когда сетевой интерфейс virtualbox, vboxnet0, использует другую подсеть: + +```bash +$ ip -br -c a sh vboxnet2 +vboxnet2 UP 192.168.100.1/24 fe80::800:27ff:fe00:2/64 +``` + +В этом случае нужно исправить адрес на тот, что будет соответствовать сети интерфейса и добавить запись для него в /etc/hosts + +2. Недостаточно ресурсов. Для разворачивания инсталляции потребуется как минимум 6GB памяти, следует учитывать это при запуске. Если ресурсов недостаточно — можно попробовать подправить Vagrantfile, но работоспособность инсталляции при этом не гарантируется. + +## Gitlab runner + +Регистрация раннера: +```bash + docker run -ti --rm --name gitlab-runner \ + --network host \ + -v /srv/gitlab-runner/config:/etc/gitlab-runner \ + -v /var/run/docker.sock:/var/run/docker.sock \ + gitlab/gitlab-runner:latest register +``` + +Конфигурация раннера для docker-in-docker: +```yaml + volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"] + extra_hosts = ["gitlab.localdomain:192.168.56.10"] +``` + +Запуск: +```bash + docker run -d --name gitlab-runner --restart always \ + --network host \ + -v /srv/gitlab-runner/config:/etc/gitlab-runner \ + -v /var/run/docker.sock:/var/run/docker.sock \ + gitlab/gitlab-runner:latest +``` + +## Pipeline + +```yaml +stages: + - test + - build + +test: + stage: test + image: golang:1.17 + script: + - go test . + +build: + stage: build + image: docker:latest + script: + - docker build . +``` + +## Sonarqube + +```bash +vagrant ssh +cd /vagrant +docker-compose up -d +``` + +Sonarqube будет доступен по адресу http://gitlab.localdomain:9000 + +## Pipeline with sonarqube-check + +```yaml +stages: + - test + - static-analysis + - build + +test: + stage: test + image: golang:1.16 + script: + - go test . + +static-analysis: + stage: test + image: + name: sonarsource/sonar-scanner-cli + entrypoint: [""] + variables: + script: + - sonar-scanner -Dsonar.projectKey=netology-gitlab -Dsonar.sources=. -Dsonar.host.url=http://gitlab.localdomain:9000 -Dsonar.login=a778675a32f0d9d6455a3d502f4e2838e784994d + +build: + stage: build + image: docker:latest + script: + - docker build . +``` + +## Pipeline with manual run + +```yaml +stages: + - test + - build + +test: + stage: test + image: golang:1.16 + script: + - go test . + +sonarqube-check: + stage: test + image: + name: sonarsource/sonar-scanner-cli + entrypoint: [""] + variables: + script: + - sonar-scanner -Dsonar.projectKey=netology-gitlab -Dsonar.sources=. -Dsonar.host.url=http://gitlab.localdomain:9000 -Dsonar.login=a778675a32f0d9d6455a3d502f4e2838e784994d + +build: + stage: build + image: docker:latest + only: + - master + script: + - docker build . + +build: + stage: build + image: docker:latest + when: manual + except: + - master + script: + - docker build . +``` \ No newline at end of file diff --git a/gitlab/Vagrantfile b/gitlab/Vagrantfile new file mode 100644 index 0000000..cdb30ad --- /dev/null +++ b/gitlab/Vagrantfile @@ -0,0 +1,90 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.box = "ubuntu/bionic64" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + config.vm.network "private_network", ip: "192.168.56.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + config.vm.disk :disk, size: "15GB", primary: true + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + vb.memory = "6144" + end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + config.vm.provision "shell", inline: <<-SHELL + export DEBIAN_FRONTEND=noninteractive + apt-get update + # install docker & docker-compose + apt-get install -y docker.io docker-compose + # install gitlab: https://about.gitlab.com/install/#ubuntu + apt-get install -y curl openssh-server ca-certificates tzdata perl + curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash + sudo EXTERNAL_URL="http://gitlab.localdomain" apt-get install gitlab-ee + # pull some images in advance + docker pull gitlab/gitlab-runner:latest + docker pull sonarsource/sonar-scanner-cli:latest + docker pull golang:1.17 + docker pull docker:latest + # set sysctl for sonarqube + sysctl vm.max_map_count=262144 + # run sonarqube + # cd /vagrant && docker-compose up -d + # add some records to /etc/hosts + echo -e "192.168.56.10\tubuntu-bionic\tubuntu-bionic" >> /etc/hosts + echo -e "192.168.56.10\tgitlab.localdomain\tgitlab" >> /etc/hosts + SHELL +end diff --git a/gitlab/docker-compose.yaml b/gitlab/docker-compose.yaml new file mode 100644 index 0000000..d3b327a --- /dev/null +++ b/gitlab/docker-compose.yaml @@ -0,0 +1,32 @@ +version: "3" + +services: + sonarqube: + image: sonarqube:community + depends_on: + - db + environment: + SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar + SONAR_JDBC_USERNAME: sonar + SONAR_JDBC_PASSWORD: sonar + volumes: + - sonarqube_data:/opt/sonarqube/data + - sonarqube_extensions:/opt/sonarqube/extensions + - sonarqube_logs:/opt/sonarqube/logs + ports: + - "9000:9000" + db: + image: postgres:12 + environment: + POSTGRES_USER: sonar + POSTGRES_PASSWORD: sonar + volumes: + - postgresql:/var/lib/postgresql + - postgresql_data:/var/lib/postgresql/data + +volumes: + sonarqube_data: + sonarqube_extensions: + sonarqube_logs: + postgresql: + postgresql_data: \ No newline at end of file From dd2f31e815aaf4c8abf85655568fd418a3af0ee8 Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Sun, 27 Nov 2022 17:22:13 +0300 Subject: [PATCH 07/13] Delete GITLAB.md --- GITLAB.md | 163 ------------------------------------------------------ 1 file changed, 163 deletions(-) delete mode 100644 GITLAB.md diff --git a/GITLAB.md b/GITLAB.md deleted file mode 100644 index 9df3750..0000000 --- a/GITLAB.md +++ /dev/null @@ -1,163 +0,0 @@ -# Gitlab - -## Развернуть инсталляцию - -1. Добавить запись в локальный /etc/hosts: - -```bash -echo '192.168.56.10 gitlab.localdomain gitlab' >> /etc/hosts -``` - -2. Запустить инсталляцию: - -```bash -VAGRANT_EXPERIMENTAL="disks" vagrant up -``` -Переменная окружения VAGRANT_EXPERIMENTAL нужна для того, чтобы vagrant настроил виртуалку с нестандартным размером диска. - -После успешного завершения Gitlab будет доступен по адресу http://gitlab.localdomain - -Получить первичный пароль для пользователя root: - -```bash -vagrant ssh -- sudo cat /etc/gitlab/initial_root_password -``` - -### Возможные проблемы - -1. В Vagrantfile определено, что виртуальная машина, которая будет поднята — получит адрес 192.168.56.10. Возможна ситуация, когда сетевой интерфейс virtualbox, vboxnet0, использует другую подсеть: - -```bash -$ ip -br -c a sh vboxnet2 -vboxnet2 UP 192.168.100.1/24 fe80::800:27ff:fe00:2/64 -``` - -В этом случае нужно исправить адрес на тот, что будет соответствовать сети интерфейса и добавить запись для него в /etc/hosts - -2. Недостаточно ресурсов. Для разворачивания инсталляции потребуется как минимум 6GB памяти, следует учитывать это при запуске. Если ресурсов недостаточно — можно попробовать подправить Vagrantfile, но работоспособность инсталляции при этом не гарантируется. - -## Gitlab runner - -Регистрация раннера: -```bash - docker run -ti --rm --name gitlab-runner \ - --network host \ - -v /srv/gitlab-runner/config:/etc/gitlab-runner \ - -v /var/run/docker.sock:/var/run/docker.sock \ - gitlab/gitlab-runner:latest register -``` - -Конфигурация раннера для docker-in-docker: -```yaml - volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"] - extra_hosts = ["gitlab.localdomain:192.168.56.10"] -``` - -Запуск: -```bash - docker run -d --name gitlab-runner --restart always \ - --network host \ - -v /srv/gitlab-runner/config:/etc/gitlab-runner \ - -v /var/run/docker.sock:/var/run/docker.sock \ - gitlab/gitlab-runner:latest -``` - -## Pipeline - -```yaml -stages: - - test - - build - -test: - stage: test - image: golang:1.17 - script: - - go test . - -build: - stage: build - image: docker:latest - script: - - docker build . -``` - -## Sonarqube - -```bash -vagrant ssh -cd /vagrant -docker-compose up -d -``` - -Sonarqube будет доступен по адресу http://gitlab.localdomain:9000 - -## Pipeline with sonarqube-check - -```yaml -stages: - - test - - static-analysis - - build - -test: - stage: test - image: golang:1.16 - script: - - go test . - -static-analysis: - stage: test - image: - name: sonarsource/sonar-scanner-cli - entrypoint: [""] - variables: - script: - - sonar-scanner -Dsonar.projectKey=netology-gitlab -Dsonar.sources=. -Dsonar.host.url=http://gitlab.localdomain:9000 -Dsonar.login=a778675a32f0d9d6455a3d502f4e2838e784994d - -build: - stage: build - image: docker:latest - script: - - docker build . -``` - -## Pipeline with manual run - -```yaml -stages: - - test - - build - -test: - stage: test - image: golang:1.16 - script: - - go test . - -sonarqube-check: - stage: test - image: - name: sonarsource/sonar-scanner-cli - entrypoint: [""] - variables: - script: - - sonar-scanner -Dsonar.projectKey=netology-gitlab -Dsonar.sources=. -Dsonar.host.url=http://gitlab.localdomain:9000 -Dsonar.login=a778675a32f0d9d6455a3d502f4e2838e784994d - -build: - stage: build - image: docker:latest - only: - - master - script: - - docker build . - -build: - stage: build - image: docker:latest - when: manual - except: - - master - script: - - docker build . -``` \ No newline at end of file From c158c1fe22de7e30df894a081a0b9ea4fbae1248 Mon Sep 17 00:00:00 2001 From: dmitriy-tomin <76448001+dmitriy-tomin@users.noreply.github.com> Date: Sun, 27 Nov 2022 17:22:55 +0300 Subject: [PATCH 08/13] Delete docker-compose.yaml --- docker-compose.yaml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index d3b327a..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,32 +0,0 @@ -version: "3" - -services: - sonarqube: - image: sonarqube:community - depends_on: - - db - environment: - SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar - SONAR_JDBC_USERNAME: sonar - SONAR_JDBC_PASSWORD: sonar - volumes: - - sonarqube_data:/opt/sonarqube/data - - sonarqube_extensions:/opt/sonarqube/extensions - - sonarqube_logs:/opt/sonarqube/logs - ports: - - "9000:9000" - db: - image: postgres:12 - environment: - POSTGRES_USER: sonar - POSTGRES_PASSWORD: sonar - volumes: - - postgresql:/var/lib/postgresql - - postgresql_data:/var/lib/postgresql/data - -volumes: - sonarqube_data: - sonarqube_extensions: - sonarqube_logs: - postgresql: - postgresql_data: \ No newline at end of file From 20c72e26521c5bf613764107ec81c87ad2574692 Mon Sep 17 00:00:00 2001 From: ElenaPalagina <77622076+ElenaPalagina@users.noreply.github.com> Date: Mon, 28 Nov 2022 16:55:03 +0300 Subject: [PATCH 09/13] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b91842d..4ed15a3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Подсказки для выполнения ДЗ -# Nexus, запуск образа в виртуальной машине Vagrant + +## Nexus, запуск образа в виртуальной машине Vagrant Запуск: ```bash @@ -11,7 +12,7 @@ docker run -d -p 192.168.56.10:8081:8081 -p 192.168.56.10:8082:8082 --name nexus docker exec -t nexus bash -c 'cat /nexus-data/admin.password && echo' ``` -# Jenkins +## Jenkins Jenkins url: http://192.168.56.10:8080/ (ссылка при установке Jenkins в ВМ Vagrant) Repo для проекта в Jenkins: https://github.com/netology-code/sdvps-materials.git From 157622fd692ec114b6f87639670631c710b481dd Mon Sep 17 00:00:00 2001 From: ElenaPalagina <77622076+ElenaPalagina@users.noreply.github.com> Date: Mon, 28 Nov 2022 17:00:34 +0300 Subject: [PATCH 10/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ed15a3..f8dd219 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Подсказки для выполнения ДЗ +# Дополнительные материалы для выполнения домашних заданий из блока "Введение в DevOps" ## Nexus, запуск образа в виртуальной машине Vagrant From 21e81669d73b6ab7d7b956d695e0367799e61f61 Mon Sep 17 00:00:00 2001 From: ElenaPalagina <77622076+ElenaPalagina@users.noreply.github.com> Date: Wed, 30 Nov 2022 12:36:24 +0300 Subject: [PATCH 11/13] Create 8.2-hw.md --- CICD/8.2-hw.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 CICD/8.2-hw.md diff --git a/CICD/8.2-hw.md b/CICD/8.2-hw.md new file mode 100644 index 0000000..88159b3 --- /dev/null +++ b/CICD/8.2-hw.md @@ -0,0 +1,61 @@ +# Дополнительные материалы для выполнения домашнего задания "8.2. Что такое DevOps. СI/СD" + +### Nexus, запуск образа в виртуальной машине Vagrant + +Запуск: +```bash +docker run -d -p 192.168.56.10:8081:8081 -p 192.168.56.10:8082:8082 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms512m -Xmx512m -XX:MaxDirectMemorySize=273m" sonatype/nexus3 +``` + +Вывести пароль администратора для первого логина в Nexus: +``` +docker exec -t nexus bash -c 'cat /nexus-data/admin.password && echo' +``` + +### Jenkins + +Jenkins url: http://192.168.56.10:8080/ (ссылка при установке Jenkins в ВМ Vagrant) +Repo для проекта в Jenkins: https://github.com/netology-code/sdvps-materials.git + +### Install go (для установки руками) + +https://go.dev/doc/install + +``` +wget https://go.dev/dl/go1.17.5.linux-amd64.tar.gz +rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz +echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile +``` + +### Freestyle job + +1. `/usr/local/go/bin/go test .` +2. `docker build . -t ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER` +3. `docker login ubuntu-bionic:8082 -u admin -p admin && docker push ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER && docker logout` + +### Pipeline + +``` +pipeline { + agent any + stages { + stage('Git') { + steps {git 'https://github.com/netology-code/sdvps-materials.git'} + } + stage('Test') { + steps { + sh 'go test .' + } + } + stage('Build') { + steps { + sh 'docker build . -t ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER' + } + } + stage('Push') { + steps { + sh 'docker login ubuntu-bionic:8082 -u admin -p admin && docker push ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER && docker logout' } + } + } +} +``` From 8fec98d735625f221d04b9a913f89a07e7838d18 Mon Sep 17 00:00:00 2001 From: ElenaPalagina <77622076+ElenaPalagina@users.noreply.github.com> Date: Wed, 30 Nov 2022 12:44:22 +0300 Subject: [PATCH 12/13] Update README.md --- README.md | 60 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index f8dd219..2e31945 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,5 @@ # Дополнительные материалы для выполнения домашних заданий из блока "Введение в DevOps" -## Nexus, запуск образа в виртуальной машине Vagrant +- [Дополнительный материал для занятия "8.2. Что такое DevOps. СI/СD"](CICD/8.2-hw.md) -Запуск: -```bash -docker run -d -p 192.168.56.10:8081:8081 -p 192.168.56.10:8082:8082 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms512m -Xmx512m -XX:MaxDirectMemorySize=273m" sonatype/nexus3 -``` - -Вывести пароль администратора для первого логина в Nexus: -``` -docker exec -t nexus bash -c 'cat /nexus-data/admin.password && echo' -``` - -## Jenkins - -Jenkins url: http://192.168.56.10:8080/ (ссылка при установке Jenkins в ВМ Vagrant) -Repo для проекта в Jenkins: https://github.com/netology-code/sdvps-materials.git - -## Install go (для установки руками) - -https://go.dev/doc/install - -``` -wget https://go.dev/dl/go1.17.5.linux-amd64.tar.gz -rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz -echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile -``` - -## Freestyle job - -1. `/usr/local/go/bin/go test .` -2. `docker build . -t ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER` -3. `docker login ubuntu-bionic:8082 -u admin -p admin && docker push ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER && docker logout` - -## Pipeline - -``` -pipeline { - agent any - stages { - stage('Git') { - steps {git 'https://github.com/netology-code/sdvps-materials.git'} - } - stage('Test') { - steps { - sh 'go test .' - } - } - stage('Build') { - steps { - sh 'docker build . -t ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER' - } - } - stage('Push') { - steps { - sh 'docker login ubuntu-bionic:8082 -u admin -p admin && docker push ubuntu-bionic:8082/hello-world:v$BUILD_NUMBER && docker logout' } - } - } -} -``` +- [Дополнительный материал для занятия "8.3. GitLab"](https://github.com/netology-code/sdvps-materials/tree/main/gitlab) From 223dbc3f489784448004e020f2ef224f17a7b06d Mon Sep 17 00:00:00 2001 From: ElenaPalagina <77622076+ElenaPalagina@users.noreply.github.com> Date: Wed, 30 Nov 2022 12:44:45 +0300 Subject: [PATCH 13/13] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e31945..a0f9312 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Дополнительные материалы для выполнения домашних заданий из блока "Введение в DevOps" +## Дополнительные материалы для выполнения домашних заданий из блока "Введение в DevOps" + - [Дополнительный материал для занятия "8.2. Что такое DevOps. СI/СD"](CICD/8.2-hw.md)