-
Notifications
You must be signed in to change notification settings - Fork 52
Челаев Петр Лаб. 3 Группа 6512 #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PripyatskyPrometheus
wants to merge
41
commits into
itsecd:main
Choose a base branch
from
PripyatskyPrometheus:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
974822e
Создал структуру проекта и забабахал модель
PripyatskyPrometheus 3a5a4ea
Delete SoftwareProject.ApiService directory
PripyatskyPrometheus b803d52
Delete SoftwareProject.Web directory
PripyatskyPrometheus 5f6b884
Добавил генератор и контроллер.
PripyatskyPrometheus 9761727
Устранение конфликтов
PripyatskyPrometheus 4524147
Неболшая калибровка
PripyatskyPrometheus 7467676
Добавил описание
PripyatskyPrometheus 12dd63b
Добавил работу клиента, которую прошляпил до этого:)
PripyatskyPrometheus 0922e68
Исправил замечания
PripyatskyPrometheus b6814d1
Побился над кодировкой
PripyatskyPrometheus f30d735
Исправил версии
PripyatskyPrometheus 26a96a3
Ещё одна порция исправлений
PripyatskyPrometheus af34dbb
Сделал, как надо
PripyatskyPrometheus 9b8bfaa
Добавил токе
PripyatskyPrometheus f48f222
Выполнил вторую лабу (надеюсь, что выполнил, потому что это был какой…
PripyatskyPrometheus a1ae1c2
Небольшие поправки
PripyatskyPrometheus 276fd54
.
PripyatskyPrometheus 93f7d6c
Упростил задачу и починил кодировку в консоли
PripyatskyPrometheus 027fd1a
...
PripyatskyPrometheus ae3954d
Вместо 3 реплик сделал 5, как сказал лектор
PripyatskyPrometheus e1b02fc
Настроил таки ручную репликацию. Теперь у меня распределение по ерпли…
PripyatskyPrometheus 12514d5
.
PripyatskyPrometheus 2224c0d
..
PripyatskyPrometheus 79ed316
Исправил замечания
PripyatskyPrometheus b968029
Сделано
PripyatskyPrometheus 7f76cb6
Добавил SQS и Minio ля 3 лабы
PripyatskyPrometheus 0e54024
Поправочки.
PripyatskyPrometheus 85c95e8
Тесты доавлены (ох сколько они у меня крови попили!)
PripyatskyPrometheus b595aca
.
PripyatskyPrometheus 8d6656f
Поправочки
PripyatskyPrometheus 0045994
номер лабы
PripyatskyPrometheus bc02c78
кодировка
PripyatskyPrometheus 4a1ca4f
Поправки
PripyatskyPrometheus a3e18a1
,
PripyatskyPrometheus c890590
-
PripyatskyPrometheus 2ad06c5
"
PripyatskyPrometheus 5054af6
Ф
PripyatskyPrometheus 960f1e7
_
PripyatskyPrometheus 739f5d9
Голову об стол разбил, но исправил все замечания
PripyatskyPrometheus 2e34f37
js
PripyatskyPrometheus 95bdc62
Проверочка
PripyatskyPrometheus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| <Card> | ||
| <Card> | ||
| <CardHeader> | ||
| <Heading Size="HeadingSize.Is5"><Icon Name="IconName.User" /> Лабораторная работа</Heading> | ||
| </CardHeader> | ||
| <CardBody> | ||
| <UnorderedList Unstyled> | ||
| <UnorderedListItem>Номер <Strong>№X "Название лабораторной"</Strong></UnorderedListItem> | ||
| <UnorderedListItem>Вариант <Strong>№Х "Название варианта"</Strong></UnorderedListItem> | ||
| <UnorderedListItem>Выполнена <Strong>Фамилией Именем 65ХХ</Strong> </UnorderedListItem> | ||
| <UnorderedListItem><Link To="https://puginarug.com/">Ссылка на форк</Link></UnorderedListItem> | ||
| <UnorderedListItem>Номер <Strong>№3 "Интеграционное тестирование"</Strong></UnorderedListItem> | ||
| <UnorderedListItem>Вариант <Strong>№35 "Программный проект"</Strong></UnorderedListItem> | ||
| <UnorderedListItem>Выполнена <Strong>Челаевым Петром 6512</Strong> </UnorderedListItem> | ||
| <UnorderedListItem><Link To="https://github.com/PripyatskyPrometheus/cloud-development">Ссылка на форк</Link></UnorderedListItem> | ||
| </UnorderedList> | ||
| </CardBody> | ||
| </Card> | ||
| </Card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,5 +6,5 @@ | |
| } | ||
| }, | ||
| "AllowedHosts": "*", | ||
| "BaseAddress": "" | ||
| "BaseAddress": "http://localhost:5232/api/projects" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| var builder = DistributedApplication.CreateBuilder(args); | ||
|
|
||
| var cache = builder.AddRedis("cache").WithRedisCommander(); | ||
|
|
||
| // Minio (объектное хранилище) | ||
| var minio = builder.AddMinioContainer("minio") | ||
| .WithDataVolume("minio-data") | ||
| .WithEnvironment("MINIO_ROOT_USER", "minioadmin") | ||
| .WithEnvironment("MINIO_ROOT_PASSWORD", "minioadmin"); | ||
|
|
||
| // Эмулятор из готового пакета aspire (ей богу, с AddContainer было проще) | ||
| var awsConfig = builder.AddAWSSDKConfig() | ||
| .WithProfile("default") | ||
| .WithRegion(Amazon.RegionEndpoint.EUCentral1); | ||
|
|
||
| var localStack = builder.AddLocalStack("aws-local", awsConfig: awsConfig, | ||
| configureContainer: container => | ||
| { | ||
| container.Lifetime = ContainerLifetime.Session; | ||
| container.Port = 4566; | ||
| }); | ||
|
|
||
| var sqsResources = builder.AddAWSCloudFormationTemplate("sqs-resources", "projects-template.yaml", | ||
| "projects") | ||
| .WithReference(awsConfig); | ||
|
|
||
| // Создаём 5 генераторов в цикле | ||
| var generators = new List<IResourceBuilder<ProjectResource>>(); | ||
|
|
||
| for (var i = 1; i <= 5; i++) | ||
| { | ||
| var generator = builder.AddProject<Projects.ProgramProject_GenerationService>($"generator-{i}") | ||
| .WithExternalHttpEndpoints() | ||
| .WithReference(cache) | ||
| .WaitFor(cache) | ||
| .WaitFor(sqsResources) | ||
| .WithEndpoint("http", endpoint => endpoint.Port = 6200 + i) | ||
| .WithEndpoint("https", endpoint => endpoint.Port = 7200 + i) | ||
| .WithEnvironment("SQS__QueueUrl", sqsResources.GetOutput("SQSQueueUrl")); | ||
|
|
||
| generators.Add(generator); | ||
| } | ||
|
|
||
| // Шлюз | ||
| var gateway = builder.AddProject<Projects.ProgramProject_Gateway>("gateway") | ||
| .WithExternalHttpEndpoints(); | ||
|
|
||
| foreach (var generator in generators) | ||
| { | ||
| gateway.WaitFor(generator); | ||
| } | ||
|
|
||
| // Файловый сервис | ||
| builder.AddProject<Projects.ProgramProject_FileService>("programproject-fileservice") | ||
| .WithExternalHttpEndpoints() | ||
| .WithEnvironment("SQS__QueueUrl", sqsResources.GetOutput("SQSQueueUrl")) | ||
| .WithEnvironment("Minio__Endpoint", minio.GetEndpoint("http")) | ||
| .WithEnvironment("Minio__AccessKey", "minioadmin") | ||
| .WithEnvironment("Minio__SecretKey", "minioadmin") | ||
| .WaitFor(sqsResources) | ||
| .WaitFor(minio); | ||
|
|
||
| // Клиент теперь связывается с генератором через шлюз | ||
| builder.AddProject<Projects.Client_Wasm>("client-wasm") | ||
| .WithExternalHttpEndpoints() | ||
| .WaitFor(gateway); | ||
|
|
||
| builder.UseLocalStack(localStack); | ||
|
|
||
| builder.Build().Run(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <Sdk Name="Aspire.AppHost.Sdk" Version="9.5.2" /> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <UserSecretsId>f95b6f17-c3f7-4ae5-a722-409a54dda80d</UserSecretsId> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Client.Wasm\Client.Wasm.csproj" /> | ||
| <ProjectReference Include="..\ProgramProject.FileService\ProgramProject.FileService.csproj" /> | ||
| <ProjectReference Include="..\ProgramProject.Gateway\ProgramProject.Gateway.csproj" /> | ||
| <ProjectReference Include="..\ProgramProject.GenerationService\ProgramProject.GenerationService.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Aspire.Hosting.AppHost" Version="9.5.2" /> | ||
| <PackageReference Include="Aspire.Hosting.Redis" Version="9.5.2" /> | ||
| <PackageReference Include="CommunityToolkit.Aspire.Hosting.Minio" Version="9.7.0" /> | ||
| <PackageReference Include="LocalStack.Aspire.Hosting" Version="9.5.3" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Update="projects-template.yaml"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/launchsettings.json", | ||
| "profiles": { | ||
| "https": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "https://localhost:17028;http://localhost:15016", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "DOTNET_ENVIRONMENT": "Development", | ||
| "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21209", | ||
| "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22094" | ||
| } | ||
| }, | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "http://localhost:15016", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "DOTNET_ENVIRONMENT": "Development", | ||
| "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19079", | ||
| "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20183" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning", | ||
| "Aspire.Hosting.Dcp": "Warning" | ||
| } | ||
| }, | ||
| "LocalStack": { | ||
| "UseLocalStack": true | ||
| }, | ||
| "AWS": { | ||
| "Profile": "default", | ||
| "Region": "eu-central-1" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| AWSTemplateFormatVersion: '2010-09-09' | ||
| Description: 'CloudFormation template for ProgramProject' | ||
|
|
||
| Parameters: | ||
| QueueName: | ||
| Type: String | ||
| Description: Name for the SQS queue | ||
| Default: 'projects' | ||
|
|
||
| Resources: | ||
| ProjectsQueue: | ||
| Type: AWS::SQS::Queue | ||
| Properties: | ||
| QueueName: { "Ref": "QueueName" } | ||
| VisibilityTimeout: 30 | ||
| MessageRetentionPeriod: 345600 | ||
| DelaySeconds: 0 | ||
| ReceiveMessageWaitTimeSeconds: 0 | ||
|
|
||
| Outputs: | ||
| SQSQueueUrl: | ||
| Description: URL of the SQS queue | ||
| Value: { "Ref": "ProjectsQueue" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| using Amazon.Runtime; | ||
| using Amazon.SQS; | ||
| using Minio; | ||
| using ProgramProject.FileService.Services; | ||
| using ProgramProject.ServiceDefaults; | ||
|
|
||
| var builder = WebApplication.CreateBuilder(args); | ||
|
|
||
| Console.OutputEncoding = System.Text.Encoding.UTF8; | ||
|
|
||
| builder.AddServiceDefaults(); | ||
|
|
||
| var sqsServiceUrl = builder.Configuration["SQS:QueueUrl"] ?? builder.Configuration["SQS:ServiceURL"] | ||
| ?? "http://localhost:9324"; | ||
| var sqsConfig = new AmazonSQSConfig | ||
| { | ||
| ServiceURL = sqsServiceUrl, | ||
| UseHttp = true, | ||
| AuthenticationRegion = "eu-central-1" | ||
| }; | ||
| builder.Services.AddSingleton<IAmazonSQS>(sp => new AmazonSQSClient(new AnonymousAWSCredentials(), sqsConfig)); | ||
|
|
||
| var minioEndpoint = builder.Configuration["Minio:Endpoint"] ?? "http://localhost:9000"; | ||
| Console.WriteLine($"Minio endpoint from config: '{minioEndpoint}'"); | ||
| var minioAccessKey = builder.Configuration["Minio:AccessKey"] ?? "minioadmin"; | ||
| var minioSecretKey = builder.Configuration["Minio:SecretKey"] ?? "minioadmin"; | ||
|
|
||
|
|
||
| builder.Services.AddSingleton<Minio.IMinioClient>(sp => | ||
| { | ||
| return new Minio.MinioClient() | ||
| .WithEndpoint(minioEndpoint.Replace("http://", "").Replace("https://", "")) | ||
| .WithCredentials(minioAccessKey, minioSecretKey) | ||
| .WithSSL(false) | ||
| .Build(); | ||
| }); | ||
|
|
||
| builder.Services.AddHostedService<InfrastructureInitializer>(); | ||
| builder.Services.AddSingleton<IProjectSaver, ProjectSaver>(); | ||
| builder.Services.AddHostedService<MessageConsumerService>(); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.MapDefaultEndpoints(); | ||
|
|
||
| app.Run(); |
19 changes: 19 additions & 0 deletions
19
ProgramProject.FileService/ProgramProject.FileService.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="4.0.3.31" /> | ||
| <PackageReference Include="AWSSDK.SQS" Version="4.0.2.23" /> | ||
| <PackageReference Include="Minio" Version="7.0.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\ProgramProject.ServiceDefaults\ProgramProject.ServiceDefaults.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "$schema": "http://json.schemastore.org/launchsettings.json", | ||
| "iisSettings": { | ||
| "windowsAuthentication": false, | ||
| "anonymousAuthentication": true, | ||
| "iisExpress": { | ||
| "applicationUrl": "http://localhost:38561", | ||
| "sslPort": 44371 | ||
| } | ||
| }, | ||
| "profiles": { | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "launchUrl": "swagger", | ||
| "applicationUrl": "http://localhost:5028", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| }, | ||
| "https": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "launchUrl": "swagger", | ||
| "applicationUrl": "https://localhost:7063;http://localhost:5028", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| }, | ||
| "IIS Express": { | ||
| "commandName": "IISExpress", | ||
| "launchBrowser": true, | ||
| "launchUrl": "swagger", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| namespace ProgramProject.FileService.Services; | ||
|
|
||
| public interface IProjectSaver | ||
| { | ||
| public Task SaveAsync(string jsonContent, CancellationToken cancellationToken); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Генераторам стоит добавить ожидание брокера