Skip to content
Open

1 #3

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ FROM python:3.12-slim

# Ваш код здесь #

WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY main.py ./
# Запускаем приложение с помощью uvicorn, делая его доступным по сети
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]
37 changes: 37 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3.7'
include:
- proxy.yaml

volumes:
db_mysql:

services:

db:
image: mysql:8
restart: on-failure
env_file:
- .env
volumes:
- /var/lib/docker/volumes/db_mysql/_data:/var/lib/mysql
ports:
- 3306:3306
networks:
backend:
ipv4_address: 172.20.0.10

web:
build:
dockerfile: Dockerfile
restart: on-failure
environment:
- MYSQL_ROOT_PASSWORD: YtReWq4321
- MYSQL_DATABASE: virtd
- MYSQL_USER: app
- MYSQL_PASSWORD: QwErTy1234"

depends_on:
- db
networks:
backend:
ipv4_address: 172.20.0.5
9 changes: 9 additions & 0 deletions lighthouse-role-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Роли

| Name | Default Value | Description |
|----------------------------|-----------------------------------------|-----------------|
| lighthouse_vcs | https://github.com/VKCOM/lighthouse.git | Ресурс для скачивания |
| lighthouse_location_dir | /var/www/lighthouse | Инсталяция патча |
| lighthouse_access_log_name | lighthouse | Наименование в логах |
| nginx_user_name | nginx | Имя Nginx |

2 changes: 2 additions & 0 deletions lighthouse-role-main/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for lighthouse-role
7 changes: 7 additions & 0 deletions lighthouse-role-main/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: restart-nginx
ansible.builtin.service:
name: nginx
state: restarted
become: true
become_method: sudo
52 changes: 52 additions & 0 deletions lighthouse-role-main/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)

min_ansible_version: 2.1

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
23 changes: 23 additions & 0 deletions lighthouse-role-main/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Create Lighthouse directory
become: true
ansible.builtin.file:
path: /var/www/lighthouse
state: directory
recurse: yes
mode: '0755'
owner: nginx
group: nginx
- name: Lighthouse | Clone from Git
become: true
ansible.builtin.git:
repo: "{{ lighthouse_vcs }}"
version: master
dest: "{{ lighthouse_location_dir }}"
- name: Lighthouse | Create lighthouse config
become: true
ansible.builtin.template:
src: templates/lighthouse.conf.j2
dest: /etc/nginx/conf.d/default.conf
mode: '0644'
notify: restart-nginx
11 changes: 11 additions & 0 deletions lighthouse-role-main/templates/lighthouse.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
server {
listen 80;
server_name localhost;

access_log /var/log/nginx/{{ lighthouse_access_log_name }}.log main;

location / {
root {{ lighthouse_location_dir }};
index index.html;
}
}
2 changes: 2 additions & 0 deletions lighthouse-role-main/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions lighthouse-role-main/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- lighthouse-role
5 changes: 5 additions & 0 deletions lighthouse-role-main/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
lighthouse_vcs: "https://github.com/VKCOM/lighthouse.git"
lighthouse_location_dir: /var/www/lighthouse
lighthouse_access_log_name: lighthouse
nginx_user_name: nginx
12 changes: 12 additions & 0 deletions scr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Local .terraform directories and files
**/.terraform/*
.terraform*

!.terraformrc

# .tfstate files
*.tfstate
*.tfstate.*

# own secret vars store.
personal.auto.tfvars
9 changes: 9 additions & 0 deletions scr/.terraformrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
provider_installation {
network_mirror {
url = "https://terraform-mirror.yandexcloud.net/"
include = ["registry.terraform.io/*/*"]
}
direct {
exclude = ["registry.terraform.io/*/*"]
}
}
31 changes: 31 additions & 0 deletions scr/console.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
##Этот файл для 7 задания!!
locals {

test_list = ["develop", "staging", "production"]

test_map = {
admin = "John"
user = "Alex"
}

servers = {
develop = {
cpu = 2
ram = 4
image = "ubuntu-21-10"
disks = ["vda", "vdb"]
},
stage = {
cpu = 4
ram = 8
image = "ubuntu-20-04"
disks = ["vda", "vdb"]
},
production = {
cpu = 10
ram = 40
image = "ubuntu-20-04"
disks = ["vda", "vdb", "vdc", "vdd"]
}
}
}
1 change: 1 addition & 0 deletions scr/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

41 changes: 41 additions & 0 deletions scr/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
resource "yandex_vpc_network" "develop" {
name = var.vpc_name
}
resource "yandex_vpc_subnet" "develop" {
name = var.vpc_name
zone = var.default_zone
network_id = yandex_vpc_network.develop.id
v4_cidr_blocks = var.default_cidr
}


data "yandex_compute_image" "ubuntu" {
family = "ubuntu-2004-lts"
}
resource "yandex_compute_instance" "platform" {
name = "netology-develop-platform-web"
platform_id = "standart-v4"
resources {
cores = 1
memory = 1
core_fraction = 5
}
boot_disk {
initialize_params {
image_id = data.yandex_compute_image.ubuntu.image_id
}
}
scheduling_policy {
preemptible = true
}
network_interface {
subnet_id = yandex_vpc_subnet.develop.id
nat = true
}

metadata = {
serial-port-enable = 1
ssh-keys = "ubuntu:${var.vms_ssh_root_key}"
}

}
16 changes: 16 additions & 0 deletions scr/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
terraform {
required_providers {
yandex = {
source = "yandex-cloud/yandex"
}
}
required_version = ">=1.5"
}

provider "yandex" {
# token = var.token
cloud_id = "b1gk34aj8huam4c6qc65"
folder_id = "b1groq7lioh1rbih3b87"
zone = "ru-central1-a"
service_account_key_file = file("~/.authorized_key.json")
}
38 changes: 38 additions & 0 deletions scr/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
###cloud vars


variable "cloud_id" {
type = string
description = "https://cloud.yandex.ru/docs/resource-manager/operations/cloud/get-id"
}

variable "folder_id" {
type = string
description = "https://cloud.yandex.ru/docs/resource-manager/operations/folder/get-id"
}

variable "default_zone" {
type = string
default = "ru-central1-a"
description = "https://cloud.yandex.ru/docs/overview/concepts/geo-scope"
}
variable "default_cidr" {
type = list(string)
default = ["10.0.1.0/24"]
description = "https://cloud.yandex.ru/docs/vpc/operations/subnet-create"
}

variable "vpc_name" {
type = string
default = "develop"
description = "VPC network & subnet name"
}


###ssh vars

variable "vms_ssh_root_key" {
type = string
default = "ssh-ed25519ssh-ed25519 roRitedX9AABWbmxLpX8vBtRrMXpyTY8r2RKCc/AIjg flid@devopsserver"
description = "ssh-keygen -t ed25519"
}
13 changes: 13 additions & 0 deletions vector-role-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##Роли
=========


| Name | Default Value | Description |
|-------------------|---------------------------------------------------------------------|--------------------------------|
| vector_url | https://packages.timber.io/vector/0.33.1/vector-0.33.1-1.x86_64.rpm | Для скачивания |
| vector_config_dir | /etc/vector | Установленный патч |
| data_dir | /var/lib/vector | Директория для Vector |
| sources | | Конфигурация Vector |
| sinks | | Подключение к clickhouse |


2 changes: 2 additions & 0 deletions vector-role-main/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for vector-role
8 changes: 8 additions & 0 deletions vector-role-main/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: vector_start
become: true
become_method: sudo
ansible.builtin.systemd:
name: vector
state: started
daemon_reload: true
Loading