Skip to content

Commit

Permalink
feat: .NET 5
Browse files Browse the repository at this point in the history
fix: database connection string
refactor: docker
fix: issue #1
fix: issue #2

BREAKING CHANGE: .NET 5
  • Loading branch information
brunobritodev committed Aug 2, 2021
1 parent 2347dac commit a50636d
Show file tree
Hide file tree
Showing 83 changed files with 1,218 additions and 395 deletions.
37 changes: 37 additions & 0 deletions .github/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".

# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

# This example catches duplicate Signed-off-by lines.

test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}
if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor|chk|merge)(\(.+?\))?: .{1,}$"; then
echo "Aborting commit. Your commit message is invalid. See some examples below:" >&2
echo "feat(logging): added logs for failed signups" >&2
echo "fix(homepage): fixed image gallery" >&2
echo "test(homepage): updated tests" >&2
echo "docs(readme): added new logging table information" >&2
echo "For more information check https://www.conventionalcommits.org/en/v1.0.0/ for more details" >&2
exit 1
fi
if ! head -1 "$1" | grep -qE "^.{1,50}$"; then
echo "Aborting commit. Your commit message is too long." >&2
exit 1
fi
92 changes: 46 additions & 46 deletions docker/nerdstore_producao.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ services:

rabbitmq:
image: rabbitmq:3-management
container_name: rabbit-nerdstore
container_name: rabbit-devstore
environment:
RABBITMQ_DEFAULT_USER: "nerdstore"
RABBITMQ_DEFAULT_PASS: "nerdstore"
RABBITMQ_DEFAULT_USER: "devstore"
RABBITMQ_DEFAULT_PASS: "devstore"

sql-server:
image: desenvolvedorio/nerdstore-sql-server:latest
container_name: nerdstore-sql-server
image: desenvolvedorio/devstore-sql-server:latest
container_name: devstore-sql-server
build:
context: ../sql
dockerfile: ./Dockerfile
Expand All @@ -20,11 +20,11 @@ services:
ACCEPT_EULA: "Y"

web-mvc:
image: desenvolvedorio/nerdstore-web-mvc-ecommerce:latest
#container_name: nerdstore-web-mvc-ecommerce
image: desenvolvedorio/devstore-web-mvc-ecommerce:latest
#container_name: devstore-web-mvc-ecommerce
build:
context: ../src
dockerfile: ./web/NSE.WebApp.MVC/Dockerfile
dockerfile: ./web/DevStore.WebApp.MVC/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
Expand All @@ -38,35 +38,35 @@ services:
- api-bff-compras

api-identidade:
image: desenvolvedorio/nerdstore-api-identidade:latest
container_name: nerdstore-api-identidade
image: desenvolvedorio/devstore-api-identidade:latest
container_name: devstore-api-identidade
build:
context: ../src
dockerfile: ./services/NSE.Identidade.API/Dockerfile
dockerfile: ./services/DevStore.Identidade.API/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55101;http://+55102
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
- rabbitmq
- sql-server

api-carrinho:
image: desenvolvedorio/nerdstore-api-carrinho:latest
container_name: nerdstore-api-carrinho
image: desenvolvedorio/devstore-api-carrinho:latest
container_name: devstore-api-carrinho
build:
context: ../src
dockerfile: ./services/NSE.Carrinho.API/Dockerfile
dockerfile: ./services/DevStore.Carrinho.API/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55201;http://+55202
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
Expand All @@ -75,35 +75,35 @@ services:
- sql-server

api-catalogo:
image: desenvolvedorio/nerdstore-api-catalogo:latest
container_name: nerdstore-api-catalogo
image: desenvolvedorio/devstore-api-catalogo:latest
container_name: devstore-api-catalogo
build:
context: ../src
dockerfile: ./services/NSE.Catalogo.API/Dockerfile
dockerfile: ./services/DevStore.Catalogo.API/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55301;http://+55302
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
- rabbitmq
- sql-server

api-cliente:
image: desenvolvedorio/nerdstore-api-cliente:latest
container_name: nerdstore-api-cliente
image: desenvolvedorio/devstore-api-cliente:latest
container_name: devstore-api-cliente
build:
context: ../src
dockerfile: ./services/NSE.Clientes.API/Dockerfile
dockerfile: ./services/DevStore.Clientes.API/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55401;http://+55402
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
Expand All @@ -112,17 +112,17 @@ services:
- sql-server

api-bff-compras:
image: desenvolvedorio/nerdstore-api-bff-compras:latest
container_name: nerdstore-api-bff-compras
image: desenvolvedorio/devstore-api-bff-compras:latest
container_name: devstore-api-bff-compras
build:
context: ../src
dockerfile: ./api gateways/NSE.Bff.Compras/Dockerfile
dockerfile: ./api gateways/DevStore.Bff.Compras/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55501;http://+55502
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
Expand All @@ -133,17 +133,17 @@ services:
- api-pedido

api-pagamento:
image: desenvolvedorio/nerdstore-api-pagamento:latest
container_name: nerdstore-api-pagamento
image: desenvolvedorio/devstore-api-pagamento:latest
container_name: devstore-api-pagamento
build:
context: ../src
dockerfile: ./services/NSE.Pagamentos.API/Dockerfile
dockerfile: ./services/DevStore.Pagamentos.API/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55601;http://+55602
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
Expand All @@ -153,27 +153,27 @@ services:
- sql-server

api-pedido:
image: desenvolvedorio/nerdstore-api-pedido:latest
container_name: nerdstore-api-pedido
image: desenvolvedorio/devstore-api-pedido:latest
container_name: devstore-api-pedido
build:
context: ../src
dockerfile: ./services/NSE.Pedidos.API/Dockerfile
dockerfile: ./services/DevStore.Pedidos.API/Dockerfile
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=https://+:55701;http://+55702
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
- ASPNETCORE_Kestrel__Certificates__Default__Password=devstore
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore-certificate.pfx
volumes:
- ./certs:/https:ro
depends_on:
- rabbitmq
- sql-server
- api-identidade

nerdstore-server:
image: desenvolvedorio/nerdstore-server:latest
container_name: nerdstore-server
devstore-server:
image: desenvolvedorio/devstore-server:latest
container_name: devstore-server
build:
context: ./
dockerfile: ./nginx/Dockerfile
Expand Down
Binary file not shown.
Binary file not shown.
18 changes: 9 additions & 9 deletions src/api gateways/DevStore.Bff.Compras/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["./api gateways/Thelema.Bff.Compras/Thelema.Bff.Compras.csproj", "api gateways/Thelema.Bff.Compras/"]
COPY ["./building blocks/Thelema.Core/Thelema.Core.csproj", "building blocks/Thelema.WebAPI.Core/"]
COPY ["./building blocks/Thelema.WebAPI.Core/Thelema.WebAPI.Core.csproj", "building blocks/Thelema.WebAPI.Core/"]
COPY ["./building blocks/Thelema.MessageBus/Thelema.MessageBus.csproj", "building blocks/Thelema.MessageBus/"]
COPY ["./api gateways/DevStore.Bff.Compras/DevStore.Bff.Compras.csproj", "api gateways/DevStore.Bff.Compras/"]
COPY ["./building blocks/DevStore.Core/DevStore.Core.csproj", "building blocks/DevStore.WebAPI.Core/"]
COPY ["./building blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building blocks/DevStore.WebAPI.Core/"]
COPY ["./building blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building blocks/DevStore.MessageBus/"]

RUN dotnet restore "api gateways/Thelema.Bff.Compras/Thelema.Bff.Compras.csproj"
RUN dotnet restore "api gateways/DevStore.Bff.Compras/DevStore.Bff.Compras.csproj"
COPY . .
WORKDIR "api gateways/Thelema.Bff.Compras"
RUN dotnet build "Thelema.Bff.Compras.csproj" -c Release -o /app/build
WORKDIR "api gateways/DevStore.Bff.Compras"
RUN dotnet build "DevStore.Bff.Compras.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Thelema.Bff.Compras.csproj" -c Release -o /app/publish
RUN dotnet publish "DevStore.Bff.Compras.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Thelema.Bff.Compras.dll"]
ENTRYPOINT ["dotnet", "DevStore.Bff.Compras.dll"]
Binary file modified src/api gateways/DevStore.Bff.Compras/Program.cs
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,7 @@
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS - Dev": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sqlDebugging": true,
"nativeDebugging": true
},
"IIS - Staging": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Staging"
}
},
"IIS - Prod": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"SelfHosting": {
"SelfHosting - Dev": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
}
},
"AllowedHosts": "*",
"CarrinhoUrl": "https://nerdstore-api-carrinho:5201",
"CatalogoUrl": "https://nerdstore-api-catalogo:5301",
"ClienteUrl": "https://nerdstore-api-cliente:5401",
"PagamentoUrl": "https://nerdstore-api-pagamento:5601",
"PedidoUrl": "https://nerdstore-api-pedido:5701",
"CarrinhoUrl": "https://devstore-api-carrinho:5201",
"CatalogoUrl": "https://devstore-api-catalogo:5301",
"ClienteUrl": "https://devstore-api-cliente:5401",
"PagamentoUrl": "https://devstore-api-pagamento:5601",
"PedidoUrl": "https://devstore-api-pedido:5701",

"MessageQueueConnection": {
"MessageBus": "host=rabbit-nerdstore:5672;publisherConfirms=true;timeout=30;username=nerdstore;password=nerdstore"
"MessageBus": "host=rabbit-devstore:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore"
},
"AppSettings": {
"AutenticacaoJwksUrl": "https://nerdstore-api-identidade:5101/jwks"
"AutenticacaoJwksUrl": "https://devstore-api-identidade:5101/jwks"
}
}
10 changes: 5 additions & 5 deletions src/building blocks/DevStore.Core/DevStore.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="FluentValidation" Version="9.4.0" />
<PackageReference Include="FluentValidation" Version="10.1.0" />
<PackageReference Include="mediatr" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.4" />
<PackageReference Include="NetDevPack" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="NetDevPack" Version="1.1.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Runtime.Serialization;

namespace DevStore.Core.Exceptions
{
[Serializable]
public class DatabaseNotFoundException : Exception
{
public DatabaseNotFoundException()
{
}

public DatabaseNotFoundException(string message)
: base(message)
{
}

public DatabaseNotFoundException(string message, Exception innerException)
: base(message, innerException)
{
}

// Without this constructor, deserialization will fail
protected DatabaseNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}


}
Binary file modified src/building blocks/DevStore.MessageBus/DevStore.MessageBus.csproj
Binary file not shown.
Loading

0 comments on commit a50636d

Please sign in to comment.