Compare commits

...

24 Commits

Author SHA1 Message Date
khwezi 9de7abc3fb Merge pull request 'Refactored fowarded header config in app' (#86) from cart into main
Reviewed-on: #86
2026-06-15 00:26:27 +02:00
Khwezi Mngoma c6fc228c66 Refactored fowarded header config in app
continuous-integration/drone/pr Build is passing
2026-06-15 00:26:06 +02:00
khwezi e9b2e958d2 Merge pull request 'Removed invalid manifest field' (#85) from cart into main
Reviewed-on: #85
2026-06-15 00:05:49 +02:00
Khwezi Mngoma dc3dd4a40b Removed invalid manifest field
continuous-integration/drone/pr Build is passing
2026-06-15 00:05:22 +02:00
khwezi 44df489406 Merge pull request 'Refactored manifest' (#84) from cart into main
Reviewed-on: #84
2026-06-14 23:57:35 +02:00
Khwezi Mngoma 1bb1b0d476 Refactored manifest
continuous-integration/drone/pr Build is failing
2026-06-14 23:57:06 +02:00
khwezi 0ea31a33ae Merge pull request 'Updates app pipelining and cleaned up service registration' (#83) from cart into main
Reviewed-on: #83
2026-06-14 23:41:44 +02:00
Khwezi Mngoma 0bb5da3513 Updates app pipelining and cleaned up service registration
continuous-integration/drone/pr Build is passing
2026-06-14 23:40:47 +02:00
khwezi 4f44d0c597 Merge pull request 'Updated multi pod handling of sticky sessions' (#82) from cart into main
Reviewed-on: #82
2026-06-14 23:15:57 +02:00
Khwezi Mngoma c3e6f9801b Updated multi pod handling of sticky sessions
continuous-integration/drone/pr Build is passing
2026-06-14 23:14:41 +02:00
khwezi fbde2ea1a9 Merge pull request 'Updated handling of fowarded header and fixed base64 encoding of certificate' (#81) from cart into main
Reviewed-on: #81
2026-06-14 22:56:51 +02:00
Khwezi Mngoma d323bd866c Updated handling of fowarded header and fixed base64 encoding of certificate
continuous-integration/drone/pr Build is passing
2026-06-14 22:56:23 +02:00
khwezi 651682156c Merge pull request 'Moved kerstel definition to the service defitniton section' (#80) from cart into main
Reviewed-on: #80
2026-06-14 18:02:28 +02:00
Khwezi Mngoma a6a41eaeac Moved kerstel definition to the service defitniton section
continuous-integration/drone/pr Build is failing
2026-06-14 18:01:42 +02:00
khwezi e81789f8c6 Merge pull request 'Refactore the entire k8s manifest for pure https routing' (#79) from cart into main
Reviewed-on: #79
2026-06-14 17:49:17 +02:00
Khwezi Mngoma 17a74ca750 Refactore the entire k8s manifest for pure https routing
continuous-integration/drone/pr Build is failing
2026-06-14 17:48:39 +02:00
khwezi b9f3274633 Merge pull request 'Update cookie policies' (#78) from cart into main
Reviewed-on: #78
2026-06-14 13:16:05 +02:00
Khwezi Mngoma 53b3018d9e Update cookie policies
continuous-integration/drone/pr Build is passing
2026-06-14 13:15:30 +02:00
khwezi 552e9ff1b4 Merge pull request 'Updated cookie policies' (#77) from cart into main
Reviewed-on: #77
2026-06-14 12:56:36 +02:00
Khwezi Mngoma 8002920a07 Updated cookie policies
continuous-integration/drone/pr Build is passing
2026-06-14 12:56:09 +02:00
khwezi 629dbe7cfe Merge pull request 'Reordered service registration' (#76) from cart into main
Reviewed-on: #76
2026-06-14 12:45:01 +02:00
Khwezi Mngoma 285cb29867 Reordered service registration
continuous-integration/drone/pr Build is passing
2026-06-14 12:42:22 +02:00
khwezi 25acd67485 Merge pull request 'Refactored starup pipeline' (#75) from cart into main
Reviewed-on: #75
2026-06-14 12:23:55 +02:00
Khwezi Mngoma 596ab396a4 Refactored starup pipeline
continuous-integration/drone/pr Build is passing
2026-06-14 12:23:23 +02:00
5 changed files with 111 additions and 84 deletions
+3 -2
View File
@@ -18,13 +18,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="LiteCharms.Features" Version="1.130.0" />
<PackageReference Include="LiteCharms.Features" Version="1.135.0" />
</ItemGroup>
<!-- UI -->
<ItemGroup>
<PackageReference Include="ANM.Blazored.Toast" Version="0.1.1" />
<PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.130.0" />
<PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.135.0" />
<!-- Global Usings -->
<Using Include="Blazored.Toast.Services" />
@@ -62,6 +62,7 @@
<Using Include="Microsoft.AspNetCore.Components.Web" />
<Using Include="Microsoft.AspNetCore.WebUtilities" />
<Using Include="Microsoft.AspNetCore.Components" />
<Using Include="System.Security.Cryptography.X509Certificates" />
</ItemGroup>
</Project>
+25 -61
View File
@@ -1,87 +1,51 @@
using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator;
using LiteCharms.Features.MidrandBooks.Extensions;
using LiteCharms.Features.MidrandBooks.Payments;
using LiteCharms.Features.Postgres;
using MidrandBookshop;
using MidrandBookshop.Components;
using static LiteCharms.Features.Extensions.Quartz;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAntiforgery();
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.AddMonitoring();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
builder.Services.AddQuartzSchedulerClient(MidrandShopSchedulerName, builder.Configuration);
builder.Services.AddMediator();
builder.Services.AddEmailServices(builder.Configuration);
builder.Services.AddEmailServiceBus();
builder.Services.AddHttpClient();
builder.Services.AddScoped<CartService>();
builder.Services.AddShopServices(includeLocalStorage: true);
builder.Services.AddHashServices(builder.Configuration);
builder.Services.AddPayfastServices(builder.Configuration);
builder.Services.AddSecurityApiSdk(builder.Configuration);
builder.Services.AddLiteCharmsWebSecurity(builder.Configuration);
builder.Services.AddDataProtectionDatabase(builder.Configuration);
builder.Services.AddMidrandShopDatabase(builder.Configuration);
builder.Services.AddMidrandShopPostgresHealthCheck();
builder.Services.AddMidrandShopQuartzHealthCheck();
builder.Services.AddHealthChecksSupport(builder.Configuration);
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownProxies.Clear();
});
builder.Services.RegisterServices(builder.Configuration);
var app = builder.Build();
using var security = app.Services.CreateScope();
{
var dataProtectionContext = security.ServiceProvider.GetRequiredService<DataProtectionDbContext>();
await dataProtectionContext.Database.MigrateAsync();
}
app.UseForwardedHeaders();
app.AddSecurityEndpoints();
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
var scheduler = await schedulerFactory.GetScheduler(MidrandShopSchedulerName);
if (!scheduler!.IsStarted)
await scheduler.Start();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
}
app.UseForwardedHeaders();
app.UseHttpsRedirection();
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
app.UseHealthChecks("/health", new HealthCheckOptions
{
ResponseWriter = HealthChecks.UI.Client.UIResponseWriter.WriteHealthCheckUIResponse
});
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
app.UseHttpsRedirection();
app.UseAntiforgery();
app.MapStaticAssets();
app.UseCookiePolicy();
app.UseAuthentication();
app.UseAuthorization();
app.UseAntiforgery();
app.AddSecurityEndpoints();
using (var security = app.Services.CreateScope())
{
var dataProtectionContext = security.ServiceProvider.GetRequiredService<DataProtectionDbContext>();
await dataProtectionContext.Database.MigrateAsync();
}
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
var scheduler = await schedulerFactory.GetScheduler(MidrandShopSchedulerName);
if (!scheduler!.IsStarted) await scheduler.Start();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
@@ -14,7 +14,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7021;http://localhost:5053",
"applicationUrl": "https://localhost:8440;http://localhost:8083",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+58
View File
@@ -0,0 +1,58 @@
using LiteCharms.Features.Mediator;
using LiteCharms.Features.MidrandBooks.Payments;
using LiteCharms.Features.Extensions;
using LiteCharms.Features.MidrandBooks.Extensions;
using static LiteCharms.Features.Extensions.Quartz;
namespace MidrandBookshop;
public static class Setup
{
public static IServiceCollection RegisterServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddAntiforgery();
services.AddRazorComponents()
.AddInteractiveServerComponents();
services.AddEndpointsApiExplorer();
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
services.AddQuartzSchedulerClient(MidrandShopSchedulerName, configuration);
services.AddMediator();
services.AddEmailServices(configuration);
services.AddEmailServiceBus();
services.AddHttpClient();
services.AddScoped<CartService>();
services.AddShopServices(includeLocalStorage: true);
services.AddHashServices(configuration);
services.AddPayfastServices(configuration);
services.AddDataProtectionDatabase(configuration);
services.AddMidrandShopDatabase(configuration);
services.AddSecurityApiSdk(configuration);
services.AddLiteCharmsWebSecurity(configuration);
services.AddMidrandShopPostgresHealthCheck();
services.AddMidrandShopQuartzHealthCheck();
services.AddHealthChecksSupport(configuration);
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownProxies.Clear();
options.KnownIPNetworks.Clear();
options.ForwardLimit = null;
options.RequireHeaderSymmetry = false;
});
return services;
}
}
+24 -20
View File
@@ -10,8 +10,8 @@ metadata:
name: midrandbooks-config
namespace: midrandbooks-uat
data:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "http://0.0.0.0:8080"
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "http://0.0.0.0:8443"
Monitoring__Address: "http://aspire-dashboard-service.aspire.svc.cluster.local:18889"
Monitoring__ServiceName: "MidrandBooks.Uat"
HasherSettings__MinHashLength: "11"
@@ -27,7 +27,6 @@ data:
PayfastSettings__ValidHosts__4: "payment.payfast.io"
LiteCharmsSettings__Authority: "https://sts.security.khongisa.co.za"
LiteCharmsSettings__Audience: "midrandbooks-api"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
LiteCharmsClientSettings__Authority: "https://sts.security.khongisa.co.za"
LiteCharmsClientSettings__GrantType: "client_credentials"
LiteCharmsClientSettings__Scope: "midrandbooks-api"
@@ -74,7 +73,7 @@ metadata:
name: midrandbooks
namespace: midrandbooks-uat
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: midrandbooks
@@ -102,7 +101,7 @@ spec:
memory: "256Mi"
cpu: "100m"
ports:
- containerPort: 8080
- containerPort: 8443
envFrom:
- configMapRef:
name: midrandbooks-config
@@ -194,13 +193,15 @@ spec:
livenessProbe:
httpGet:
path: /health
port: 8080
port: 8443
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8080
port: 8443
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 5
volumes:
@@ -214,14 +215,20 @@ metadata:
name: midrandbooks-service
namespace: midrandbooks-uat
spec:
type: ClusterIP
ports:
- name: https
port: 443
targetPort: 8443
selector:
app: midrandbooks
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: traefik.io/v1alpha1
kind: ServersTransport
metadata:
name: midrandbooks-bypass-backend-validation
namespace: midrandbooks-uat
spec:
insecureSkipVerify: true
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
@@ -236,10 +243,7 @@ spec:
kind: Rule
services:
- name: midrandbooks-service
port: 80
sticky:
cookie:
name: "lp-sticky-session"
httpOnly: true
secure: true
tls: {}
port: 443
scheme: http
serversTransport: midrandbooks-bypass-backend-validation
tls: {}