Browse Source

Docker compose works

davidfowl/common-services
David Fowler 1 year ago
committed by Reuben Bond
parent
commit
d0c710ebdc
10 changed files with 30 additions and 51 deletions
  1. +2
    -7
      src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs
  2. +2
    -1
      src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.json
  3. +0
    -5
      src/Services/Catalog/Catalog.API/Program.cs
  4. +0
    -5
      src/Services/Identity/Identity.API/Program.cs
  5. +6
    -11
      src/Services/Ordering/Ordering.API/Program.cs
  6. +0
    -5
      src/Services/Ordering/Ordering.SignalrHub/Program.cs
  7. +0
    -5
      src/Services/Payment/Payment.API/Program.cs
  8. +10
    -0
      src/Services/Services.Common/CommonExtensions.cs
  9. +0
    -5
      src/Services/Webhooks/Webhooks.API/Program.cs
  10. +10
    -7
      src/docker-compose.override.yml

+ 2
- 7
src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs View File

@ -22,21 +22,16 @@ builder.Services.Configure<UrlsConfig>(builder.Configuration.GetSection("urls"))
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
app.UseHttpsRedirection();
app.UseCors("CorsPolicy");
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/", () => Results.Redirect("/swagger"));
app.MapControllers();
app.MapControllers().RequireCors("CorsPolicy");
await app.RunAsync();

+ 2
- 1
src/ApiGateways/Web.Bff.Shopping/aggregator/appsettings.json View File

@ -2,7 +2,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"System.Net.Http": "Warning"
}
},
"OpenApi": {


+ 0
- 5
src/Services/Catalog/Catalog.API/Program.cs View File

@ -16,11 +16,6 @@ builder.Services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>()
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
app.MapGet("/", () => Results.Redirect("/swagger"));


+ 0
- 5
src/Services/Identity/Identity.API/Program.cs View File

@ -40,11 +40,6 @@ builder.Services.AddTransient<IRedirectService, RedirectService>();
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
app.UseStaticFiles();


+ 6
- 11
src/Services/Ordering/Ordering.API/Program.cs View File

@ -33,20 +33,15 @@ services.AddScoped<IOrderRepository, OrderRepository>();
services.AddScoped<IRequestManager, RequestManager>();
// Add integration event handlers.
services.AddSingleton<IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>, GracePeriodConfirmedIntegrationEventHandler>();
services.AddSingleton<IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>, OrderPaymentFailedIntegrationEventHandler>();
services.AddSingleton<IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>, OrderPaymentSucceededIntegrationEventHandler>();
services.AddSingleton<IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>, OrderStockConfirmedIntegrationEventHandler>();
services.AddSingleton<IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>, OrderStockRejectedIntegrationEventHandler>();
services.AddSingleton<IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>, UserCheckoutAcceptedIntegrationEventHandler>();
services.AddTransient<IIntegrationEventHandler<GracePeriodConfirmedIntegrationEvent>, GracePeriodConfirmedIntegrationEventHandler>();
services.AddTransient<IIntegrationEventHandler<OrderPaymentFailedIntegrationEvent>, OrderPaymentFailedIntegrationEventHandler>();
services.AddTransient<IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>, OrderPaymentSucceededIntegrationEventHandler>();
services.AddTransient<IIntegrationEventHandler<OrderStockConfirmedIntegrationEvent>, OrderStockConfirmedIntegrationEventHandler>();
services.AddTransient<IIntegrationEventHandler<OrderStockRejectedIntegrationEvent>, OrderStockRejectedIntegrationEventHandler>();
services.AddTransient<IIntegrationEventHandler<UserCheckoutAcceptedIntegrationEvent>, UserCheckoutAcceptedIntegrationEventHandler>();
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
app.MapGet("/", () => Results.Redirect("/swagger"));


+ 0
- 5
src/Services/Ordering/Ordering.SignalrHub/Program.cs View File

@ -23,11 +23,6 @@ builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToSubmi
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
app.UseCors("CorsPolicy");


+ 0
- 5
src/Services/Payment/Payment.API/Program.cs View File

@ -8,11 +8,6 @@ builder.Services.AddTransient<OrderStatusChangedToStockConfirmedIntegrationEvent
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
var eventBus = app.Services.GetRequiredService<IEventBus>();


+ 10
- 0
src/Services/Services.Common/CommonExtensions.cs View File

@ -57,6 +57,16 @@ public static class CommonExtensions
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
app.UseRouting();
var identitySection = app.Configuration.GetSection("Identity");
if (identitySection.Exists())
{
// We have to add the auth middleware to the pipeline here
app.UseAuthentication();
app.UseAuthorization();
}
}
app.UseDefaultOpenApi(app.Configuration);


+ 0
- 5
src/Services/Webhooks/Webhooks.API/Program.cs View File

@ -19,11 +19,6 @@ builder.Services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>()
var app = builder.Build();
if (!await app.CheckHealthAsync())
{
return;
}
app.UseServiceDefaults();
app.MapGet("/", () => Results.Redirect("/swagger"));


+ 10
- 7
src/docker-compose.override.yml View File

@ -61,7 +61,9 @@ services:
basket-api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- Kestrel__Endpoints__HTTP__Url=http://0.0.0.0:80
- Kestrel__Endpoints__GRPC__Url=http://0.0.0.0:81
- Kestrel__Endpoints__GRPC__Protocols=Http2
- ConnectionStrings__Redis=${ESHOP_AZURE_REDIS_BASKET_DB:-basketdata}
- ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- Identity__Url=http://identity-api
@ -72,8 +74,6 @@ services:
- OrchestratorType=${ORCHESTRATOR_TYPE}
- UseLoadTest=${USE_LOADTEST:-False}
- PATH_BASE=/basket-api
- GRPC_PORT=81
- PORT=80
ports:
- "5103:80"
- "9103:81"
@ -81,6 +81,9 @@ services:
catalog-api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- Kestrel__Endpoints__HTTP__Url=http://0.0.0.0:80
- Kestrel__Endpoints__GRPC__Url=http://0.0.0.0:81
- Kestrel__Endpoints__GRPC__Protocols=Http2
- ConnectionStrings__CatalogDb=${ESHOP_AZURE_CATALOG_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true}
- ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- PicBaseUrl=${ESHOP_STORAGE_CATALOG_URL}
@ -92,8 +95,6 @@ services:
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE}
- GRPC_PORT=81
- PORT=80
- PATH_BASE=/catalog-api
ports:
- "5101:80"
@ -102,7 +103,9 @@ services:
ordering-api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- Kestrel__Endpoints__HTTP__Url=http://0.0.0.0:80
- Kestrel__Endpoints__GRPC__Url=http://0.0.0.0:81
- Kestrel__Endpoints__GRPC__Protocols=Http2
- ConnectionStrings__OrderingDb=${ESHOP_AZURE_ORDERING_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true}
- ConnectionStrings__EventBus=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- Identity__Url=http://identity-api
@ -284,7 +287,7 @@ services:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80
- PurchaseUrl=http://webshoppingapigw
- Identity__Url=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105
- SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202
- IdentityUrlHC=http://identity-api/hc
- UseCustomizationData=True


Loading…
Cancel
Save