Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c36ff28a84 | |||
| 0c24613dd3 | |||
| 8bcd0f60c3 | |||
| 186c4b1e85 | |||
| 98f46b5e13 | |||
| 9d9cb3761a |
+4
-21
@@ -31,37 +31,20 @@ steps:
|
|||||||
registry: nexus.khongisa.co.za
|
registry: nexus.khongisa.co.za
|
||||||
repo: nexus.khongisa.co.za/litecharms-shop
|
repo: nexus.khongisa.co.za/litecharms-shop
|
||||||
tags: [ latest, "1.${DRONE_BUILD_NUMBER}" ]
|
tags: [ latest, "1.${DRONE_BUILD_NUMBER}" ]
|
||||||
custom_labels:
|
|
||||||
- org.opencontainers.image.source=https://gitea.khongisa.co.za/litecharms/litecharms-shop
|
|
||||||
- org.opencontainers.image.version=1.${DRONE_BUILD_NUMBER}
|
|
||||||
- org.opencontainers.image.revision=${DRONE_COMMIT_SHA}
|
|
||||||
username: { from_secret: docker_username }
|
username: { from_secret: docker_username }
|
||||||
password: { from_secret: docker_password }
|
password: { from_secret: docker_password }
|
||||||
|
|
||||||
- name: gitea-tag-release
|
- name: gitea-tag
|
||||||
image: alpine/git
|
image: alpine/git
|
||||||
environment:
|
environment:
|
||||||
GITEA_TOKEN: { from_secret: git_token }
|
|
||||||
GITEA_USER: { from_secret: git_username }
|
GITEA_USER: { from_secret: git_username }
|
||||||
GITEA_PASS: { from_secret: git_password }
|
GITEA_PASS: { from_secret: git_password }
|
||||||
commands:
|
commands:
|
||||||
- echo "169.255.58.144 gitea.khongisa.co.za" >> /etc/hosts
|
- git config --global user.email "drone@litecharms.co.za"
|
||||||
- apk add --no-cache curl
|
- git config --global user.name "Drone CI"
|
||||||
- git remote set-url origin https://$${GITEA_USER}:$${GITEA_PASS}@gitea.khongisa.co.za/litecharms/litecharmsshop.git
|
- git remote set-url origin https://$${GITEA_USER}:$${GITEA_PASS}@gitea.khongisa.co.za/litecharms/litecharmsshop.git
|
||||||
- git tag 1.${DRONE_BUILD_NUMBER}
|
- git tag 1.${DRONE_BUILD_NUMBER}
|
||||||
- git push origin 1.${DRONE_BUILD_NUMBER}
|
- git push origin 1.${DRONE_BUILD_NUMBER}
|
||||||
- |
|
|
||||||
curl -X POST "https://gitea.khongisa.co.za/api/v1/repos/litecharms/litecharmsshop/releases" \
|
|
||||||
-H "Authorization: token $${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"tag_name\": \"1.${DRONE_BUILD_NUMBER}\",
|
|
||||||
\"target_commitish\": \"${DRONE_COMMIT_SHA}\",
|
|
||||||
\"name\": \"Release 1.${DRONE_BUILD_NUMBER}\",
|
|
||||||
\"body\": \"### Artifacts\n* **Docker Image:** nexus.khongisa.co.za/litecharms-shop:1.${DRONE_BUILD_NUMBER}\n* **NuGet:** [View on Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\",
|
|
||||||
\"draft\": false,
|
|
||||||
\"prerelease\": false
|
|
||||||
}"
|
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build
|
- build
|
||||||
@@ -83,7 +66,6 @@ steps:
|
|||||||
- mkdir -p $HOME/.kube
|
- mkdir -p $HOME/.kube
|
||||||
- echo "$KUBE_CONFIG" > $HOME/.kube/config
|
- echo "$KUBE_CONFIG" > $HOME/.kube/config
|
||||||
- kubectl apply -f litecharms-shop-uat.yml
|
- kubectl apply -f litecharms-shop-uat.yml
|
||||||
- sleep 10
|
|
||||||
- kubectl rollout restart deployment/litecharms-shop -n litecharms-shop-uat
|
- kubectl rollout restart deployment/litecharms-shop -n litecharms-shop-uat
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -106,6 +88,7 @@ steps:
|
|||||||
- mkdir -p $HOME/.kube
|
- mkdir -p $HOME/.kube
|
||||||
- echo "$KUBE_CONFIG" > $HOME/.kube/config
|
- echo "$KUBE_CONFIG" > $HOME/.kube/config
|
||||||
- kubectl apply -f litecharms-shop.yml
|
- kubectl apply -f litecharms-shop.yml
|
||||||
|
- kubectl rollout restart shop/deployment/litecharms-shop -n litecharms-shop
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- uat
|
- uat
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
# LiteCharmsShop
|
|
||||||
|
|
||||||
The primary customer-facing web application for the LiteCharms platform.
|
|
||||||
|
|
||||||
## 🏗 Architecture
|
|
||||||
* **Type:** Kubernetes Deployment
|
|
||||||
* **Scale:** Horizontal scaling enabled via `replicas`.
|
|
||||||
* **Ingress:** Managed via `IngressRouter` for external traffic routing.
|
|
||||||
|
|
||||||
## 🚀 CI/CD Workflow
|
|
||||||
* **Trigger:** Pull Request to `master`.
|
|
||||||
* **Build:** Compiles .NET 10.0 source.
|
|
||||||
* **Containerize:** Docker image pushed to Nexus as `litecharms-scheduler:1.${DRONE_BUILD_NUMBER}`.
|
|
||||||
* **Deploy:** * Updates UAT via `kubectl apply`.
|
|
||||||
* Production deployment is triggered via **Promotion** to the `production` target.
|
|
||||||
|
|
||||||
## 🌐 Endpoints
|
|
||||||
* **UAT:** `https://uat-shop.khongisa.co.za` (Internal/VPN)
|
|
||||||
* **Monitoring:** Aspire Dashboard enabled via `Monitoring__Address`.
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
using LiteCharms.Features.Email.Events;
|
using LiteCharms.Features.Utilities.Commands;
|
||||||
using LiteCharms.Features.Email.Models;
|
using LiteCharms.Models;
|
||||||
using LiteCharms.Features.ServiceBus.Abstractions;
|
|
||||||
using static LiteCharms.Features.ServiceBus.Constants;
|
|
||||||
|
|
||||||
namespace Shop.Components.Pages;
|
namespace Shop.Components.Pages;
|
||||||
|
|
||||||
public partial class Contact([FromKeyedServices(EmailServiceBus)] IEventBus emailBus, IToastService toastService) : IDisposable
|
public partial class Contact(ISender mediator, IToastService toastService) : IDisposable
|
||||||
{
|
{
|
||||||
public CancellationTokenSource TokenSource { get; set; } = new();
|
public CancellationTokenSource TokenSource { get; set; } = new();
|
||||||
|
|
||||||
@@ -15,9 +13,10 @@ public partial class Contact([FromKeyedServices(EmailServiceBus)] IEventBus emai
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var notification = SendShopEmailEnquiryEvent.Create(Input.FullName!, Input.EmailAddress!, Input.EmailSubject!, Input.Message!);
|
var request = SendEmailCommand.Create(Input.EmailAddress!, Input.FullName!, "shop@litecharms.co.za",
|
||||||
|
"Khongisa Shop", Input.EmailSubject!, Input.Message!);
|
||||||
|
|
||||||
var result = await emailBus.PublishAsync(notification, TokenSource.Token);
|
var result = await mediator.Send(request, TokenSource.Token);
|
||||||
|
|
||||||
if (result.IsFailed)
|
if (result.IsFailed)
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-14
@@ -1,7 +1,6 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Extensions;
|
||||||
using LiteCharms.Features.Mediator;
|
|
||||||
using Shop.Components;
|
using Shop.Components;
|
||||||
using static LiteCharms.Features.Email.Extensions.Constants;
|
using static LiteCharms.Abstractions.Constants;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@@ -15,19 +14,12 @@ builder.Services.AddBlazoredToast();
|
|||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|
||||||
builder.Services.AddMediator();
|
builder.Services.AddMediator();
|
||||||
|
builder.Services.AddEmailServiceBus();
|
||||||
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
|
|
||||||
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
|
|
||||||
|
|
||||||
builder.Services.AddSalesServiceBus();
|
builder.Services.AddSalesServiceBus();
|
||||||
builder.Services.AddGeneralServiceBus();
|
builder.Services.AddGeneralServiceBus();
|
||||||
builder.Services.AddQuartzSchedulerClient(ShopSchedulerName, builder.Configuration);
|
|
||||||
|
|
||||||
builder.Services.AddEmailServices(builder.Configuration);
|
builder.Services.AddEmailServices(builder.Configuration);
|
||||||
builder.Services.AddEmailServiceBus();
|
builder.Services.AddLeadGeneratorDatabase(builder.Configuration);
|
||||||
|
builder.Services.AddQuartzSchedulerClient(LeadGeneratorSchedulerName, LeadGeneratorSchedulerInstanceId, builder.Configuration);
|
||||||
builder.Services.AddShopServices();
|
|
||||||
builder.Services.AddShopDatabase(builder.Configuration);
|
|
||||||
|
|
||||||
builder.Services.AddPostgresHealtchCheck();
|
builder.Services.AddPostgresHealtchCheck();
|
||||||
builder.Services.AddQuartzHealtchCheck();
|
builder.Services.AddQuartzHealtchCheck();
|
||||||
@@ -36,7 +28,7 @@ builder.Services.AddHealthChecksSupport(builder.Configuration);
|
|||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
|
var schedulerFactory = app.Services.GetRequiredService<ISchedulerFactory>();
|
||||||
var scheduler = await schedulerFactory.GetScheduler(ShopSchedulerName);
|
var scheduler = await schedulerFactory.GetScheduler(LeadGeneratorSchedulerName);
|
||||||
|
|
||||||
if (!scheduler!.IsStarted)
|
if (!scheduler!.IsStarted)
|
||||||
await scheduler.Start();
|
await scheduler.Start();
|
||||||
|
|||||||
+3
-1
@@ -17,7 +17,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="LiteCharms.Features" Version="1.32.0" />
|
<PackageReference Include="LiteCharms.Extensions" Version="1.11.0" />
|
||||||
|
<PackageReference Include="LiteCharms.Features" Version="1.11.0" />
|
||||||
|
<PackageReference Include="LiteCharms.Models" Version="1.11.0" />
|
||||||
<PackageReference Include="Polly" Version="8.6.6" />
|
<PackageReference Include="Polly" Version="8.6.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,7 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning",
|
"Microsoft.AspNetCore": "Warning"
|
||||||
"Microsoft.EntityFrameworkCore": "Error"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ metadata:
|
|||||||
namespace: litecharms-shop-uat
|
namespace: litecharms-shop-uat
|
||||||
type: Opaque
|
type: Opaque
|
||||||
data:
|
data:
|
||||||
connection-string: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNob3AtZGV2O1VzZXJuYW1lPXNob3AtZGV2LXVzZXI7UGFzc3dvcmQ9a1ZWbW9XS0ozeHpnUVg7UGVyc2lzdCBTZWN1cml0eSBJbmZvPVRydWU=
|
connection-string: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPWxlYWRnZW5lcmF0b3ItZGV2O1VzZXJuYW1lPWxlYWRnZW5lcmF0b3I7UGFzc3dvcmQ9S2VLNDRsczRQWHBuYms7UGVyc2lzdCBTZWN1cml0eSBJbmZvPVRydWU=
|
||||||
connection-string-quartz: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNjaGVkdWxlci1kZXY7VXNlcm5hbWU9c2NoZWR1bGVyLWRldi11c2VyO1Bhc3N3b3JkPWtWVm1vV0tKM3h6Z1FYO1BlcnNpc3QgU2VjdXJpdHkgSW5mbz1UcnVl
|
quartz-store: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNjaGVkdWxlci1kZXY7VXNlcm5hbWU9c2NoZWR1bGVyLWRldi11c2VyO1Bhc3N3b3JkPWtWVm1vV0tKM3h6Z1FYO1BlcnNpc3QgU2VjdXJpdHkgSW5mbz1UcnVl
|
||||||
aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw==
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
@@ -63,7 +62,6 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: shop
|
- name: shop
|
||||||
image: nexus.khongisa.co.za/litecharms-shop:latest
|
image: nexus.khongisa.co.za/litecharms-shop:latest
|
||||||
imagePullPolicy: Always
|
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: "512Mi"
|
memory: "512Mi"
|
||||||
@@ -81,12 +79,17 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: shop-secrets
|
name: shop-secrets
|
||||||
key: connection-string-quartz
|
key: quartz-store
|
||||||
- name: ConnectionStrings__PostgresShop
|
- name: ConnectionStrings__PostgresShop
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: shop-secrets
|
name: shop-secrets
|
||||||
key: connection-string
|
key: connection-string
|
||||||
|
- name: ConnectionStrings__DiscordShop
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: shop-secrets
|
||||||
|
key: discord-webhook
|
||||||
- name: Monitoring__Address
|
- name: Monitoring__Address
|
||||||
valueFrom:
|
valueFrom:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
|
|||||||
Reference in New Issue
Block a user