Структура проекта
parent
667d632563
commit
5dcdaf2dcc
|
@ -1,30 +0,0 @@
|
||||||
**/.classpath
|
|
||||||
**/.dockerignore
|
|
||||||
**/.env
|
|
||||||
**/.git
|
|
||||||
**/.gitignore
|
|
||||||
**/.project
|
|
||||||
**/.settings
|
|
||||||
**/.toolstarget
|
|
||||||
**/.vs
|
|
||||||
**/.vscode
|
|
||||||
**/*.*proj.user
|
|
||||||
**/*.dbmdl
|
|
||||||
**/*.jfm
|
|
||||||
**/azds.yaml
|
|
||||||
**/bin
|
|
||||||
**/charts
|
|
||||||
**/docker-compose*
|
|
||||||
**/Dockerfile*
|
|
||||||
**/node_modules
|
|
||||||
**/npm-debug.log
|
|
||||||
**/obj
|
|
||||||
**/secrets.dev.yaml
|
|
||||||
**/values.dev.yaml
|
|
||||||
LICENSE
|
|
||||||
README.md
|
|
||||||
!**/.gitignore
|
|
||||||
!.git/HEAD
|
|
||||||
!.git/config
|
|
||||||
!.git/packed-refs
|
|
||||||
!.git/refs/heads/**
|
|
|
@ -1,42 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Sphagnum.Common.Contracts.Messaging;
|
|
||||||
using Sphagnum.Common.Contracts.Messaging.Messages;
|
|
||||||
|
|
||||||
namespace Sphagnum.DebugClient.Controllers
|
|
||||||
{
|
|
||||||
[ApiController]
|
|
||||||
[Route("[controller]/[action]")]
|
|
||||||
public class TestController : ControllerBase
|
|
||||||
{
|
|
||||||
private readonly IMessagingClient _connection;
|
|
||||||
private static readonly Task? rec;
|
|
||||||
|
|
||||||
public TestController(IMessagingClient connection)
|
|
||||||
{
|
|
||||||
_connection = connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public string test()
|
|
||||||
{
|
|
||||||
return "Ok!";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public async Task Send(int size)
|
|
||||||
{
|
|
||||||
var payload1 = new byte[size];
|
|
||||||
var payload2 = new byte[size];
|
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
payload1[i] = 1;
|
|
||||||
payload2[i] = 2;
|
|
||||||
}
|
|
||||||
var t1 = _connection.Publish(new OutgoingMessage("test", payload1)).AsTask();
|
|
||||||
var t2 = _connection.Publish(new OutgoingMessage("test", payload2)).AsTask();
|
|
||||||
await Task.WhenAll(t1, t2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
||||||
USER app
|
|
||||||
WORKDIR /app
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
||||||
ARG BUILD_CONFIGURATION=Release
|
|
||||||
WORKDIR /src
|
|
||||||
COPY ["Sphagnum.DebugClient/Sphagnum.DebugClient.csproj", "Sphagnum.DebugClient/"]
|
|
||||||
COPY ["Sphagnum.Client/Sphagnum.Client.csproj", "Sphagnum.Client/"]
|
|
||||||
COPY ["Sphagnum.Common/Sphagnum.Common.csproj", "Sphagnum.Common/"]
|
|
||||||
COPY ["Sphagnum.Common.Contracts/Sphagnum.Common.Contracts.csproj", "Sphagnum.Common.Contracts/"]
|
|
||||||
RUN dotnet restore "./Sphagnum.DebugClient/./Sphagnum.DebugClient.csproj"
|
|
||||||
COPY . .
|
|
||||||
WORKDIR "/src/Sphagnum.DebugClient"
|
|
||||||
RUN dotnet build "./Sphagnum.DebugClient.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
|
||||||
|
|
||||||
FROM build AS publish
|
|
||||||
ARG BUILD_CONFIGURATION=Release
|
|
||||||
RUN dotnet publish "./Sphagnum.DebugClient.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
||||||
|
|
||||||
FROM base AS final
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=publish /app/publish .
|
|
||||||
ENTRYPOINT ["dotnet", "Sphagnum.DebugClient.dll"]
|
|
|
@ -1,26 +0,0 @@
|
||||||
using Sphagnum.Client;
|
|
||||||
using Sphagnum.Common.Contracts.Login;
|
|
||||||
using Sphagnum.Common.Contracts.Messaging;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
builder.Services.AddSingleton(new ConnectionFactory()
|
|
||||||
{
|
|
||||||
UserRights = UserRights.All,
|
|
||||||
Login = "root",
|
|
||||||
Password = "root",
|
|
||||||
Hostname = "test_server",
|
|
||||||
Port = 8081,
|
|
||||||
});
|
|
||||||
builder.Services.AddSingleton<IMessagingClient, ClientDefault>();
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
app.UseSwagger();
|
|
||||||
app.UseSwaggerUI();
|
|
||||||
|
|
||||||
app.MapControllers();
|
|
||||||
|
|
||||||
app.Run();
|
|
|
@ -1,21 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
|
||||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Sphagnum.Client\Sphagnum.Client.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
||||||
USER app
|
|
||||||
WORKDIR /app
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
||||||
ARG BUILD_CONFIGURATION=Release
|
|
||||||
WORKDIR /src
|
|
||||||
COPY ["Sphagnum.DebugService/Sphagnum.DebugService.csproj", "Sphagnum.DebugService/"]
|
|
||||||
COPY ["Sphagnum.Server/Sphagnum.Server.csproj", "Sphagnum.Server/"]
|
|
||||||
COPY ["Sphagnum.Common/Sphagnum.Common.csproj", "Sphagnum.Common/"]
|
|
||||||
COPY ["Sphagnum.Common.Contracts/Sphagnum.Common.Contracts.csproj", "Sphagnum.Common.Contracts/"]
|
|
||||||
RUN dotnet restore "./Sphagnum.DebugService/./Sphagnum.DebugService.csproj"
|
|
||||||
COPY . .
|
|
||||||
WORKDIR "/src/Sphagnum.DebugService"
|
|
||||||
RUN dotnet build "./Sphagnum.DebugService.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
|
||||||
|
|
||||||
FROM build AS publish
|
|
||||||
ARG BUILD_CONFIGURATION=Release
|
|
||||||
RUN dotnet publish "./Sphagnum.DebugService.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
||||||
|
|
||||||
FROM base AS final
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=publish /app/publish .
|
|
||||||
ENTRYPOINT ["dotnet", "Sphagnum.DebugService.dll"]
|
|
|
@ -1,12 +0,0 @@
|
||||||
using Sphagnum.Common.Contracts.Login;
|
|
||||||
using Sphagnum.Server;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
builder.Services.AddControllers();
|
|
||||||
builder.Services.AddSingleton<ConnectionFactory>();
|
|
||||||
builder.Services.AddHostedService<BrokerHost>();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
app.MapControllers();
|
|
||||||
|
|
||||||
app.Run();
|
|
|
@ -1,21 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
|
||||||
<DockerfileContext>..\..\src</DockerfileContext>
|
|
||||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\src\Sphagnum.Server\Sphagnum.Server.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectVersion>2.1</ProjectVersion>
|
|
||||||
<DockerTargetOS>Linux</DockerTargetOS>
|
|
||||||
<DockerPublishLocally>False</DockerPublishLocally>
|
|
||||||
<ProjectGuid>832db06c-c0f5-4608-b94f-86fde003c420</ProjectGuid>
|
|
||||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
|
||||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
|
|
||||||
<DockerServiceName>sphagnum.debugclient</DockerServiceName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="docker-compose.override.yml">
|
|
||||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
|
||||||
</None>
|
|
||||||
<None Include="docker-compose.yml" />
|
|
||||||
<None Include=".dockerignore" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,2 +0,0 @@
|
||||||
version: '3.4'
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
version: '3.4'
|
|
||||||
|
|
||||||
services:
|
|
||||||
sphagnum.debugclient:
|
|
||||||
depends_on:
|
|
||||||
- sphagnum.debugservice
|
|
||||||
image: sphagnumdebugclient
|
|
||||||
ports:
|
|
||||||
- 5000:8080
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Sphagnum.DebugClient/Dockerfile
|
|
||||||
|
|
||||||
sphagnum.debugservice:
|
|
||||||
hostname: test_server
|
|
||||||
image: sphagnumdebugservice
|
|
||||||
ports:
|
|
||||||
- 5001:8080
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Sphagnum.DebugService/Dockerfile
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"Docker Compose": {
|
|
||||||
"commandName": "DockerCompose",
|
|
||||||
"commandVersion": "1.0",
|
|
||||||
"serviceActions": {
|
|
||||||
"sphagnum.debugclient": "StartDebugging",
|
|
||||||
"sphagnum.debugservice": "StartDebugging"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue