Compare commits

...

20 Commits

Author SHA1 Message Date
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
khwezi d3672a6db9 Merge pull request 'Encapsulated the cert string in a base 64 string' (#74) from cart into main
Reviewed-on: #74
2026-06-14 12:05:50 +02:00
Khwezi Mngoma 9cbde6e622 Encapsulated the cert string in a base 64 string
continuous-integration/drone/pr Build is passing
2026-06-14 12:05:21 +02:00
khwezi a8056e7a9a Merge pull request 'Refactored manifest' (#73) from cart into main
Reviewed-on: #73
2026-06-14 11:49:38 +02:00
Khwezi Mngoma 8ddf769fab Refactored manifest
continuous-integration/drone/pr Build is passing
2026-06-14 11:49:08 +02:00
khwezi 4458a1e189 Merge pull request 'Added data protection keys and cert encryption to them' (#72) from cart into main
Reviewed-on: #72
2026-06-14 11:33:32 +02:00
Khwezi Mngoma 44741d2162 Added data protection keys and cert encryption to them
continuous-integration/drone/pr Build is passing
2026-06-14 11:33:04 +02:00
khwezi 2aeeb7a240 Merge pull request 'Added data protection key persistance' (#71) from cart into main
Reviewed-on: #71
2026-06-13 23:51:54 +02:00
Khwezi Mngoma 5204816370 Added data protection key persistance
continuous-integration/drone/pr Build is passing
2026-06-13 23:51:21 +02:00
4 changed files with 87 additions and 25 deletions
+4 -2
View File
@@ -18,13 +18,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="LiteCharms.Features" Version="1.125.0" /> <PackageReference Include="LiteCharms.Features" Version="1.132.0" />
</ItemGroup> </ItemGroup>
<!-- UI --> <!-- UI -->
<ItemGroup> <ItemGroup>
<PackageReference Include="ANM.Blazored.Toast" Version="0.1.1" /> <PackageReference Include="ANM.Blazored.Toast" Version="0.1.1" />
<PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.125.0" /> <PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.132.0" />
<!-- Global Usings --> <!-- Global Usings -->
<Using Include="Blazored.Toast.Services" /> <Using Include="Blazored.Toast.Services" />
@@ -55,6 +55,8 @@
<Using Include="System.Globalization" /> <Using Include="System.Globalization" />
<Using Include="System.Security.Claims" /> <Using Include="System.Security.Claims" />
<Using Include="Microsoft.Extensions.Options" /> <Using Include="Microsoft.Extensions.Options" />
<Using Include="Microsoft.EntityFrameworkCore" />
<Using Include="Microsoft.AspNetCore.HttpOverrides" />
<Using Include="Microsoft.AspNetCore.Components.Authorization" /> <Using Include="Microsoft.AspNetCore.Components.Authorization" />
<Using Include="Microsoft.AspNetCore.Components.Routing" /> <Using Include="Microsoft.AspNetCore.Components.Routing" />
<Using Include="Microsoft.AspNetCore.Components.Web" /> <Using Include="Microsoft.AspNetCore.Components.Web" />
+38 -5
View File
@@ -2,26 +2,27 @@ using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator; using LiteCharms.Features.Mediator;
using LiteCharms.Features.MidrandBooks.Extensions; using LiteCharms.Features.MidrandBooks.Extensions;
using LiteCharms.Features.MidrandBooks.Payments; using LiteCharms.Features.MidrandBooks.Payments;
using Microsoft.AspNetCore.HttpOverrides; using LiteCharms.Features.Postgres;
using MidrandBookshop.Components; using MidrandBookshop.Components;
using System.Security.Cryptography.X509Certificates;
using static LiteCharms.Features.Extensions.Quartz; using static LiteCharms.Features.Extensions.Quartz;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAntiforgery();
builder.Services.AddRazorComponents() builder.Services.AddRazorComponents()
.AddInteractiveServerComponents(); .AddInteractiveServerComponents();
builder.AddMonitoring(); builder.AddMonitoring();
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddMediator();
builder.Services.AddLiteCharmsWebSecurity(builder.Configuration);
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>)); builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>)); builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
builder.Services.AddQuartzSchedulerClient(MidrandShopSchedulerName, builder.Configuration); builder.Services.AddQuartzSchedulerClient(MidrandShopSchedulerName, builder.Configuration);
builder.Services.AddMediator();
builder.Services.AddEmailServices(builder.Configuration); builder.Services.AddEmailServices(builder.Configuration);
builder.Services.AddEmailServiceBus(); builder.Services.AddEmailServiceBus();
@@ -29,10 +30,14 @@ builder.Services.AddHttpClient();
builder.Services.AddScoped<CartService>(); builder.Services.AddScoped<CartService>();
builder.Services.AddShopServices(includeLocalStorage: true); builder.Services.AddShopServices(includeLocalStorage: true);
builder.Services.AddHashServices(builder.Configuration); builder.Services.AddHashServices(builder.Configuration);
builder.Services.AddSecurityApiSdk(builder.Configuration);
builder.Services.AddPayfastServices(builder.Configuration); builder.Services.AddPayfastServices(builder.Configuration);
builder.Services.AddDataProtectionDatabase(builder.Configuration);
builder.Services.AddMidrandShopDatabase(builder.Configuration); builder.Services.AddMidrandShopDatabase(builder.Configuration);
builder.Services.AddSecurityApiSdk(builder.Configuration);
builder.Services.AddLiteCharmsWebSecurity(builder.Configuration);
builder.Services.AddMidrandShopPostgresHealthCheck(); builder.Services.AddMidrandShopPostgresHealthCheck();
builder.Services.AddMidrandShopQuartzHealthCheck(); builder.Services.AddMidrandShopQuartzHealthCheck();
builder.Services.AddHealthChecksSupport(builder.Configuration); builder.Services.AddHealthChecksSupport(builder.Configuration);
@@ -43,9 +48,37 @@ builder.Services.Configure<ForwardedHeadersOptions>(options =>
options.KnownProxies.Clear(); options.KnownProxies.Clear();
}); });
builder.WebHost.ConfigureKestrel(options =>
{
var certBase64 = builder.Configuration["DataProtection:Certificate"];
var certPassword = builder.Configuration["DataProtection:Password"];
if (!string.IsNullOrWhiteSpace(certBase64))
{
var rawBytes = Convert.FromBase64String(certBase64);
var kestrelCert = X509CertificateLoader.LoadPkcs12(rawBytes, certPassword);
options.ListenAnyIP(8443, listenOptions =>
{
listenOptions.UseHttps(kestrelCert);
});
}
else
options.ListenAnyIP(8080);
});
var app = builder.Build(); var app = builder.Build();
app.UseForwardedHeaders(); app.UseForwardedHeaders();
app.UseCookiePolicy();
using var security = app.Services.CreateScope();
{
var dataProtectionContext = security.ServiceProvider.GetRequiredService<DataProtectionDbContext>();
await dataProtectionContext.Database.MigrateAsync();
}
app.AddSecurityEndpoints(); app.AddSecurityEndpoints();
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>(); var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
@@ -14,7 +14,7 @@
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "https://localhost:7021;http://localhost:5053", "applicationUrl": "https://localhost:8440;http://localhost:8083",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
+44 -17
View File
@@ -10,8 +10,8 @@ metadata:
name: midrandbooks-config name: midrandbooks-config
namespace: midrandbooks-uat namespace: midrandbooks-uat
data: data:
ASPNETCORE_ENVIRONMENT: "Development" ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "http://0.0.0.0:8080" ASPNETCORE_URLS: "https://0.0.0.0:8443"
Monitoring__Address: "http://aspire-dashboard-service.aspire.svc.cluster.local:18889" Monitoring__Address: "http://aspire-dashboard-service.aspire.svc.cluster.local:18889"
Monitoring__ServiceName: "MidrandBooks.Uat" Monitoring__ServiceName: "MidrandBooks.Uat"
HasherSettings__MinHashLength: "11" HasherSettings__MinHashLength: "11"
@@ -27,7 +27,6 @@ data:
PayfastSettings__ValidHosts__4: "payment.payfast.io" PayfastSettings__ValidHosts__4: "payment.payfast.io"
LiteCharmsSettings__Authority: "https://sts.security.khongisa.co.za" LiteCharmsSettings__Authority: "https://sts.security.khongisa.co.za"
LiteCharmsSettings__Audience: "midrandbooks-api" LiteCharmsSettings__Audience: "midrandbooks-api"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
LiteCharmsClientSettings__Authority: "https://sts.security.khongisa.co.za" LiteCharmsClientSettings__Authority: "https://sts.security.khongisa.co.za"
LiteCharmsClientSettings__GrantType: "client_credentials" LiteCharmsClientSettings__GrantType: "client_credentials"
LiteCharmsClientSettings__Scope: "midrandbooks-api" LiteCharmsClientSettings__Scope: "midrandbooks-api"
@@ -40,6 +39,7 @@ metadata:
type: Opaque type: Opaque
data: data:
connection-string: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPW1pZHJhbmRzaG9wLWRldjtVc2VybmFtZT1taWRyYW5kc2hvcC1kZXYtdXNlcjtQYXNzd29yZD1hUFh5a0tnM3RTOWNtRDtQZXJzaXN0IFNlY3VyaXR5IEluZm89VHJ1ZQ== connection-string: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPW1pZHJhbmRzaG9wLWRldjtVc2VybmFtZT1taWRyYW5kc2hvcC1kZXYtdXNlcjtQYXNzd29yZD1hUFh5a0tnM3RTOWNtRDtQZXJzaXN0IFNlY3VyaXR5IEluZm89VHJ1ZQ==
dataprotection-connection-string: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPW1pZHJhbmRzaG9wLWRldjtVc2VybmFtZT1taWRyYW5kc2hvcC1kZXYtdXNlcjtQYXNzd29yZD1hUFh5a0tnM3RTOWNtRDtQZXJzaXN0IFNlY3VyaXR5IEluZm89VHJ1ZQ==
connection-string-quartz: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNjaGVkdWxlci1kZXY7VXNlcm5hbWU9c2NoZWR1bGVyLWRldi11c2VyO1Bhc3N3b3JkPWtWVm1vV0tKM3h6Z1FYO1BlcnNpc3QgU2VjdXJpdHkgSW5mbz1UcnVl connection-string-quartz: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNjaGVkdWxlci1kZXY7VXNlcm5hbWU9c2NoZWR1bGVyLWRldi11c2VyO1Bhc3N3b3JkPWtWVm1vV0tKM3h6Z1FYO1BlcnNpc3QgU2VjdXJpdHkgSW5mbz1UcnVl
aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw== aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw==
hasher-salt: VEdsbmFIUWdRMmhoY20xekxDQk5hV1J5WVc1a1FtOXZhM01nYldGclpTQnNiM1J6SUc5bUlHMXZibVY1SUdGdVpDQmhjbVVnWVNCemRXTmpaWE56Wm5Wc0lIWnBjbUZzSUhOMGIzSjVJR2x1SUZOdmRYUm9JRUZtY21sallRPT0= hasher-salt: VEdsbmFIUWdRMmhoY20xekxDQk5hV1J5WVc1a1FtOXZhM01nYldGclpTQnNiM1J6SUc5bUlHMXZibVY1SUdGdVpDQmhjbVVnWVNCemRXTmpaWE56Wm5Wc0lIWnBjbUZzSUhOMGIzSjVJR2x1SUZOdmRYUm9JRUZtY21sallRPT0=
@@ -52,6 +52,8 @@ data:
payfast-merchantkey: anU2bmF2bjBqY2JmMA== payfast-merchantkey: anU2bmF2bjBqY2JmMA==
litecharms-client-clientid: bWlkcmFuZGJvb2tzLWFwaS1zY2FsZXItdWF0 litecharms-client-clientid: bWlkcmFuZGJvb2tzLWFwaS1zY2FsZXItdWF0
litecharms-client-clientsecret: c2VjcmV0XzBhOGRjMWY5OTA2MTU5MGE1MmIxMjcyZGIzYTE4NzFkMjc2MWM3OWZiZDA1OGIyYTk2ODkxMTAyOWU0YjIwOGE= litecharms-client-clientsecret: c2VjcmV0XzBhOGRjMWY5OTA2MTU5MGE1MmIxMjcyZGIzYTE4NzFkMjc2MWM3OWZiZDA1OGIyYTk2ODkxMTAyOWU0YjIwOGE=
dataprotection-cert: TUlJS2dBSUJBekNDQ2pZR0NTcUdTSWIzRFFFSEFhQ0NDaWNFZ2dvak1JSUtIekNDQkZJR0NTcUdTSWIzRFFFSEJxQ0NCRU13Z2dRL0FnRUFNSUlFT0FZSktvWklodmNOQVFjQk1GY0dDU3FHU0liM0RRRUZEVEJLTUNrR0NTcUdTSWIzRFFFUkREUWEwZ0F3RUFBaUFCQURBTkJnbGdoa2dCWlFNRUFnRUZBQUFTb0VFS2Y2bE55USt1REU4ZjNCOWw5T3pGNG9mSmw5cUtkK3lKTTVBNXEy d0RBRUNIMXBPL2hVRXpsTkFnSUlBQT09
dataprotection-password: OWlIUSMmcl41eWZYRXc=
--- ---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
@@ -71,7 +73,7 @@ metadata:
name: midrandbooks name: midrandbooks
namespace: midrandbooks-uat namespace: midrandbooks-uat
spec: spec:
replicas: 2 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: midrandbooks app: midrandbooks
@@ -99,11 +101,21 @@ spec:
memory: "256Mi" memory: "256Mi"
cpu: "100m" cpu: "100m"
ports: ports:
- containerPort: 8080 - containerPort: 8443
envFrom: envFrom:
- configMapRef: - configMapRef:
name: midrandbooks-config name: midrandbooks-config
env: env:
- name: DataProtection__Certificate
valueFrom:
secretKeyRef:
name: midrandbooks-secrets
key: dataprotection-cert
- name: DataProtection__Password
valueFrom:
secretKeyRef:
name: midrandbooks-secrets
key: dataprotection-password
- name: LiteCharmsSettings__ClientId - name: LiteCharmsSettings__ClientId
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@@ -164,6 +176,11 @@ spec:
secretKeyRef: secretKeyRef:
name: midrandbooks-secrets name: midrandbooks-secrets
key: connection-string key: connection-string
- name: ConnectionStrings__PostgresDataProtection
valueFrom:
secretKeyRef:
name: midrandbooks-secrets
key: dataprotection-connection-string
- name: Monitoring__ApiKey - name: Monitoring__ApiKey
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@@ -172,23 +189,25 @@ spec:
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /app/wwwroot/content mountPath: /app/wwwroot/content
resources: subPath: bookshop-content
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health
port: 8080 port: 8443
scheme: HTTPS
initialDelaySeconds: 5 initialDelaySeconds: 5
periodSeconds: 10 periodSeconds: 10
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /health path: /health
port: 8080 port: 8443
scheme: HTTPS
initialDelaySeconds: 3 initialDelaySeconds: 3
periodSeconds: 5 periodSeconds: 5
volumes: volumes:
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:
claimName: midrandbooks-pvc claimName: midrandbooks-pvc
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@@ -196,14 +215,20 @@ metadata:
name: midrandbooks-service name: midrandbooks-service
namespace: midrandbooks-uat namespace: midrandbooks-uat
spec: spec:
type: ClusterIP ports:
- name: https
port: 443
targetPort: 8443
selector: selector:
app: midrandbooks app: midrandbooks
ports: ---
- name: http apiVersion: traefik.io/v1alpha1
protocol: TCP kind: ServersTransport
port: 80 metadata:
targetPort: 8080 name: midrandbooks-bypass-backend-validation
namespace: midrandbooks-uat
spec:
insecureSkipVerify: true
--- ---
apiVersion: traefik.io/v1alpha1 apiVersion: traefik.io/v1alpha1
kind: IngressRoute kind: IngressRoute
@@ -218,10 +243,12 @@ spec:
kind: Rule kind: Rule
services: services:
- name: midrandbooks-service - name: midrandbooks-service
port: 80 port: 443
scheme: https
serversTransport: midrandbooks-bypass-backend-validation
sticky: sticky:
cookie: cookie:
name: "lp-sticky-session" name: "lp-sticky-session"
httpOnly: true httpOnly: true
secure: true secure: true
tls: {} tls: {}