diff --git a/tasks/mytarin_es/lab1/images/pic1_1.png b/tasks/mytarin_es/lab1/images/pic1_1.png deleted file mode 100644 index ad6e9d5..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic1_1.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic1_2.png b/tasks/mytarin_es/lab1/images/pic1_2.png deleted file mode 100644 index 4f03519..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic1_2.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic1_3.png b/tasks/mytarin_es/lab1/images/pic1_3.png deleted file mode 100644 index afc0a68..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic1_3.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic1_4.png b/tasks/mytarin_es/lab1/images/pic1_4.png deleted file mode 100644 index 7458f7c..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic1_4.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic2_1.png b/tasks/mytarin_es/lab1/images/pic2_1.png deleted file mode 100644 index 14ae5f7..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic2_1.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic2_2.png b/tasks/mytarin_es/lab1/images/pic2_2.png deleted file mode 100644 index c885394..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic2_2.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic2_3.png b/tasks/mytarin_es/lab1/images/pic2_3.png deleted file mode 100644 index 3663395..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic2_3.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic3_1.png b/tasks/mytarin_es/lab1/images/pic3_1.png deleted file mode 100644 index 6746f32..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic3_1.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic3_2.png b/tasks/mytarin_es/lab1/images/pic3_2.png deleted file mode 100644 index 3e1b4de..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic3_2.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/images/pic3_3.png b/tasks/mytarin_es/lab1/images/pic3_3.png deleted file mode 100644 index 969e030..0000000 Binary files a/tasks/mytarin_es/lab1/images/pic3_3.png and /dev/null differ diff --git a/tasks/mytarin_es/lab1/readme.md b/tasks/mytarin_es/lab1/readme.md deleted file mode 100644 index 39be845..0000000 --- a/tasks/mytarin_es/lab1/readme.md +++ /dev/null @@ -1,171 +0,0 @@ -# Отчет по лабораторной работе №1 - -Выполнил студент гр. ИСЭбд-41 Мытарин Е.С. - -## Разворачивание сервиса Mediawiki - -Содержимое файла `docker-compose.yml` в папке mediawiki - -```yaml -version: '3' -services: - mediawiki: - image: mediawiki:1.38 #образ docker - restart: always #контейнер всегда перезапускается - networks: #используем сеть для связи - - docker_network - ports: - - 8080:80 #пробрасываем порт - volumes: - - ./LocalSettings.php:/var/www/html/LocalSettings.php #определение тома для хранения настроек php - - database: - image: mysql:8.0.29 #образ docker - restart: always #контейнер всегда перезапускается - networks: #используем сеть для связи - - docker_network - environment: - MYSQL_DATABASE: wiki_db #имя бд - MYSQL_ROOT_PASSWORD: root #пароль для root пользователя - MYSQL_USER: tornado #имя пользователя mysql - MYSQL_PASSWORD: tornado #пароль пользователя mysql - volumes: - - /var/lib/mysql #определение тома для хранения данных mysql - - phpmyadmin: - depends_on: #определяем зависимость от бд - - database - image: phpmyadmin/phpmyadmin #образ docker - restart: always #контейнер всегда перезапускается - ports: - - '8000:80' #пробрасываем порт - environment: - PMA_HOST: database #кто является хостом - MYSQL_ROOT_PASSWORD: root #пароль от пользователя root - UPLOAD_LIMIT: 64M #лимит на загрузку - networks: - - docker_network #используем сеть для связи - -networks: - docker_network: - driver: bridge #подключаем драйвер для соединения -``` -С помощью команды `docker-compose.yml` в терминале разворачиваем сервис: -![](images/pic1_1.png) - -Открываем Docker Desktop и проверяем, что контейнер сервера базы данных, Mediawiki и PHPMyAdmin созданы и запущены: -![](images/pic1_2.png) - -Переходим на http://localhost:8080: -![](images/pic1_3.png) - -Задаем настройки и регистрируемся. Сервис поднят и успешно работает -![](images/pic1_4.png) - -## Разворачивание сервиса Gitea - -Содержимое файла `docker-compose.yml` в папке gitea - -```yaml -version: '3' - -services: - server: - image: gitea/gitea:1.20.4 #образ docker - container_name: gitea #имя контейнера - environment: #настройки для подключения - - USER_UID=1000 - - USER_GID=1000 - - GITEA__database__DB_TYPE=mysql - - GITEA__database__HOST=db:3306 - - GITEA__database__NAME=gitea - - GITEA__database__USER=gitea - - GITEA__database__PASSWD=gitea - restart: always #контейнер всегда перезапускается - networks: #используем сеть для связи - - gitea - volumes: #устанавливаем томы для хранения данных - - ./gitea:/data - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "3000:3000" #проброс портов - - "2222:22" - depends_on: #зависимости - - db - - db: - image: mysql:8 #образ docker - restart: always #контейнер всегда перезапускается - environment: - - MYSQL_ROOT_PASSWORD=gitea #пароль root - - MYSQL_USER=gitea #пользователь - - MYSQL_PASSWORD=gitea #пароль - - MYSQL_DATABASE=gitea #имя бд - networks: #используем сеть для связи - - gitea - volumes: #определяем том для хранения данных mysql - - ./mysql:/var/lib/mysql - -networks: #задаем сеть и указываем что она внутренняя - gitea: - external: false -``` -Открываем Docker Desktop и проверяем, что контейнер сервера базы данных и Gitea созданы и запущены: -![](images/pic2_1.png) - -Переходим на http://localhost:3000: -![](images/pic2_2.png) - -Задаем настройки и регистрируемся. Сервис поднят и успешно работает -![](images/pic2_3.png) - -## Разворачивание сервиса Wordpress - -Содержимое файла '' в папке wordpress - -```yaml -version: '3' -services: - wordpress: - image: wordpress #образ docker - container_name: wordpress #имя контейнера - ports: - - '9091:80' #проброс портов - environment: #настройки для подключения - WORDPRESS_DB_HOST: mysql - WORDPRESS_DB_USER: tornado - WORDPRESS_DB_PASSWORD: tornado - WORDPRESS_DB_NAME: wp_database - volumes: #определяем том для хранения данных - - wordpress_data:/var/www/html - networks: #используем сеть для связи - - wordpress-network - - mysql: - image: mysql:5.7 #образ docker - container_name: mysql #имя контейнера - environment: #настройки для подключения - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: wp_database - MYSQL_USER: tornado - MYSQL_PASSWORD: tornado - volumes: #определяем том для хранения данных - - mysql_data:/var/lib/mysql - networks: #используем сеть для связи - - wordpress-network -networks: #сеть - wordpress-network: -volumes: #тома для хранениях данных - wordpress_data: - mysql_data: -``` - -Открываем Docker Desktop и проверяем, что контейнер сервера базы данных и Wordpress созданы и запущены: -![](images/pic3_1.png) - -Переходим на http://localhost:9091: -![](images/pic3_2.png) - -Задаем настройки и регистрируемся. Сервис поднят и успешно работает -![](images/pic3_3.png) \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/docker-compose.yml b/tasks/mytarin_es/lab3/docker-compose.yml new file mode 100644 index 0000000..e9ca4b9 --- /dev/null +++ b/tasks/mytarin_es/lab3/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3.1" +services: + worker-1: + build: ./worker-1 + worker-2: + build: ./worker-2 + depends_on: + - worker-1 + gateway: + image: nginx:latest + ports: + - 8080:8080 + volumes: + - ./static:/usr/share/nginx/html:ro + - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/nginx.conf b/tasks/mytarin_es/lab3/nginx.conf new file mode 100644 index 0000000..f4a2d17 --- /dev/null +++ b/tasks/mytarin_es/lab3/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 8080; + listen [::]:8080; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + location /worker-1/ { + proxy_pass http://worker-1:80/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Prefix /worker-1; + } + + location /worker-2/ { + proxy_pass http://worker-2:80/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Prefix /worker-2; + } +} diff --git a/tasks/mytarin_es/lab3/static/index.html b/tasks/mytarin_es/lab3/static/index.html new file mode 100644 index 0000000..20acc3f --- /dev/null +++ b/tasks/mytarin_es/lab3/static/index.html @@ -0,0 +1,13 @@ + + + + + + Тестовое приложение для л/р 3 + + +

Именно этот файл вы видите, когда открываете приложение.

+

Отправить запрос к worker-1

+

Отправить запрос к worker-2

+ + \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/Dockerfile b/tasks/mytarin_es/lab3/worker-1/Dockerfile new file mode 100644 index 0000000..7a8ce23 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env +WORKDIR /app + +COPY . ./ +RUN dotnet restore +RUN dotnet publish -c Release -o out + +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "worker-1.dll"] \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/Program.cs b/tasks/mytarin_es/lab3/worker-1/Program.cs new file mode 100644 index 0000000..bd1bffb --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/Program.cs @@ -0,0 +1,124 @@ +List requests = new() +{ + new Request() { Uuid= Guid.Parse("7184fa5f-b786-4478-863a-99cc000eb752"), Title = "Расход на коммуналку", SourceOfFunds = "Мердеев", Sum = 100000, IsCompleted = false }, + new Request() { Uuid= Guid.Parse("55a9aed1-218a-468e-92b9-99f6a6a34543"), Title = "Расход на газ", SourceOfFunds = "Киселев", Sum = 25000, IsCompleted = true }, +}; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.MapGet("/", () => +{ + return requests.Select(r => new RequestEntityDto() + { + Uuid = r.Uuid, + Title = r.Title, + Sum = r.Sum, + SourceOfFunds = r.SourceOfFunds, + IsCompleted = r.IsCompleted, + }); +}) +.WithName("GetRequests") +.WithOpenApi(); + +app.MapGet("/{uuid}", (Guid uuid) => +{ + var request = requests.FirstOrDefault(r => r.Uuid == uuid); + if (request == null) + return Results.NotFound(); + return Results.Json(new RequestEntityDto() + { + Uuid = request.Uuid, + Title = request.Title, + Sum = request.Sum, + SourceOfFunds = request.SourceOfFunds, + IsCompleted = request.IsCompleted, + }); +}) +.WithName("GetRequestByGUID") +.WithOpenApi(); + +app.MapPost("/{title}/{sourceOfFunds}/{sum}/{isCompleted}", (string title, string sourceOfFunds, decimal sum, bool isCompleted) => +{ + Guid NewGuid = Guid.NewGuid(); + requests.Add(new Request() { Uuid = NewGuid, Title = (string)title, SourceOfFunds = (string)sourceOfFunds, Sum = (decimal)sum, IsCompleted = (bool)isCompleted}); + + var request = requests.FirstOrDefault(r => r.Uuid == NewGuid); + if (request == null) + return Results.NotFound(); + return Results.Json(new RequestEntityDto() + { + Uuid = request.Uuid, + Title = request.Title, + Sum = request.Sum, + SourceOfFunds = request.SourceOfFunds, + IsCompleted = request.IsCompleted, + }); +}) +.WithName("PostRequest") +.WithOpenApi(); + +app.MapPatch("/{uuid}/{title}/{sourceOfFunds}/{sum}/{isCompleted}", (Guid uuid, string ?title, string ?sourceOfFunds, decimal sum, bool isCompleted) => +{ + var request = requests.FirstOrDefault(r => r.Uuid == uuid); + if (request == null) + return Results.NotFound(); + if (title != null) request.Title = title; + if (sourceOfFunds != ",") request.SourceOfFunds = sourceOfFunds; + if (sum != request.Sum && sum != 0) request.Sum = sum; + if (isCompleted != request.IsCompleted) request.IsCompleted = isCompleted; + + return Results.Json(new RequestEntityDto() + { + Uuid = request.Uuid, + Title = request.Title, + Sum = request.Sum, + SourceOfFunds = request.SourceOfFunds, + IsCompleted = request.IsCompleted, + }); +}) +.WithName("UpdateRequest") +.WithOpenApi(); + +app.MapDelete("/{uuid}", (Guid uuid) => +{ + var request = requests.FirstOrDefault(r => r.Uuid == uuid); + if (request == null) + return Results.NotFound(); + requests.Remove(request); + return Results.Json(new RequestEntityDto() + { + Uuid = request.Uuid, + Title = request.Title, + Sum = request.Sum, + SourceOfFunds = request.SourceOfFunds, + IsCompleted = request.IsCompleted, + }); +}) +.WithName("DeleteRequestByGUID") +.WithOpenApi(); + +app.Run(); + +public class Request +{ + public Guid Uuid { get; set; } + public string Title { get; set; } = string.Empty; + public string SourceOfFunds { get; set; } = string.Empty; + public decimal Sum { get; set; } = 0; + public bool IsCompleted { get; set; } +} + +public class RequestEntityDto : Request { } \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/Properties/launchSettings.json b/tasks/mytarin_es/lab3/worker-1/Properties/launchSettings.json new file mode 100644 index 0000000..79e1726 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:6980", + "sslPort": 44332 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5019", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7244;http://localhost:5019", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/tasks/mytarin_es/lab3/worker-1/appsettings.Development.json b/tasks/mytarin_es/lab3/worker-1/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/tasks/mytarin_es/lab3/worker-1/appsettings.json b/tasks/mytarin_es/lab3/worker-1/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/tasks/mytarin_es/lab3/worker-1/obj/project.assets.json b/tasks/mytarin_es/lab3/worker-1/obj/project.assets.json new file mode 100644 index 0000000..eb0c35e --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/obj/project.assets.json @@ -0,0 +1,71 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "C:\\Users\\tornado\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj", + "projectName": "worker-1", + "projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj", + "packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\", + "outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.AspNetCore.App": { + "privateAssets": "none" + }, + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/obj/project.nuget.cache b/tasks/mytarin_es/lab3/worker-1/obj/project.nuget.cache new file mode 100644 index 0000000..c794032 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "+cwREIHqhmU0K0lolkc+aJ4VfGcHTd+lgDzxgzG6VVzVqzcMiP/4HBRoxfRQGZM0f0Z+Rmba7TxtDbNQh/2bYw==", + "success": true, + "projectFilePath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.dgspec.json b/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.dgspec.json new file mode 100644 index 0000000..c18889a --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.dgspec.json @@ -0,0 +1,66 @@ +{ + "format": 1, + "restore": { + "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj": {} + }, + "projects": { + "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj", + "projectName": "worker-1", + "projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\worker-1.csproj", + "packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\", + "outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-1\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.AspNetCore.App": { + "privateAssets": "none" + }, + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.g.props b/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.g.props new file mode 100644 index 0000000..4dbda4e --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\tornado\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.g.targets b/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/obj/worker-1.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-1/worker-1.csproj b/tasks/mytarin_es/lab3/worker-1/worker-1.csproj new file mode 100644 index 0000000..d97902c --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-1/worker-1.csproj @@ -0,0 +1,10 @@ + + + + net8.0 + enable + enable + worker_1 + + + diff --git a/tasks/mytarin_es/lab3/worker-2/Dockerfile b/tasks/mytarin_es/lab3/worker-2/Dockerfile new file mode 100644 index 0000000..7f6b963 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env +WORKDIR /app + +COPY . ./ +RUN dotnet restore +RUN dotnet publish -c Release -o out + +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "worker-2.dll"] \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/Program.cs b/tasks/mytarin_es/lab3/worker-2/Program.cs new file mode 100644 index 0000000..71de0e7 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/Program.cs @@ -0,0 +1,145 @@ + +List agrs = new() +{ + new Agreement() { Uuid= Guid.NewGuid(), Number = "75ИФ-61", Date = new DateOnly(), Sum = 50000, IdRequest = Guid.Parse("7184fa5f-b786-4478-863a-99cc000eb752") } +}; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.MapGet("/", () => +{ + return agrs.Select(r => new AgreementEntityDto() + { + Uuid = r.Uuid, + Number = r.Number, + Sum = r.Sum, + Date = r.Date, + IdRequest = r.IdRequest, + }); +}) +.WithName("GetAgreements") +.WithOpenApi(); + +app.MapGet("/{uuid}", (Guid uuid) => +{ + var agr = agrs.FirstOrDefault(r => r.Uuid == uuid); + if (agr == null) + return Results.NotFound(); + return Results.Json(new AgreementEntityDto() + { + Uuid = agr.Uuid, + Number = agr.Number, + Sum = agr.Sum, + Date = agr.Date, + IdRequest = agr.IdRequest, + }); +}) +.WithName("GetAgreementByGUID") +.WithOpenApi(); + +app.MapPost("/{number}/{date}/{sum}/{idRequest}", (string? number, DateOnly date, decimal sum, Guid idRequest) => +{ + Guid NewGuid = Guid.NewGuid(); + agrs.Add(new Agreement() { Uuid = NewGuid, Number = (string)number, Date = (DateOnly)date, Sum = (decimal)sum, IdRequest = (Guid)idRequest }); + + var agr = agrs.FirstOrDefault(r => r.Uuid == NewGuid); + if (agr == null) + return Results.NotFound(); + return Results.Json(new AgreementEntityDto() + { + Uuid = agr.Uuid, + Number = agr.Number, + Sum = agr.Sum, + Date = agr.Date, + IdRequest = agr.IdRequest, + }); +}) +.WithName("PostAgreement") +.WithOpenApi(); + +app.MapPatch("/{uuid}/{number}/{date}/{sum}/{idRequest}", (Guid uuid, string ?number, DateOnly date, decimal sum, Guid idRequest) => +{ + var agr = agrs.FirstOrDefault(r => r.Uuid == uuid); + if (agr == null) + return Results.NotFound(); + if (number != ",") agr.Number = number; + if (date != null)agr.Date = date; + if (sum != agr.Sum && sum != 0) agr.Sum = sum; + if (idRequest != agr.IdRequest) agr.IdRequest = idRequest; + + return Results.Json(new AgreementEntityDto() + { + Uuid = agr.Uuid, + Number = agr.Number, + Sum = agr.Sum, + Date = agr.Date, + IdRequest = agr.IdRequest, + }); +}) +.WithName("UpdateAgreement") +.WithOpenApi(); + +app.MapDelete("/{uuid}", (Guid uuid) => +{ + var agr = agrs.FirstOrDefault(r => r.Uuid == uuid); + if (agr == null) + return Results.NotFound(); + agrs.Remove(agr); + return Results.Json(new AgreementEntityDto() + { + Uuid = agr.Uuid, + Number = agr.Number, + Sum = agr.Sum, + Date = agr.Date, + IdRequest = agr.IdRequest, + }); +}) +.WithName("DeleteAgreement") +.WithOpenApi(); + +app.MapGet("/Requests/", async () => +{ + var httpClient = new HttpClient(); + var secondWorkerResponse = await httpClient.GetStringAsync("http://worker-2:80/"); + + return secondWorkerResponse.ToArray(); +}) +.WithName("GetRequests") +.WithOpenApi(); + +app.Run(); + +public class Agreement +{ + public Guid Uuid { get; set; } + public string Number { get; set; } = string.Empty; + public DateOnly Date { get; set; } + public Guid IdRequest { get; set; } + public decimal Sum { get; set; } = 0; +} + +public class AgreementEntityDto : Agreement { } + +public class Request +{ + public Guid Uuid { get; set; } + public string Title { get; set; } = string.Empty; + public string SourceOfFunds { get; set; } = string.Empty; + public decimal Sum { get; set; } = 0; + public bool IsCompleted { get; set; } +} + +public class RequestEntityDto : Request { } \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/Properties/launchSettings.json b/tasks/mytarin_es/lab3/worker-2/Properties/launchSettings.json new file mode 100644 index 0000000..9a60169 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:22357", + "sslPort": 44378 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5068", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7027;http://localhost:5068", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/tasks/mytarin_es/lab3/worker-2/appsettings.Development.json b/tasks/mytarin_es/lab3/worker-2/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/tasks/mytarin_es/lab3/worker-2/appsettings.json b/tasks/mytarin_es/lab3/worker-2/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/tasks/mytarin_es/lab3/worker-2/obj/project.assets.json b/tasks/mytarin_es/lab3/worker-2/obj/project.assets.json new file mode 100644 index 0000000..6d00b58 --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/obj/project.assets.json @@ -0,0 +1,71 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "C:\\Users\\tornado\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj", + "projectName": "worker-2", + "projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj", + "packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\", + "outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.AspNetCore.App": { + "privateAssets": "none" + }, + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/obj/project.nuget.cache b/tasks/mytarin_es/lab3/worker-2/obj/project.nuget.cache new file mode 100644 index 0000000..7b32c0f --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "1v+091MPSsb0GY9t1QT541i6Br4GtjsgMis1YtUlrFQMBiie91sJdKxeMF4519i4iZtFk8/rkf1BQTKEycP1/w==", + "success": true, + "projectFilePath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.dgspec.json b/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.dgspec.json new file mode 100644 index 0000000..dfcd4be --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.dgspec.json @@ -0,0 +1,66 @@ +{ + "format": 1, + "restore": { + "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj": {} + }, + "projects": { + "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj", + "projectName": "worker-2", + "projectPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\worker-2.csproj", + "packagesPath": "C:\\Users\\tornado\\.nuget\\packages\\", + "outputPath": "C:\\TornaDO LPC\\Study\\RVIP Reports\\lab 1 report\\distributed-computing\\tasks\\mytarin_es\\lab3\\worker-2\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\tornado\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.AspNetCore.App": { + "privateAssets": "none" + }, + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.g.props b/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.g.props new file mode 100644 index 0000000..4dbda4e --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\tornado\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.g.targets b/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/obj/worker-2.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tasks/mytarin_es/lab3/worker-2/worker-2.csproj b/tasks/mytarin_es/lab3/worker-2/worker-2.csproj new file mode 100644 index 0000000..29e683d --- /dev/null +++ b/tasks/mytarin_es/lab3/worker-2/worker-2.csproj @@ -0,0 +1,10 @@ + + + + net8.0 + enable + enable + worker_2 + + +