master
Tudor Stanciu 2021-04-06 02:33:52 +03:00
parent a013136e89
commit faddfee544
20 changed files with 49 additions and 49 deletions

View File

@ -1,6 +1,6 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace NetworkResurrector.Agent.Application namespace NetworkResurrector.Api.Application
{ {
public static class DependencyInjectionExtensions public static class DependencyInjectionExtensions
{ {

View File

@ -1,8 +1,8 @@
using AutoMapper; using AutoMapper;
using NetworkResurrector.Agent.Application.Queries; using NetworkResurrector.Api.Application.Queries;
using NetworkResurrector.Agent.Domain.Entities; using NetworkResurrector.Api.Domain.Entities;
namespace NetworkResurrector.Agent.Application.Mappings namespace NetworkResurrector.Api.Application.Mappings
{ {
public class MappingProfile : Profile public class MappingProfile : Profile
{ {

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
@ -14,6 +14,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NetworkResurrector.Agent.Domain\NetworkResurrector.Agent.Domain.csproj" /> <ProjectReference Include="..\NetworkResurrector.Agent.Domain\NetworkResurrector.Api.Domain.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,11 +1,11 @@
using AutoMapper; using AutoMapper;
using MediatR; using MediatR;
using NDB.Application.DataContracts; using NDB.Application.DataContracts;
using NetworkResurrector.Agent.Domain.Repositories; using NetworkResurrector.Api.Domain.Repositories;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace NetworkResurrector.Agent.Application.Queries namespace NetworkResurrector.Api.Application.Queries
{ {
public class GetMachines public class GetMachines
{ {

View File

@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NetworkResurrector.Agent.Domain.Data.EntityTypeConfiguration; using NetworkResurrector.Api.Domain.Data.EntityTypeConfiguration;
using NetworkResurrector.Agent.Domain.Entities; using NetworkResurrector.Api.Domain.Entities;
namespace NetworkResurrector.Agent.Domain.Data.DbContexts namespace NetworkResurrector.Api.Domain.Data.DbContexts
{ {
public class AgentDbContext : DbContext public class AgentDbContext : DbContext
{ {

View File

@ -1,11 +1,11 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using NetworkResurrector.Agent.Domain.Data.DbContexts; using NetworkResurrector.Api.Domain.Data.DbContexts;
using NetworkResurrector.Agent.Domain.Data.Repositories; using NetworkResurrector.Api.Domain.Data.Repositories;
using NetworkResurrector.Agent.Domain.Repositories; using NetworkResurrector.Api.Domain.Repositories;
namespace NetworkResurrector.Agent.Domain.Data namespace NetworkResurrector.Api.Domain.Data
{ {
public static class DependencyInjectionExtensions public static class DependencyInjectionExtensions
{ {

View File

@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NetworkResurrector.Agent.Domain.Entities; using NetworkResurrector.Api.Domain.Entities;
namespace NetworkResurrector.Agent.Domain.Data.EntityTypeConfiguration namespace NetworkResurrector.Api.Domain.Data.EntityTypeConfiguration
{ {
class MachineConfiguration : IEntityTypeConfiguration<Machine> class MachineConfiguration : IEntityTypeConfiguration<Machine>
{ {

View File

@ -9,7 +9,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NetworkResurrector.Agent.Domain\NetworkResurrector.Agent.Domain.csproj" /> <ProjectReference Include="..\NetworkResurrector.Agent.Domain\NetworkResurrector.Api.Domain.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,10 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NetworkResurrector.Agent.Domain.Data.DbContexts; using NetworkResurrector.Api.Domain.Data.DbContexts;
using NetworkResurrector.Agent.Domain.Entities; using NetworkResurrector.Api.Domain.Entities;
using NetworkResurrector.Agent.Domain.Repositories; using NetworkResurrector.Api.Domain.Repositories;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace NetworkResurrector.Agent.Domain.Data.Repositories namespace NetworkResurrector.Api.Domain.Data.Repositories
{ {
class AgentRepository : IAgentRepository class AgentRepository : IAgentRepository
{ {

View File

@ -1,4 +1,4 @@
namespace NetworkResurrector.Agent.Domain.Entities namespace NetworkResurrector.Api.Domain.Entities
{ {
public class Machine public class Machine
{ {

View File

@ -1,7 +1,7 @@
using NetworkResurrector.Agent.Domain.Entities; using NetworkResurrector.Api.Domain.Entities;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace NetworkResurrector.Agent.Domain.Repositories namespace NetworkResurrector.Api.Domain.Repositories
{ {
public interface IAgentRepository public interface IAgentRepository
{ {

View File

@ -1,9 +1,9 @@
using MediatR; using MediatR;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NetworkResurrector.Agent.Application.Queries; using NetworkResurrector.Api.Application.Queries;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace NetworkResurrector.Agent.Controllers namespace NetworkResurrector.Api.Controllers
{ {
[ApiController] [ApiController]
[Route("resurrector-agent")] [Route("resurrector-agent")]

View File

@ -9,17 +9,17 @@ WORKDIR /src
COPY dependencies.props . COPY dependencies.props .
COPY Directory.Build.props . COPY Directory.Build.props .
COPY NuGet.config . COPY NuGet.config .
COPY ["NetworkResurrector.Agent/NetworkResurrector.Agent.csproj", "NetworkResurrector.Agent/"] COPY ["NetworkResurrector.Api/NetworkResurrector.Api.csproj", "NetworkResurrector.Api/"]
COPY ["NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj", "NetworkResurrector.Agent.Application/"] COPY ["NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj", "NetworkResurrector.Api.Application/"]
COPY ["NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj", "NetworkResurrector.Agent.Domain/"] COPY ["NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj", "NetworkResurrector.Api.Domain/"]
COPY ["NetworkResurrector.Agent.Domain.Data/NetworkResurrector.Agent.Domain.Data.csproj", "NetworkResurrector.Agent.Domain.Data/"] COPY ["NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj", "NetworkResurrector.Api.Domain.Data/"]
RUN dotnet restore "NetworkResurrector.Agent/NetworkResurrector.Agent.csproj" RUN dotnet restore "NetworkResurrector.Api/NetworkResurrector.Api.csproj"
COPY . . COPY . .
WORKDIR "/src/NetworkResurrector.Agent" WORKDIR "/src/NetworkResurrector.Api"
RUN dotnet build "NetworkResurrector.Agent.csproj" -c Release -o /app/build RUN dotnet build "NetworkResurrector.Api.csproj" -c Release -o /app/build
FROM build AS publish FROM build AS publish
RUN dotnet publish "NetworkResurrector.Agent.csproj" -c Release -o /app/publish RUN dotnet publish "NetworkResurrector.Api.csproj" -c Release -o /app/publish
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
@ -31,4 +31,4 @@ ENV ConnectionStrings__DatabaseConnection="***REMOVED***"
#Workaround to lower the TLS level in container for old sql server version #Workaround to lower the TLS level in container for old sql server version
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "NetworkResurrector.Agent.dll", "--console"] ENTRYPOINT ["dotnet", "NetworkResurrector.Api.dll", "--console"]

View File

@ -23,8 +23,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NetworkResurrector.Agent.Application\NetworkResurrector.Agent.Application.csproj" /> <ProjectReference Include="..\NetworkResurrector.Agent.Application\NetworkResurrector.Api.Application.csproj" />
<ProjectReference Include="..\NetworkResurrector.Agent.Domain.Data\NetworkResurrector.Agent.Domain.Data.csproj" /> <ProjectReference Include="..\NetworkResurrector.Agent.Domain.Data\NetworkResurrector.Api.Domain.Data.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -10,7 +10,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
namespace NetworkResurrector.Agent namespace NetworkResurrector.Api
{ {
public class Program public class Program
{ {

View File

@ -1,6 +1,6 @@
{ {
"profiles": { "profiles": {
"NetworkResurrector.Agent": { "NetworkResurrector.Api": {
"commandName": "Project", "commandName": "Project",
"applicationUrl": "http://localhost:5000", "applicationUrl": "http://localhost:5000",
"environmentVariables": { "environmentVariables": {

View File

@ -8,12 +8,12 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using NDB.Extensions.Swagger; using NDB.Extensions.Swagger;
using NDB.Security.Authentication.Identity; using NDB.Security.Authentication.Identity;
using NetworkResurrector.Agent.Application; using NetworkResurrector.Api.Application;
using NetworkResurrector.Agent.Domain.Data; using NetworkResurrector.Api.Domain.Data;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Reflection; using System.Reflection;
namespace NetworkResurrector.Agent namespace NetworkResurrector.Api
{ {
public class Startup public class Startup
{ {

View File

@ -31,15 +31,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B0C5F0C1-0BF
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "agent", "agent", "{43C78941-52E6-4AB8-9170-CC7C006E4784}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{43C78941-52E6-4AB8-9170-CC7C006E4784}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent", "NetworkResurrector.Agent\NetworkResurrector.Agent.csproj", "{E10CEE53-8167-446F-BFF3-B80725BB6C90}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Api", "NetworkResurrector.Agent\NetworkResurrector.Api.csproj", "{E10CEE53-8167-446F-BFF3-B80725BB6C90}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent.Application", "NetworkResurrector.Agent.Application\NetworkResurrector.Agent.Application.csproj", "{EE31B126-12EC-46B3-8FB4-AD5BCF14C029}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Api.Application", "NetworkResurrector.Agent.Application\NetworkResurrector.Api.Application.csproj", "{EE31B126-12EC-46B3-8FB4-AD5BCF14C029}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent.Domain", "NetworkResurrector.Agent.Domain\NetworkResurrector.Agent.Domain.csproj", "{885D5625-028A-4B35-8C89-7EF718BC6E34}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Api.Domain", "NetworkResurrector.Agent.Domain\NetworkResurrector.Api.Domain.csproj", "{885D5625-028A-4B35-8C89-7EF718BC6E34}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Agent.Domain.Data", "NetworkResurrector.Agent.Domain.Data\NetworkResurrector.Agent.Domain.Data.csproj", "{509767A7-D11C-4143-8D45-01E62DFC2C74}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetworkResurrector.Api.Domain.Data", "NetworkResurrector.Agent.Domain.Data\NetworkResurrector.Api.Domain.Data.csproj", "{509767A7-D11C-4143-8D45-01E62DFC2C74}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -21,7 +21,7 @@ Agent:
Create image: Create image:
--from solution folder: --from solution folder:
docker image build -t "network-resurrector-agent:1.0.0" -f "NetworkResurrector.Agent/Dockerfile" . docker image build -t "network-resurrector-agent:1.0.0" -f "NetworkResurrector.Api/Dockerfile" .
Run image: Run image:
docker run -p 5053:80 -it network-resurrector-agent:1.0.0 docker run -p 5053:80 -it network-resurrector-agent:1.0.0