[Л/Р 4] Мытарин Евгений (по согл. с преподавателем) #44

Closed
Mytarin_Evgeny_Isebd-41 wants to merge 7 commits from Mytarin_Evgeny_Isebd-41/distributed-computing:mytarin_es_lab_4 into main
36 changed files with 799 additions and 171 deletions
Showing only changes of commit 50cf3cd912 - Show all commits

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

View File

@ -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)

View File

@ -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

View File

@ -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;
}
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Тестовое приложение для л/р 3</title>
</head>
<body>
<p>Именно этот файл вы видите, когда открываете приложение.</p>
<p><a href="/worker-1/">Отправить запрос к worker-1</a></p>
<p><a href="/worker-2/">Отправить запрос к worker-2</a></p>
</body>
</html>

View File

@ -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"]

View File

@ -0,0 +1,124 @@
List<Request> 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 { }

View File

@ -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"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@ -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"
}
}
}
}

View File

@ -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": []
}

View File

@ -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"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\tornado\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\tornado\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>worker_1</RootNamespace>
</PropertyGroup>
</Project>

View File

@ -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"]

View File

@ -0,0 +1,145 @@
List<Agreement> 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 { }

View File

@ -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"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@ -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"
}
}
}
}

View File

@ -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": []
}

View File

@ -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"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\tornado\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\tornado\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>worker_2</RootNamespace>
</PropertyGroup>
</Project>