diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b120338 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ +# Выполнено ДЗ № + + - [ ] Основное ДЗ + - [ ] Задание со * + +## В процессе сделано: + - Пункт 1 + - Пункт 2 + +## Как запустить проект: + - Например, запустить команду X в директории Y + +## Как проверить работоспособность: + - Например, перейти по ссылке http://localhost:8080 + +## PR checklist + - [ ] Выставил label с номером домашнего задания + - [ ] Выставил label с темой домашнего задания diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 0000000..db7e7d9 --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1,6 @@ +# Set to true to add assignees to pull requests +addAssignees: true + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - mrgreyves \ No newline at end of file diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml new file mode 100644 index 0000000..d8d2296 --- /dev/null +++ b/.github/workflows/auto-assign.yml @@ -0,0 +1,8 @@ +name: 'Auto Assign' +on: pull_request + +jobs: + add-reviews: + runs-on: ubuntu-latest + steps: + - uses: kentaro-m/auto-assign-action@v1.1.2 \ No newline at end of file diff --git a/.github/workflows/run-tests-2022-02.yml b/.github/workflows/run-tests-2022-02.yml new file mode 100644 index 0000000..e264bf8 --- /dev/null +++ b/.github/workflows/run-tests-2022-02.yml @@ -0,0 +1,26 @@ +name: Run tests for OTUS homework + +on: + push: + branches-ignore: main + pull_request: + branches-ignore: main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout this repo + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + - name: Checkout repo with tests + uses: actions/checkout@v2 + with: + repository: "express42/otus-homeworks" + ref: 2022-02 + path: "./otus-homeworks/" + + - name: Run tests + run: curl https://raw.githubusercontent.com/express42/otus-homeworks/2022-02/run.sh | bash \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6c8a3a9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..815c08d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Otus-DevOps-2022-02 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/VPN/README.md b/VPN/README.md new file mode 100644 index 0000000..80e5aa5 --- /dev/null +++ b/VPN/README.md @@ -0,0 +1,92 @@ +# **HOME-WORK-03 - CLOUD-BASTION** + +- Создаем инстансы ВМ и производим настройки по инструкции. + +--- +- Получена следующая адресация виртуальных серверов YC: +``` +*BASTION* +EXT-IP: 51.250.64.135 +INT-IP: 10.128.0.13 +``` +``` +*SOMEINTERNALHOST* +EXT-IP: - +INT-IP: 10.128.0.17 +``` + +--- +# Спобосы подключения к SOMEINTERNALHOST в одну команду +- Первый способ подключения к SOMEINTERNALHOST в одну команду: +``` +ssh -A EXT-IP-BASTION -t ssh INT-IP-SOMEINTERNALHOST +``` +IP адресация указана выше. +В нашем случае (УЗ appuser) команда будет иметь вид: +``` +ssh -A appuser@EXT-IP-BASTION -t ssh INT-IP-SOMEINTERNALHOST +``` + +--- +- Второй способ подключения к SOMEINTERNALHOST в одну команду: +``` +ssh -J EXT-IP-BASTION INT-IP-SOMEINTERNALHOST +``` +IP адресация указана выше. +В нашем случае (УЗ appuser) команда будет иметь вид: +``` +ssh -J appuser@EXT-IP-BASTION appuser@INT-IP-SOMEINTERNALHOST +``` + +--- +- Дополнительное задание - создание ALIAS SOMEINTERNALHOST: + +ALIAS можно сделать на любой тип подключения, указанный выше. Например: +``` +alkolexx@ALKOLEXX-NOTE:~$ echo 'alias someinternalhost="ssh -A appuser@51.250.71.30 -t ssh 10.128.0.17"' >> /home/alkolexx/.bashrc +alkolexx@ALKOLEXX-NOTE:~$ source /home/alkolexx/.bashrc +``` +Теперь подключение к SOMEINTERNALHOST происходит следующим способом: +``` +alkolexx@ALKOLEXX-NOTE:~$ someinternalhost +``` + +--- +# VPN SERVER - PRITUNL +- Скрипт из инструкции оказался не рабочим на Xenial - отсутствуют пакеты для этой версии, выдавал ошибку. +- Обновил BASTION до версии 20.04. +- Скрипт установки VPN: +``` +#!/bin/bash + +# ADD REPO +sudo tee /etc/apt/sources.list.d/pritunl.list << EOF +deb http://repo.pritunl.com/stable/apt focal main +EOF + +sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list << EOF +deb https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse +EOF + +# ADD KEY +curl https://raw.githubusercontent.com/pritunl/pgp/master/pritunl_repo_pub.asc | sudo apt-key add - +curl https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - + +# UPDATE +sudo apt update + +# DISABLE FIREWALL +sudo ufw disable + +# INSTALL VPN +sudo apt -y install pritunl mongodb-org +sudo systemctl enable mongod pritunl +sudo systemctl start mongod pritunl +``` +- Устанавливаем VPN командой: `bash setupvpn.sh` +- Действуем далее по инструкции и проверяем коннект к SOMEINTERNALHOST. +- Данные для подключения (еще раз): +``` +bastion_IP = 51.250.64.135 +someinternalhost_IP = 10.128.0.17 +``` diff --git a/VPN/cloud-bastion.ovpn b/VPN/cloud-bastion.ovpn new file mode 100644 index 0000000..4a4760d --- /dev/null +++ b/VPN/cloud-bastion.ovpn @@ -0,0 +1,207 @@ +#{ +# "version": 1, +# "user": "test", +# "organization": "OTUS", +# "server": "OTUS", +# "wg": false, +# "user_id": "623c599656256102aa2de385", +# "organization_id": "623c599556256102aa2de380", +# "server_id": "623c5a3256256102aa2de440", +# "server_public_key": [ +# "-----BEGIN RSA PUBLIC KEY-----", +# "MIICCgKCAgEArt8GSuu/XtD0PSyAw8tNGK2YpFoPDEkaZgcPlDnXmeU9HfjodBan", +# "jTac8liOQIDs9IPZMQuZJVzLSw4FXfZQ4ImceiSYwnaOANB+PDqfTuXEBPbjV8RK", +# "hYbAnjp9dMPJDgYRmGLX0nh+w2xoGNTPwkbMDhEnGwpwxmVw7AHYP0rDxujh9Efp", +# "txd+mzvo6wezLB33LMNcrTwEh3BbJCARHPVjERe586Fkzebee6nJqpGTw4HZYHGH", +# "2t8iFQwzI857KR0B+ajgpCa+GA1HrS+x46s/+U7BwrScIJMZwVzLWDj0utmAc5Oy", +# "CuapKL8uG7RH4pKgIZxztEuUXfIFftDWXQYUfYcDvls3/Wn1sfGAnW0od0xQ1C6A", +# "QYn9cyB1CT7rOm/F9ZrmMpOAf/6z+uLDkOG2xVOOuU1qDhov52uSz67PCEjiJc/T", +# "UzWaCHMtJ2YsTnOVaKrgZmeTd1aa3xHG4JG66EqhmD3cMBOPAEzUcZEyENxLfIOf", +# "qJwhMWPBRWXxZsBTXgGAlmcoOZVW0oaGPH8kofm4uQSkbeNIU4mV88nANnIGREaf", +# "zby7coKtVoIG9qd/zjqGEuxWRoZd+MVqlp3YUS+V6+z073xDXE0gZUALnqPitcfR", +# "8uc64PWu4/XSXDlP2raF5zjtT1wM/vw5pwpac5Ug+skmnJdC7L+eonsCAwEAAQ==", +# "-----END RSA PUBLIC KEY-----" +# ], +# "server_box_public_key": "zaHrLdDa4N7XFhDj8SgX+ZtQAsTaCbrsEY19C5F4xiw=", +# "sync_hosts": [ +# "https://51.250.64.135" +# ], +# "sync_hash": "d04a5d999ecbeec4eec0422c38e31131", +# "password_mode": "pin", +# "push_auth": false, +# "push_auth_ttl": 172800, +# "disable_reconnect": false, +# "token_ttl": 172800, +# "token": false, +# "sync_token": "SmkKFoPGUsMPM6dwm4P9jct2pP0eyx4n", +# "sync_secret": "Coeo5a6REg1W2zM4kIiEDVVtcPzYYkEN" +#} +setenv UV_ID 567e8c1268794ba19cc58dd5b0b3d33b +setenv UV_NAME summer-waves-5514 +client +dev tun +dev-type tun +remote 51.250.64.135 10765 udp +nobind +persist-tun +cipher AES-128-CBC +auth SHA1 +verb 2 +mute 3 +push-peer-info +ping 10 +ping-restart 60 +hand-window 70 +server-poll-timeout 4 +reneg-sec 2592000 +sndbuf 393216 +rcvbuf 393216 +remote-cert-tls server +comp-lzo no +auth-user-pass +key-direction 1 + +-----BEGIN CERTIFICATE----- +MIIFcTCCA1mgAwIBAgIIdqF3aXMBfwUwDQYJKoZIhvcNAQELBQAwRjEhMB8GA1UE +CgwYNjIzYzU5OTU1NjI1NjEwMmFhMmRlMzgwMSEwHwYDVQQDDBg2MjNjNTk5NTU2 +MjU2MTAyYWEyZGUzODEwHhcNMjIwMzI0MTE0NDIyWhcNNDIwMzE5MTE0NDIyWjBG +MSEwHwYDVQQKDBg2MjNjNTk5NTU2MjU2MTAyYWEyZGUzODAxITAfBgNVBAMMGDYy +M2M1OTk1NTYyNTYxMDJhYTJkZTM4MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC +AgoCggIBAMnyhCRmTrYUGc6up9lndvKOfDezNR3U408eybkPfKw2DUB9uwpNDO3D +fgZHoqWWYh+ch7AsmfD07v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QQQaiaWE +OPahr015twq2YJqyy+26wY6rq8aUCufWvHVTV48TDepzlGPDCEhNtBZq8UklCEWl +IlbRTdzg00OlrU2kfS1zGQ2jGWGJDBongsy7zZdFMbYGNKBIOg8ATYE86gP15SnY +mzOWHcbqat0uqfmvtk92NDL7bwT+q9LGoa5pUph+fSP5moUG6frZc5yZ/+3jQHjo +dxVy3BLXAdNpOfxnW0RCHZN73nq/swizYDDS+8iZW+LmNF0XJmg8P6Tlxeawh5CY +YTNMk7gngZ17fUVmo53jk5mkqf7NLp7sAVhAfVpEuGRd0/aTc9w+adSLtWFQv2US +U1sZFB3bSslF0NSyB9bKbmRMgvBHnIR5TaO2b/ed0jGId/bjogqcouXCuAMDu3Wf +BxVHAeI= +-----END CERTIFICATE----- + + +# +# 2048 bit OpenVPN static key +# +-----BEGIN OpenVPN Static key V1----- +905fbf43cedea91a641ce88c61c10e67 +82d3df5ff3a7f52d64279c5de8811fe9 +13b5cacd46d08d4d1aee763fc39f7631 +de2c855f5155b791fc054c70ccfa7768 +2cf07f8827ab2667e0bc3adfacb95ac8 +3a8ab4de012d50c71572baa6aaf79109 +c9afc34e844e86d93f07638d1bd6df16 +f5f4b3d2a4319bd2d503da674639c47a +5256fb932cdd330a382f252fdb8802f7 +323f2016676ddcf9c49a77ea550bb60b +28dfec1fc4d790d833e89607ea881cd2 +895f25d60c7671df7852a1b9c47b5e79 +79d064ea5a34b04f43cb5d878ec38579 +2d7f2179111d5c182e3b23698c945f18 +9452eb0a99c9223b1cf7b63d1c672210 +db90732b302c20883d5caf77403b4f51 +-----END OpenVPN Static key V1----- + + +-----BEGIN CERTIFICATE----- +MIIFgDCCA2igAwIBAgIIDTNtEn4/DQwwDQYJKoZIhvcNAQELBQAwRjEhMB8GA1UE +CgwYNjIzYzU5OTU1NjI1NjEwMmFhMmRlMzgwMSEwHwYDVQQDDBg2MjNjNTk5NTU2 +MjU2MTAyYWEyZGUzODEwHhcNMjIwMzI0MTE0NDIzWhcNNDIwMzE5MT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paRmN0CggEATJM1u6xEFEuX6ek+s9Op +j7NUlgSILU9HbDGEUvkATmZ5JlVeK6aRnF1Ee3czJL9avFl/M1olg7SIwoMEMV7m +93mjMBj6DDUjaYnQf4EohCtrlBgMQhuMbfWbhXZ43+BZtAm9Ct3ZbGUqoHOEe5nb +oTrQ8RTWuroCK3dIEpU9aXJuvzMTG0oLu3ip7dhUhNmPNBuQId9R9l8AF/SHut0M +L+DxBOJhe0XXmUnHar2HrcoHpK7O3YuLJTSkt64vuOHyZPR3dVLfxxuethqruVhQ +oK6rzbOk/caeMMoODlVtrwCcClxYtgtrYheflu8NYRlkqj+uMhSfNVawaZAFMY+f +PQKCAQEA4ob0EGLYH0KVK1hdXUSAcrg/paPab1kgGPCmewb7n4rQv0csJz8DIhw1 +I9bIiBbdqQbQVBz4+V08fhs1K4YephCcvpR5T822g6CdVG2SZqefWpTMjute9Ain +J4QTUJ10bE3+AWqD/UGWSE7dr0wo/2fIgXL/iD9QjJy5XPRD1N8p4Vk1CriUTWYE +nuYzpaWuf0wkaxj8XIcu/F/slJn3oeRlAoY2y0ICPEmiE4Vug9aHdfsXYmzfqp/S +3e9cmaAsOX+i1q+w9DYzGdLQOKcb6kut8eLhXx8PyIMAJI/KvazjDnjr+z4SuRLv +0dschv56ivvhFGyMd+JOgeQPT0a09g== +-----END PRIVATE KEY----- + diff --git a/VPN/setupvpn.sh b/VPN/setupvpn.sh new file mode 100644 index 0000000..02453b8 --- /dev/null +++ b/VPN/setupvpn.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# ADD REPO +sudo tee /etc/apt/sources.list.d/pritunl.list << EOF +deb http://repo.pritunl.com/stable/apt focal main +EOF + +sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list << EOF +deb https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse +EOF + +# ADD KEY +curl https://raw.githubusercontent.com/pritunl/pgp/master/pritunl_repo_pub.asc | sudo apt-key add - +curl https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - + +# UPDATE +sudo apt update + +# DISABLE FIREWALL +sudo ufw disable + +# INSTALL VPN +sudo apt -y install pritunl mongodb-org +sudo systemctl enable mongod pritunl +sudo systemctl start mongod pritunl diff --git a/config-scripts/deploy.sh b/config-scripts/deploy.sh new file mode 100644 index 0000000..4690e7a --- /dev/null +++ b/config-scripts/deploy.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +sudo apt update +sudo apt install -y git +git clone -b monolith https://github.com/express42/reddit.git +cd reddit && bundle install +puma -d +ps aux | grep puma diff --git a/config-scripts/install_mongodb.sh b/config-scripts/install_mongodb.sh new file mode 100644 index 0000000..4afea4a --- /dev/null +++ b/config-scripts/install_mongodb.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - +echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list +sudo apt update +sudo apt install -y mongodb-org +sudo systemctl start mongod +sudo systemctl enable mongod +sudo systemctl status mongod diff --git a/config-scripts/install_ruby.sh b/config-scripts/install_ruby.sh new file mode 100644 index 0000000..635c609 --- /dev/null +++ b/config-scripts/install_ruby.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +sudo apt update +sudo apt install -y ruby-full ruby-bundler build-essential +ruby -v +bundler -v diff --git a/packer/key.json b/packer/key.json new file mode 100644 index 0000000..3847715 --- /dev/null +++ b/packer/key.json @@ -0,0 +1,8 @@ +{ + "id": "aje2vfoph3761dangvp0", + "service_account_id": "ajefjckprbtccr073no3", + "created_at": "2022-09-18T16:56:28.500265585Z", + "key_algorithm": "RSA_2048", + "public_key": "", + "private_key": "" +} \ No newline at end of file diff --git a/packer/scripts/install_mongodb.sh b/packer/scripts/install_mongodb.sh new file mode 100644 index 0000000..9e341cc --- /dev/null +++ b/packer/scripts/install_mongodb.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +apt-get install -y apt-transport-https ca-certificates +wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - +echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list +apt-get update +sudo rm /var/lib/apt/lists/lock +sudo rm /var/cache/apt/archives/lock +sudo rm /var/lib/dpkg/lock +sudo rm /var/lib/dpkg/lock-frontend +apt-get install -y mongodb-org +systemctl start mongod +systemctl enable mongod diff --git a/packer/scripts/install_ruby.sh b/packer/scripts/install_ruby.sh new file mode 100644 index 0000000..cca5dc5 --- /dev/null +++ b/packer/scripts/install_ruby.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +apt-get update +sudo rm /var/lib/apt/lists/lock +sudo rm /var/cache/apt/archives/lock +sudo rm /var/lib/dpkg/lock +sudo rm /var/lib/dpkg/lock-frontend +apt-get install -y ruby-full ruby-bundler build-essential diff --git a/packer/ubuntu16.json b/packer/ubuntu16.json new file mode 100644 index 0000000..0971c60 --- /dev/null +++ b/packer/ubuntu16.json @@ -0,0 +1,30 @@ +{ + "builders": [ + { + "type": "yandex", + "service_account_key_file": "{{ user `service_account_key_file` }}", + "folder_id": "{{ user `folder_id`}}", + "source_image_family": "{{ user `source_image_family` }}", + "image_name": "reddit-base-{{timestamp}}", + "image_family": "reddit-base", + "ssh_username": "{{ user `ssh_username` }}", + "platform_id": "{{ user `platform_id` }}", + "use_ipv4_nat": "true", + "disk_size_gb": "{{ user `disk_size_gb` }}", + "instance_cores": "{{ user `instance_cores` }}", + "instance_mem_gb": "{{ user `instance_mem_gb` }}" + } + ], + "provisioners": [ + { + "type": "shell", + "script": "scripts/install_ruby.sh", + "execute_command": "sudo {{.Path}}" + }, + { + "type": "shell", + "script": "scripts/install_mongodb.sh", + "execute_command": "sudo {{.Path}}" + } + ] +} diff --git a/packer/variables.json.example b/packer/variables.json.example new file mode 100644 index 0000000..699f2aa --- /dev/null +++ b/packer/variables.json.example @@ -0,0 +1,10 @@ + { + "service_account_key_file": "key.json", + "folder_id": "dfgqs784jdhfop29k97dt", + "source_image_family": "ubuntu-1604-lts", + "platform_id": "standard-v1", + "ssh_username": "ubuntu", + "disk_size_gb": "11", + "instance_cores": "2", + "instance_mem_gb": "2" + } diff --git a/play-travis/test.py b/play-travis/test.py new file mode 100644 index 0000000..8381bad --- /dev/null +++ b/play-travis/test.py @@ -0,0 +1,9 @@ +import unittest + +class NumbersTest(unittest.TestCase): + + def test_equal(self): + self.assertEqual(1 + 1, 2) + +if __name__ == '__main__': + unittest.main()