diff --git a/.gitignore b/.gitignore
index 8af19598..6bfcdcc1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -355,3 +355,5 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
+
+.angular
\ No newline at end of file
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Toolbar/Cart/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Toolbar/Cart/Default.cshtml
index 278186a5..9a1f82ac 100644
--- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Toolbar/Cart/Default.cshtml
+++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Toolbar/Cart/Default.cshtml
@@ -10,7 +10,7 @@
@if (Model == null)
{
- @L["Toolbar:BasketNotLoaded"]
+ @L["Toolbar:BasketNotLoaded"]
}
else
{
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs
index 3e915a38..16b4182e 100644
--- a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs
+++ b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs
@@ -305,7 +305,7 @@ public class EShopOnAbpPublicWebModule : AbpModule
app.UseAuthentication();
app.UseAbpSerilogEnrichers();
app.UseAuthorization();
- app.UseAnonymousUser();
+ // app.UseAnonymousUser();
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapReverseProxy();
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/UserBasketProvider.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/UserBasketProvider.cs
index a2af7272..41a1da88 100644
--- a/apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/UserBasketProvider.cs
+++ b/apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/UserBasketProvider.cs
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
using EShopOnAbp.BasketService.Services;
using EShopOnAbp.Shared.Hosting.AspNetCore;
using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
namespace EShopOnAbp.PublicWeb.ServiceProviders
@@ -13,34 +12,40 @@ namespace EShopOnAbp.PublicWeb.ServiceProviders
private HttpContext HttpContext => _httpContextAccessor.HttpContext;
private readonly IHttpContextAccessor _httpContextAccessor;
- private readonly ILogger _logger;
private readonly IBasketAppService _basketAppService;
public UserBasketProvider(
IHttpContextAccessor httpContextAccessor,
- ILogger logger,
IBasketAppService basketAppService)
{
_httpContextAccessor = httpContextAccessor;
- _logger = logger;
_basketAppService = basketAppService;
}
public virtual async Task GetBasketAsync()
{
- try
- {
- // Get anonymous user id from cookie
- HttpContext.Request.Cookies.TryGetValue(EShopConstants.AnonymousUserClaimName,
- out string anonymousUserId);
+ var anonymousUserId = await GetAnonymousUserId();
- return await _basketAppService.GetAsync(Guid.Parse(anonymousUserId));
- }
- catch (Exception ex)
+ return await _basketAppService.GetAsync(Guid.Parse(anonymousUserId));
+ }
+
+ // Get anonymous user id from cookie
+ private async Task GetAnonymousUserId()
+ {
+ HttpContext.Request.Cookies.TryGetValue(EShopConstants.AnonymousUserClaimName, out string anonymousUserId);
+ // Generate guid for anonymous user id and set to cookie for 14 days
+ if (string.IsNullOrEmpty(anonymousUserId))
{
- _logger.LogError(ex, ex.Message);
- return null;
+ anonymousUserId = Guid.NewGuid().ToString();
+ HttpContext.Response.Cookies.Append(EShopConstants.AnonymousUserClaimName, anonymousUserId,
+ new CookieOptions
+ {
+ SameSite = SameSiteMode.Lax,
+ Expires = DateTimeOffset.UtcNow.AddDays(14)
+ });
}
+
+ return anonymousUserId;
}
}
}
\ No newline at end of file
diff --git a/build/build-images-locally.sh b/build/build-images-locally.sh
index eb88272c..b83ce6cd 100755
--- a/build/build-images-locally.sh
+++ b/build/build-images-locally.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-export IMAGE_TAG="1.0.0"
+export IMAGE_TAG="1.1.0"
export total=12
cd ../
export currentFolder=`pwd`
diff --git a/etc/README.md b/etc/README.md
index dc53e542..7c3e8563 100644
--- a/etc/README.md
+++ b/etc/README.md
@@ -33,6 +33,18 @@ helm upgrade --install --version=4.0.19 ingress-nginx ingress-nginx/ingress-ngin
127.0.0.1 eshop-st-gateway-web
127.0.0.1 eshop-st-gateway-web-public
````
+Once Helm is set up properly, add the repo as follows:
+
+```console
+helm repo add eshoponabp https://abpframework.github.io/abp-charts/
+```
+You can then run `helm search repo eshoponabp` to see the charts.
+
+```console
+ helm install eshop-st eshoponabp/eshoponabp
+```
+
+OR
* Run `build-images.ps1` or `build-images.sh` in the `build` directory.
* Run `deploy-staging.ps1` or `deploy-staging.sh` in the `helm-chart` directory. It is deployed with the `eshop` namespace.
diff --git a/etc/k8s/azure/scripts/push-images-ghcr.sh b/etc/k8s/azure/scripts/push-images-ghcr.sh
index 513bd6af..0b22ecf2 100755
--- a/etc/k8s/azure/scripts/push-images-ghcr.sh
+++ b/etc/k8s/azure/scripts/push-images-ghcr.sh
@@ -1,4 +1,4 @@
-export version="1.0.0"
+export version="latest"
az acr login --name volocr
@@ -30,7 +30,7 @@ docker tag eshoponabp/service-catalog:"${version}" ghcr.io/volosoft/eshoponabp/s
docker push ghcr.io/volosoft/eshoponabp/service-catalog:"${version}"
docker tag eshoponabp/service-ordering:"${version}" ghcr.io/volosoft/eshoponabp/service-ordering:"${version}"
-docker push ghcr.io/volosoft/eshoponabp/service-ordering:"1.0.1"
+docker push ghcr.io/volosoft/eshoponabp/service-ordering:"${version}"
docker tag eshoponabp/service-cmskit:"${version}" ghcr.io/volosoft/eshoponabp/service-cmskit:"${version}"
docker push ghcr.io/volosoft/eshoponabp/service-cmskit:"${version}"
diff --git a/etc/k8s/azure/values.azure.yaml b/etc/k8s/azure/values.azure.yaml
index 83e53bd8..b1d5ca4f 100644
--- a/etc/k8s/azure/values.azure.yaml
+++ b/etc/k8s/azure/values.azure.yaml
@@ -14,6 +14,8 @@ authserver:
redisHost: eshop-az-redis
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
+ nodeSelector:
+ agentpool: demopool
ingress:
host: auth.eshoponabp.com
tlsSecret: eshop-wildcard-tls
@@ -32,6 +34,8 @@ web:
responseType: "code"
strictDiscoveryDocumentValidation: false
skipIssuerCheck: true
+ nodeSelector:
+ agentpool: demopool
ingress:
host: admin.eshoponabp.com
image:
@@ -52,7 +56,8 @@ public-web:
redisHost: eshop-az-redis
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
-
+ nodeSelector:
+ agentpool: demopool
ingress:
host: eshoponabp.com
image:
@@ -89,6 +94,8 @@ identity:
orderingServiceRootUrl: https://order.eshoponabp.com
cmskitServiceRootUrl: https://cmskit.eshoponabp.com
paymentServiceRootUrl: https://payment.eshoponabp.com
+ nodeSelector:
+ agentpool: demopool
ingress:
host: identity.eshoponabp.com
image:
@@ -115,7 +122,9 @@ administration:
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
synchedCommunication: # Used for server-to-server (client-credentials) communication with identityService for user permissions
- authority: https://auth.eshoponabp.com
+ authority: https://auth.eshoponabp.com
+ nodeSelector:
+ agentpool: demopool
ingress:
host: administration.eshoponabp.com
image:
@@ -137,6 +146,8 @@ gateway-web:
redisHost: eshop-az-redis
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
+ nodeSelector:
+ agentpool: demopool
ingress:
host: gateway.eshoponabp.com
image:
@@ -169,6 +180,8 @@ gateway-web-public:
redisHost: eshop-az-redis
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
+ nodeSelector:
+ agentpool: demopool
ingress:
host: gateway-public.eshoponabp.com
image:
@@ -211,6 +224,8 @@ basket:
remoteServices:
catalogBaseUrl: http://eshop-az-catalog:80
catalogGrpcUrl: http://eshop-az-catalog:81
+ nodeSelector:
+ agentpool: demopool
ingress:
host: basket.eshoponabp.com
image:
@@ -262,13 +277,14 @@ ordering:
redisHost: eshop-az-redis
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
+ nodeSelector:
+ agentpool: demopool
ingress:
host: order.eshoponabp.com
image:
repository: "ghcr.io/volosoft/eshoponabp/service-ordering"
tag: 1.0.1
-
-# cmskit-service sub-chart override
+
cmskit:
config:
selfUrl: https://cmskit.eshoponabp.com
@@ -312,6 +328,8 @@ payment:
redisHost: eshop-az-redis
rabbitmqHost: eshop-az-rabbitmq
elasticsearchHost: eshop-az-elasticsearch
+ nodeSelector:
+ agentpool: demopool
ingress:
host: payment.eshoponabp.com
image:
@@ -395,7 +413,8 @@ autoscaling:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
-nodeSelector: {}
+nodeSelector:
+ agentpool: demopool
tolerations: []
diff --git a/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml b/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml
index fc01540b..3be57fd2 100644
--- a/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml
+++ b/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml
@@ -31,8 +31,8 @@ spec:
name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume
spec:
accessModes: [ "ReadWriteOnce" ]
- storageClassName: "managed-premium-retain"
+ storageClassName: "managed-csi"
resources:
requests:
- storage: 32Gi
+ storage: 16Gi
{{- end }}
\ No newline at end of file
diff --git a/etc/k8s/eshoponabp/charts/mongodb/values.yaml b/etc/k8s/eshoponabp/charts/mongodb/values.yaml
index e69de29b..5e6dfe48 100644
--- a/etc/k8s/eshoponabp/charts/mongodb/values.yaml
+++ b/etc/k8s/eshoponabp/charts/mongodb/values.yaml
@@ -0,0 +1,2 @@
+nodeSelector:
+ agentpool: demopool
\ No newline at end of file
diff --git a/etc/k8s/eshoponabp/charts/postgres/templates/postgres-deployment.yaml b/etc/k8s/eshoponabp/charts/postgres/templates/postgres-deployment.yaml
index 50c455a6..a86da72b 100644
--- a/etc/k8s/eshoponabp/charts/postgres/templates/postgres-deployment.yaml
+++ b/etc/k8s/eshoponabp/charts/postgres/templates/postgres-deployment.yaml
@@ -34,8 +34,8 @@ spec:
name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume
spec:
accessModes: [ "ReadWriteOnce" ]
- storageClassName: "managed-premium-retain"
+ storageClassName: "managed-csi"
resources:
requests:
- storage: 32Gi
+ storage: 16Gi
{{- end }}
\ No newline at end of file
diff --git a/etc/k8s/eshoponabp/charts/postgres/values.yaml b/etc/k8s/eshoponabp/charts/postgres/values.yaml
index e69de29b..5e6dfe48 100644
--- a/etc/k8s/eshoponabp/charts/postgres/values.yaml
+++ b/etc/k8s/eshoponabp/charts/postgres/values.yaml
@@ -0,0 +1,2 @@
+nodeSelector:
+ agentpool: demopool
\ No newline at end of file
diff --git a/etc/k8s/eshoponabp/charts/rabbitmq/values.yaml b/etc/k8s/eshoponabp/charts/rabbitmq/values.yaml
index e69de29b..5e6dfe48 100644
--- a/etc/k8s/eshoponabp/charts/rabbitmq/values.yaml
+++ b/etc/k8s/eshoponabp/charts/rabbitmq/values.yaml
@@ -0,0 +1,2 @@
+nodeSelector:
+ agentpool: demopool
\ No newline at end of file
diff --git a/etc/k8s/eshoponabp/charts/redis/values.yaml b/etc/k8s/eshoponabp/charts/redis/values.yaml
index e69de29b..5e6dfe48 100644
--- a/etc/k8s/eshoponabp/charts/redis/values.yaml
+++ b/etc/k8s/eshoponabp/charts/redis/values.yaml
@@ -0,0 +1,2 @@
+nodeSelector:
+ agentpool: demopool
\ No newline at end of file
diff --git a/etc/k8s/eshoponabp/values.yaml b/etc/k8s/eshoponabp/values.yaml
index 786e7dbd..bf54e3b2 100644
--- a/etc/k8s/eshoponabp/values.yaml
+++ b/etc/k8s/eshoponabp/values.yaml
@@ -21,7 +21,7 @@ authserver:
tlsSecret: eshop-wildcard-tls
image:
repository: "ghcr.io/volosoft/eshoponabp/app-authserver"
- tag: 1.0.0
+ tag: latest
# web sub-chart override
web:
@@ -38,7 +38,7 @@ web:
host: eshop-st-web
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/app-web"
+ repository: "eshoponabp/app-web"
tag: 1.0.0
# public-web sub-chart override
@@ -59,7 +59,7 @@ public-web:
host: eshop-st-public-web
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/app-publicweb"
+ repository: "eshoponabp/app-publicweb"
tag: 1.0.0
# identity-service sub-chart override
@@ -96,7 +96,7 @@ identity:
host: eshop-st-identity
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/service-identity"
+ repository: "eshoponabp/service-identity"
tag: 1.0.0
# administration sub-chart override
@@ -124,7 +124,7 @@ administration:
host: eshop-st-administration
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/service-administration"
+ repository: "eshoponabp/service-administration"
tag: 1.0.0
# gateway-web sub-chart override
@@ -146,7 +146,7 @@ gateway-web:
host: eshop-st-gateway-web
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/gateway-web"
+ repository: "eshoponabp/gateway-web"
tag: 1.0.0
reRoutes:
accountService:
@@ -179,7 +179,7 @@ gateway-web-public:
host: eshop-st-gateway-web-public
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/gateway-web-public"
+ repository: "eshoponabp/gateway-web-public"
tag: 1.0.0
reRoutes:
accountService:
@@ -222,7 +222,7 @@ basket:
host: eshop-st-basket
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/service-basket"
+ repository: "eshoponabp/service-basket"
tag: 1.0.0
# catalog-service sub-chart override
@@ -251,7 +251,7 @@ catalog:
host: eshop-st-catalog
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/service-catalog"
+ repository: "eshoponabp/service-catalog"
tag: 1.0.0
# ordering-service sub-chart override
@@ -275,8 +275,8 @@ ordering:
host: eshop-st-ordering
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/service-ordering"
- tag: 1.0.1
+ repository: "eshoponabp/service-ordering"
+ tag: 1.0.0
# cmskit-service sub-chart override
cmskit:
@@ -327,7 +327,7 @@ payment:
host: eshop-st-payment
tlsSecret: eshop-wildcard-tls
image:
- repository: "ghcr.io/volosoft/eshoponabp/service-payment"
+ repository: "eshoponabp/service-payment"
tag: 1.0.0
# Default values for eshoponabp.
diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/Handlers/CustomerRoleCreationHandler.cs b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/Handlers/CustomerRoleCreationHandler.cs
new file mode 100644
index 00000000..07480c62
--- /dev/null
+++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/Handlers/CustomerRoleCreationHandler.cs
@@ -0,0 +1,29 @@
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities.Events.Distributed;
+using Volo.Abp.EventBus.Distributed;
+using Volo.Abp.Identity;
+using Volo.Abp.PermissionManagement;
+using Volo.Abp.Uow;
+
+namespace EShopOnAbp.AdministrationService.Handlers;
+
+public class CustomerRoleCreationHandler : IDistributedEventHandler>,
+ ITransientDependency
+{
+ private readonly IPermissionManager _permissionManager;
+ protected const string CustomerRole = "customer";
+ protected const string OrderPermission = "OrderingService.Orders";
+
+ public CustomerRoleCreationHandler(IPermissionManager permissionManager)
+ {
+ _permissionManager = permissionManager;
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
+ {
+ // Assign initial permissions for the customer role
+ await _permissionManager.SetForRoleAsync(CustomerRole, OrderPermission, true);
+ }
+}
\ No newline at end of file
diff --git a/services/identity/src/EShopOnAbp.IdentityService.Domain/IdentityServiceDbProperties.cs b/services/identity/src/EShopOnAbp.IdentityService.Domain/IdentityServiceDbProperties.cs
index 4a514392..44a481aa 100644
--- a/services/identity/src/EShopOnAbp.IdentityService.Domain/IdentityServiceDbProperties.cs
+++ b/services/identity/src/EShopOnAbp.IdentityService.Domain/IdentityServiceDbProperties.cs
@@ -11,5 +11,6 @@
public const string DefaultAdminEmailAddress = "admin@abp.io";
public const string DefaultAdminPassword = "1q2w3E*";
+ public const string CustomerRoleName = "customer";
}
}
diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityPublicRoleDataSeeder.cs b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityPublicRoleDataSeeder.cs
new file mode 100644
index 00000000..0ef2c65e
--- /dev/null
+++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityPublicRoleDataSeeder.cs
@@ -0,0 +1,51 @@
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Identity;
+using Volo.Abp.Data;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Guids;
+using Volo.Abp.Identity;
+using IdentityRole = Volo.Abp.Identity.IdentityRole;
+
+namespace EShopOnAbp.IdentityService.DbMigrations;
+
+public class IdentityPublicRoleDataSeeder : IDataSeedContributor, ITransientDependency
+{
+ private readonly IIdentityRoleRepository _roleRepository;
+ private readonly ILookupNormalizer _lookupNormalizer;
+ private readonly IGuidGenerator _guidGenerator;
+ private readonly IdentityRoleManager _roleManager;
+
+ public IdentityPublicRoleDataSeeder(
+ IIdentityRoleRepository roleRepository,
+ ILookupNormalizer lookupNormalizer,
+ IGuidGenerator guidGenerator,
+ IdentityRoleManager roleManager)
+ {
+ _roleRepository = roleRepository;
+ _lookupNormalizer = lookupNormalizer;
+ _guidGenerator = guidGenerator;
+ _roleManager = roleManager;
+ }
+
+ public async Task SeedAsync(DataSeedContext context)
+ {
+ await CreateCustomerRoleAsync();
+ }
+
+ private async Task CreateCustomerRoleAsync()
+ {
+ //"customer" role
+ var customerRole =
+ await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName(IdentityServiceDbProperties.CustomerRoleName));
+ if (customerRole == null)
+ {
+ customerRole = new IdentityRole(_guidGenerator.Create(), IdentityServiceDbProperties.CustomerRoleName)
+ {
+ IsStatic = true,
+ IsPublic = true
+ };
+
+ (await _roleManager.CreateAsync(customerRole)).CheckErrors();
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/Handlers/IdentityUserCreationHandler.cs b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/Handlers/IdentityUserCreationHandler.cs
new file mode 100644
index 00000000..fdcb33aa
--- /dev/null
+++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/Handlers/IdentityUserCreationHandler.cs
@@ -0,0 +1,29 @@
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities.Events.Distributed;
+using Volo.Abp.EventBus.Distributed;
+using Volo.Abp.Identity;
+using Volo.Abp.Uow;
+using Volo.Abp.Users;
+
+namespace EShopOnAbp.IdentityService.Handlers;
+
+public class IdentityUserCreationHandler : IDistributedEventHandler>, ITransientDependency
+{
+ private readonly IdentityUserManager _identityUserManager;
+
+ public IdentityUserCreationHandler(IdentityUserManager identityUserManager)
+ {
+ _identityUserManager = identityUserManager;
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
+ {
+ if (eventData.Entity.Email != IdentityServiceDbProperties.DefaultAdminEmailAddress)
+ {
+ var identityUser = await _identityUserManager.FindByIdAsync(eventData.Entity.Id.ToString());
+ await _identityUserManager.AddToRoleAsync(identityUser, IdentityServiceDbProperties.CustomerRoleName);
+ }
+ }
+}
\ No newline at end of file