(refactor): reimplementing docker compose
This commit is contained in:
parent
750263d466
commit
4b858008a9
3
.gitignore
vendored
3
.gitignore
vendored
@ -230,3 +230,6 @@ _Pvt_Extensions
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# Custom
|
||||
webapi/docker-compose
|
||||
@ -10,7 +10,7 @@
|
||||
},
|
||||
{
|
||||
"locale": 2,
|
||||
"slug": "predefinit",
|
||||
"slug": "predefinita",
|
||||
"text": "Categoria predefinita"
|
||||
}
|
||||
]
|
||||
|
||||
@ -23,7 +23,3 @@
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
build
|
||||
@ -7,7 +7,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Extensions\Extensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -7,9 +7,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Core.Enumerations {
|
||||
public class Errors : Enumeration {
|
||||
public static Errors NullOrWhiteSpace = new(0, "is null or white space");
|
||||
public static Errors WrongOrNotManaged = new(1, "is wrong or not managed");
|
||||
public static Errors NullOrEmpty = new(2, "is null or empty");
|
||||
public static Errors Generic = new(0, "generic error occured");
|
||||
|
||||
public static Errors NullOrWhiteSpace = new(1, "is null or white space");
|
||||
public static Errors WrongOrNotManaged = new(2, "is wrong or not managed");
|
||||
public static Errors NullOrEmpty = new(3, "is null or empty");
|
||||
|
||||
private Errors(int id, string displayName) : base(id, displayName) { }
|
||||
}
|
||||
|
||||
42
webapi/Core/Middlewares/ErrorHandlerMiddleware.cs
Normal file
42
webapi/Core/Middlewares/ErrorHandlerMiddleware.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Core.Enumerations;
|
||||
using ExtensionMethods;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Net;
|
||||
|
||||
namespace Core.Middlewares {
|
||||
|
||||
/// <summary>
|
||||
/// https://jasonwatmore.com/post/2022/01/17/net-6-global-error-handler-tutorial-with-example
|
||||
/// </summary>
|
||||
public class ErrorHandlerMiddleware {
|
||||
private readonly ILogger<ErrorHandlerMiddleware> _logger;
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public ErrorHandlerMiddleware(
|
||||
ILogger<ErrorHandlerMiddleware> logger,
|
||||
RequestDelegate next) {
|
||||
_logger = logger;
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext context) {
|
||||
try {
|
||||
await _next(context);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Unhandled error");
|
||||
|
||||
var response = context.Response;
|
||||
response.ContentType = "application/json";
|
||||
response.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||
|
||||
await response.WriteAsync(new ProblemDetails {
|
||||
Title = Errors.Generic.Name,
|
||||
Detail = $"{Errors.Generic.Id}"
|
||||
}.ToJson());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@ namespace DataProviders.Buckets {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SpecificBucketDataProviderBase : BucketDataProviderBase {
|
||||
public abstract class SpecificBucketDataProviderBase : BucketDataProviderBase {
|
||||
|
||||
private readonly string _bucketName;
|
||||
|
||||
|
||||
22
webapi/ReverseProxy/Dockerfile
Normal file
22
webapi/ReverseProxy/Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["ReverseProxy/ReverseProxy.csproj", "ReverseProxy/"]
|
||||
RUN dotnet restore "ReverseProxy/ReverseProxy.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/ReverseProxy"
|
||||
RUN dotnet build "ReverseProxy.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "ReverseProxy.csproj" -c Release -o /app/publish
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "ReverseProxy.dll"]
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
@ -10,12 +10,12 @@
|
||||
"profiles": {
|
||||
"ReverseProxy": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7174;http://localhost:5178",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"applicationUrl": "https://localhost:7174;http://localhost:5178",
|
||||
"dotnetRunMessages": true
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
@ -23,6 +23,13 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"publishAllPorts": true,
|
||||
"useSSL": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,9 +4,13 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<UserSecretsId>a3a6c5ea-054e-4e38-b7a4-800796fa0dd3</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
||||
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -25,6 +25,12 @@
|
||||
]
|
||||
},
|
||||
"route3": {
|
||||
"ClusterId": "cluster1",
|
||||
"Match": {
|
||||
"Path": "swagger/{**catchall}"
|
||||
}
|
||||
},
|
||||
"route4": {
|
||||
"ClusterId": "cluster2",
|
||||
"Match": {
|
||||
"Path": "{**catchall}"
|
||||
@ -35,7 +41,7 @@
|
||||
"cluster1": {
|
||||
"Destinations": {
|
||||
"destination1": {
|
||||
"Address": "https://localhost:7151/"
|
||||
"Address": "http://weatherforecast:5133/"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -15,8 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataProviders", "DataProviders\DataProviders.csproj", "{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}"
|
||||
EndProject
|
||||
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{38A28E4B-319A-44B0-AA9B-54F3F0362317}"
|
||||
EndProject
|
||||
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "ClientApp", "ClientApp\ClientApp.njsproj", "{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensions", "Extensions\Extensions.csproj", "{94A44D75-4AE2-4F1A-A7E9-821710B19F93}"
|
||||
@ -33,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileSecurityService", "Serv
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReverseProxy", "ReverseProxy\ReverseProxy.csproj", "{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}"
|
||||
EndProject
|
||||
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -59,10 +59,6 @@ Global
|
||||
{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{38A28E4B-319A-44B0-AA9B-54F3F0362317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{38A28E4B-319A-44B0-AA9B-54F3F0362317}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{38A28E4B-319A-44B0-AA9B-54F3F0362317}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38A28E4B-319A-44B0-AA9B-54F3F0362317}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -91,6 +87,10 @@ Global
|
||||
{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Models.Requests;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -40,4 +40,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,13 +6,12 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Authorize(Policy = "")]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlogItemController : ControllerBase {
|
||||
@ -57,6 +56,7 @@ namespace WeatherForecast.Controllers {
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _blogItemService.GetSlug(siteId, slug);
|
||||
@ -88,4 +88,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace WeatherForecast.Controllers;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Authorize(Policy = "")]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlogItemsController : ControllerBase {
|
||||
@ -37,6 +37,7 @@ public class BlogItemsController : ControllerBase {
|
||||
/// <param name="itemsPerPage"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale) {
|
||||
var result = _blogItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
|
||||
|
||||
@ -6,7 +6,7 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -88,4 +88,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ using DomainResults.Mvc;
|
||||
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -51,4 +51,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net.Http.Headers;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -72,4 +72,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -51,4 +51,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using WeatherForecast.Services;
|
||||
using DomainResults.Mvc;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -49,4 +49,3 @@ namespace WeatherForecast.Controllers {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Models.Requests;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -35,4 +36,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -80,4 +80,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ using DomainResults.Mvc;
|
||||
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -51,4 +51,3 @@ namespace WeatherForecast.Controllers {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -91,4 +91,4 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ using DomainResults.Mvc;
|
||||
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@ -54,4 +54,3 @@ namespace WeatherForecast.Controllers {
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,13 @@ EXPOSE 443
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["WeatherForecast/WeatherForecast.csproj", "WeatherForecast/"]
|
||||
COPY ["Services/FileSecurityService/FileSecurityService.csproj", "Services/FileSecurityService/"]
|
||||
COPY ["Extensions/Extensions.csproj", "Extensions/"]
|
||||
COPY ["Core/Core.csproj", "Core/"]
|
||||
COPY ["Services/ImageProvider/ImageProvider.csproj", "Services/ImageProvider/"]
|
||||
COPY ["DataProviders/DataProviders.csproj", "DataProviders/"]
|
||||
COPY ["Services/JWTService/JWTService.csproj", "Services/JWTService/"]
|
||||
COPY ["Services/HashService/HashService.csproj", "Services/HashService/"]
|
||||
RUN dotnet restore "WeatherForecast/WeatherForecast.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/WeatherForecast"
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"profiles": {
|
||||
"WeatherForecast": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
@ -21,7 +21,7 @@
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
@ -30,12 +30,9 @@
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
"useSSL": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ using FileSecurityService.Extensions;
|
||||
using ImageProvider.Extensions;
|
||||
using JWTService.Extensions;
|
||||
using HashService.Extensions;
|
||||
using Core.Middlewares;
|
||||
|
||||
namespace WeatherForecast {
|
||||
|
||||
@ -198,6 +199,9 @@ namespace WeatherForecast {
|
||||
// UseCors must be called before UseResponseCaching
|
||||
app.UseCors(MyAllowSpecificOrigins);
|
||||
|
||||
// global error handler
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
"Database": {
|
||||
"ConnectionString": "mongodb://localhost:27017"
|
||||
"ConnectionString": "mongodb://root:example@mongo:27017"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>38a28e4b-319a-44b0-aa9b-54f3f0362317</ProjectGuid>
|
||||
<ProjectGuid>7fc6f0ba-2dcb-4b53-a3b3-61ceef42b9d0</ProjectGuid>
|
||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
|
||||
<DockerServiceName>weatherforecast</DockerServiceName>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||
<DockerServiceName>reverseproxy</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="docker-compose.override.yml">
|
||||
|
||||
@ -1,12 +1,54 @@
|
||||
version: '3.4'
|
||||
|
||||
#services:
|
||||
# weatherforecast:
|
||||
# environment:
|
||||
# - ASPNETCORE_ENVIRONMENT=Development
|
||||
# - ASPNETCORE_URLS=https://+:443;http://+:80
|
||||
# ports:
|
||||
# - "80"
|
||||
# - "443"
|
||||
# volumes:
|
||||
# - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
networks:
|
||||
my-network:
|
||||
driver: "bridge"
|
||||
|
||||
services:
|
||||
reverseproxy:
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=https://+:7174;http://+:5178
|
||||
ports:
|
||||
- "7174:7174"
|
||||
- "5178:5178"
|
||||
volumes:
|
||||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
|
||||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
networks:
|
||||
- "my-network"
|
||||
|
||||
weatherforecast:
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=https://+:7151;http://+:5133
|
||||
volumes:
|
||||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
|
||||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
|
||||
networks:
|
||||
- "my-network"
|
||||
|
||||
mongo:
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27018:27017
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: example
|
||||
volumes:
|
||||
- ./docker-compose/mongo/data/db:/data/db
|
||||
networks:
|
||||
- "my-network"
|
||||
|
||||
mongo-express:
|
||||
image: mongo-express
|
||||
restart: always
|
||||
ports:
|
||||
- 8081:8081
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: example
|
||||
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
|
||||
networks:
|
||||
- "my-network"
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
clientapp:
|
||||
image: ${DOCKER_REGISTRY-}clientapp
|
||||
weatherforecast:
|
||||
image: ${DOCKER_REGISTRY-}weatherforecast
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ClientApp/Dockerfile
|
||||
dockerfile: WeatherForecast/Dockerfile
|
||||
reverseproxy:
|
||||
image: ${DOCKER_REGISTRY-}reverseproxy
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ReverseProxy/Dockerfile
|
||||
|
||||
|
||||
#weatherforecast:
|
||||
# image: ${DOCKER_REGISTRY-}weatherforecast
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: WeatherForecast/Dockerfile
|
||||
|
||||
11
webapi/launchSettings.json
Normal file
11
webapi/launchSettings.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Docker Compose": {
|
||||
"commandName": "DockerCompose",
|
||||
"commandVersion": "1.0",
|
||||
"serviceActions": {
|
||||
"weatherforecast": "StartDebugging"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user