Skip to content

Commit

Permalink
Merge pull request #11 from brunohbrito/dev
Browse files Browse the repository at this point in the history
ASP.NET Core 3.1
  • Loading branch information
brunobritodev committed Dec 6, 2019
2 parents 09eaca8 + 318b3b0 commit b546a46
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 69 deletions.
4 changes: 2 additions & 2 deletions api.dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["src/Backend/Jp.Api.Management/Jp.Api.Management.csproj", "Backend/Jp.Api.Management/"]
RUN dotnet restore "Backend/Jp.Api.Management/Jp.Api.Management.csproj"
Expand Down
6 changes: 6 additions & 0 deletions azure-pipelines.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .net core 3.1'
inputs:
packageType: 'sdk'
version: '3.1.100'

- task: DotNetCoreCLI@2
displayName: '.NET Core - Restore'
inputs:
Expand Down
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .net core 3.1'
inputs:
packageType: 'sdk'
version: '3.1.100'

- task: DotNetCoreCLI@2
displayName: '.NET Core - Restore'
inputs:
Expand Down
60 changes: 34 additions & 26 deletions build/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@ services:
#############################
# Server SSO
#############################
jpproject:
image: bhdebrito/jpproject-sso
jpproject-sso:
image: bhdebrito/jpproject-sso:3.1.0
container_name: jpproject-sso
ports:
- "5000:5000"
links:
- jpdatabase
depends_on:
- jpdatabase
environment:
ASPNETCORE_ENVIRONMENT: Development
ASPNETCORE_URLS: http://+:5000
ASPNETCORE_URLS: http://+:5001
CUSTOMCONNSTR_SSOConnection: "server=jpdatabase,port=3306;database=jpproject;user=jp;password=10203040"
ApplicationSettings:EnableExternalProviders: "false" # Because Auth url is http://jpproject (modified by host to point to 127.0.0.1), then Google and Facebook reject it.
ApplicationSettings:DatabaseType: MySql
Expand All @@ -39,46 +35,58 @@ services:
ApplicationSettings:DefaultEmail: bhdebrito@gmail.com
ApplicationSettings:UserManagementURL: http://localhost:4200
ApplicationSettings:IS4AdminUi: http://localhost:4300
ApplicationSettings:ResourceServerURL: http://localhost:5003
ApplicationSettings:ResourceServerURL: http://localhost:5002
CertificateOptions:Type: Temporary

# #############################
# # Management API
# #############################
#############################
# Management API
#############################
jpproject-api:
image: bhdebrito/jpproject-api
image: bhdebrito/jpproject-api:3.1.0
container_name: jpproject-api
ports:
- "5003:80"
depends_on:
- jpdatabase
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: http://+
CUSTOMCONNSTR_SSOConnection: "server=jpdatabase,port=3306;database=jpproject;user=jp;password=10203040"
ApplicationSettings:Authority: "http://jpproject:5000"
ApplicationSettings:Authority: "http://jpproject-sso:5001"
ApplicationSettings:DatabaseType: MySql

#############################
# User management UI
#############################
users:
container_name: users
image: bhdebrito/jpproject-user-management-ui
jpproject-users:
image: bhdebrito/jpproject-user-management-ui:3.0.2
container_name: jpproject-users
depends_on:
- jpproject-api
- jpproject
ports:
- 4200:80
- jpproject-sso

#############################
# Admin Ui
#############################
admin-ui:
container_name: admin-ui
image: bhdebrito/jpproject-admin-ui
jpproject-admin-ui:
image: bhdebrito/jpproject-admin-ui:3.0.2
container_name: jpproject-admin-ui
depends_on:
- jpproject-api
- jpproject
- jpproject-sso


#############################
# Reverse proxy
#############################
reverse-proxy:
image: bhdebrito/jpproject-reverse-proxy:3.1.0
container_name: jpproject-reverse-proxy
ports:
- 4300:80
- '5001:5001'
- '5002:5002'
- '4200:4200'
- '4300:4300'
depends_on:
- 'jpproject-api'
- 'jpproject-users'
- 'jpproject-sso'
- 'jpproject-admin-ui'
Binary file removed build/jpproject-docker.rar
Binary file not shown.
Binary file added build/jpproject-docker.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions nginx/nginx-cache.conf
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ http {
}
}

upstream jpproject-admin {
upstream jpproject-admin-ui {
least_conn;
# for LB scenarios
server jpproject-admin;
server jpproject-admin-ui;
#server jpproject-sso_02:80 max_fails=3 fail_timeout=30s;
}
server {
Expand All @@ -267,7 +267,7 @@ http {


location / {
proxy_pass http://jpproject-admin;
proxy_pass http://jpproject-admin-ui;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
Expand Down
23 changes: 12 additions & 11 deletions src/Backend/Jp.Api.Management/Jp.Api.Management.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>9c91d295-54c5-4d09-9bd6-fa56fb74011b</UserSecretsId>
<DockerTargetOS>Linux</DockerTargetOS>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand All @@ -12,23 +12,24 @@
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Hellang.Middleware.ProblemDetails" Version="3.1.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="JPProject.Admin.Application" Version="3.0.3" />
<PackageReference Include="JPProject.Admin.Database" Version="3.0.3" />
<PackageReference Include="JPProject.AspNet.Core" Version="3.0.3" />
<PackageReference Include="JPProject.Admin.Application" Version="3.1.0" />
<PackageReference Include="JPProject.Admin.Database" Version="3.1.0" />
<PackageReference Include="JPProject.AspNet.Core" Version="3.1.0" />
<PackageReference Include="JpProject.AspNetCore.PasswordHasher.Argon2" Version="3.0.1" />
<PackageReference Include="JPProject.Sso.Application" Version="3.0.3" />
<PackageReference Include="JPProject.Sso.Database" Version="3.0.3" />
<PackageReference Include="JPProject.Sso.Application" Version="3.1.0" />
<PackageReference Include="JPProject.Sso.Database" Version="3.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.1">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.10" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="3.0.4" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
Expand Down
6 changes: 6 additions & 0 deletions src/Backend/Jp.Api.Management/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5002"
},
"Docker": {
"commandName": "Docker",
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
16 changes: 8 additions & 8 deletions src/Frontend/Jp.UI.SSO/Jp.UI.SSO.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>aspnet-jpproject-04C6939F-E672-4E56-B4A5-5F064EB67F23</UserSecretsId>
<DockerTargetOS>Linux</DockerTargetOS>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand All @@ -14,16 +14,16 @@

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="JPProject.AspNet.Core" Version="3.0.3" />
<PackageReference Include="JPProject.AspNet.Core" Version="3.1.0" />
<PackageReference Include="JpProject.AspNetCore.PasswordHasher.Argon2" Version="3.0.1" />
<PackageReference Include="JPProject.Sso.Application" Version="3.0.3" />
<PackageReference Include="JPProject.Sso.Database" Version="3.0.3" />
<PackageReference Include="JPProject.Sso.Application" Version="3.1.0" />
<PackageReference Include="JPProject.Sso.Database" Version="3.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="3.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
<PackageReference Include="NWebsec.AspNetCore.Middleware" Version="2.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="3.0.4" />
Expand All @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.1">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
26 changes: 14 additions & 12 deletions src/Frontend/Jp.UI.SSO/Util/DbMigrationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,24 @@ public static async Task EnsureSeedData(IServiceScope serviceScope)

public static async Task EnsureSeedData(IServiceProvider serviceProvider)
{
using var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope();
using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
{
var env = scope.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
var ssoContext = scope.ServiceProvider.GetRequiredService<ApplicationSsoContext>();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<UserIdentity>>();
var roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();

var env = scope.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
var ssoContext = scope.ServiceProvider.GetRequiredService<ApplicationSsoContext>();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<UserIdentity>>();
var roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();
await DbHealthChecker.TestConnection(ssoContext);

await DbHealthChecker.TestConnection(ssoContext);
await ssoContext.Database.MigrateAsync();
scope.ServiceProvider.GetRequiredService<EventStoreContext>().Database.Migrate();

await ssoContext.Database.MigrateAsync();
scope.ServiceProvider.GetRequiredService<EventStoreContext>().Database.Migrate();

await EnsureSeedIdentityServerData(ssoContext, configuration);
await EnsureSeedIdentityData(userManager, roleManager, configuration);
await EnsureSeedGlobalConfigurationData(ssoContext, configuration, env);
await EnsureSeedIdentityServerData(ssoContext, configuration);
await EnsureSeedIdentityData(userManager, roleManager, configuration);
await EnsureSeedGlobalConfigurationData(ssoContext, configuration, env);
}
}

private static async Task EnsureSeedGlobalConfigurationData(ApplicationSsoContext context,
Expand Down
4 changes: 2 additions & 2 deletions sso.dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["src/Frontend/Jp.UI.SSO/Jp.UI.SSO.csproj", "Frontend/Jp.UI.SSO/"]
RUN dotnet restore "Frontend/Jp.UI.SSO/Jp.UI.SSO.csproj"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="28.4.1" />
<PackageReference Include="Bogus" Version="28.4.3" />
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="IdentityServer4.Contrib.AspNetCore.Testing" Version="3.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
Expand All @@ -22,7 +22,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Bogus.Tools.Analyzer" Version="28.4.1">
<PackageReference Include="Bogus.Tools.Analyzer" Version="28.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit b546a46

Please sign in to comment.