diff --git a/apps/angular/Dockerfile b/apps/angular/Dockerfile index 6912e62c..5f83f0de 100644 --- a/apps/angular/Dockerfile +++ b/apps/angular/Dockerfile @@ -1,3 +1,5 @@ FROM nginx:alpine WORKDIR /app -COPY dist/EShopOnAbp /usr/share/nginx/html \ No newline at end of file +COPY dist/EShopOnAbp /usr/share/nginx/html +COPY dynamic-env.json /usr/share/nginx/html +COPY /nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/apps/angular/dynamic-env.json b/apps/angular/dynamic-env.json new file mode 100644 index 00000000..1a1ff42a --- /dev/null +++ b/apps/angular/dynamic-env.json @@ -0,0 +1,21 @@ +{ + "production": true, + "application": { + "baseUrl":"https://eshop-st-web", + "name": "EShopOnAbp", + "logoUrl": "" + }, + "oAuthConfig": { + "issuer": "https://eshop-st-authserver", + "redirectUri": "https://eshop-st-web", + "clientId": "EShopOnAbp_App", + "responseType": "code", + "scope": "offline_access openid profile email phone IdentityService AdministrationService SaasService" + }, + "apis": { + "default": { + "url": "https://eshop-st-gateway-web", + "rootNamespace": "EShopOnAbp" + } + } +} \ No newline at end of file diff --git a/apps/angular/nginx.conf b/apps/angular/nginx.conf new file mode 100644 index 00000000..11f9847a --- /dev/null +++ b/apps/angular/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 80; + listen [::]:80; + server_name _; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html =404; + } + + location /getEnvConfig { + default_type 'application/json'; + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header 'Content-Type' 'application/json'; + try_files $uri /dynamic-env.json; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/apps/angular/src/environments/environment.prod.ts b/apps/angular/src/environments/environment.prod.ts index b5ede0c0..20653898 100644 --- a/apps/angular/src/environments/environment.prod.ts +++ b/apps/angular/src/environments/environment.prod.ts @@ -12,9 +12,9 @@ export const environment = { oAuthConfig: { issuer: 'https://localhost:44394', redirectUri: baseUrl, - clientId: 'EShopOnAbp_App', + clientId: 'Web', responseType: 'code', - scope: 'offline_access EShopOnAbp', + scope: 'offline_access openid profile email phone IdentityService AdministrationService SaasService', }, apis: { default: { @@ -22,4 +22,8 @@ export const environment = { rootNamespace: 'EShopOnAbp', }, }, + remoteEnv:{ + url: "/getEnvConfig", + mergeStrategy:'deepmerge' + } } as Environment; diff --git a/apps/angular/src/environments/environment.ts b/apps/angular/src/environments/environment.ts index 0e9fa789..d79f4a8e 100644 --- a/apps/angular/src/environments/environment.ts +++ b/apps/angular/src/environments/environment.ts @@ -11,7 +11,7 @@ export const environment = { oAuthConfig: { issuer: 'https://localhost:44330', redirectUri: baseUrl, - clientId: 'EShopOnAbp_Angular', + clientId: 'Web', responseType: 'code', scope: 'offline_access openid profile email phone IdentityService AdministrationService SaasService', diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj index 69cc41d1..074096a4 100644 --- a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj @@ -35,6 +35,10 @@ + + + Always + diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs index 726fcc96..71678fff 100644 --- a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs @@ -12,6 +12,11 @@ using StackExchange.Redis; using System; using System.IO; using System.Linq; +using System.Security.Cryptography.X509Certificates; +using IdentityServer4.Configuration; +using IdentityServer4.Extensions; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; using Volo.Abp; using Volo.Abp.Account; using Volo.Abp.Account.Web; @@ -23,6 +28,7 @@ using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.Emailing; using Volo.Abp.EventBus.RabbitMq; +using Volo.Abp.IdentityServer; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; using Volo.Abp.UI.Navigation.Urls; @@ -45,10 +51,50 @@ namespace EShopOnAbp.AuthServer )] public class EShopOnAbpAuthServerModule : AbpModule { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + var hostingEnvironment = context.Services.GetHostingEnvironment(); + + if (!hostingEnvironment.IsDevelopment()) + { + var configuration = context.Services.GetConfiguration(); + + PreConfigure(options => + { + options.AddDeveloperSigningCredential = false; + }); + + PreConfigure(builder => + { + builder.AddSigningCredential(GetSigningCertificate(hostingEnvironment, configuration)); + }); + } + } + + private X509Certificate2 GetSigningCertificate(IWebHostEnvironment hostingEnv, IConfiguration configuration) + { + var fileName = "eshoponabp-authserver.pfx"; + var passPhrase = "780F3C11-0A96-40DE-B335-9848BE88C77D"; + var file = Path.Combine(hostingEnv.ContentRootPath, fileName); + + if (!File.Exists(file)) + { + throw new FileNotFoundException($"Signing Certificate couldn't found: {file}"); + } + + return new X509Certificate2(file, passPhrase); + } + public override void ConfigureServices(ServiceConfigurationContext context) { + Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true; var hostingEnvironment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); + + Configure(options => + { + options.IssuerUri = configuration["App:SelfUrl"]; + }); Configure(options => { @@ -74,7 +120,8 @@ namespace EShopOnAbp.AuthServer var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); context.Services .AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys"); + .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys") + .SetApplicationName("eShopOnAbp-AuthServer"); context.Services.AddCors(options => { @@ -114,10 +161,16 @@ namespace EShopOnAbp.AuthServer var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); - app.Use((ctx, next) => + var configuration = context.ServiceProvider.GetRequiredService(); + + app.Use(async (ctx, next) => { - ctx.Request.Scheme = "https"; - return next(); + if (ctx.Request.Headers.ContainsKey("from-ingress")) + { + ctx.SetIdentityServerOrigin(configuration["App:SelfUrl"]); + } + + await next(); }); if (env.IsDevelopment()) diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/eshoponabp-authserver.pfx b/apps/auth-server/src/EShopOnAbp.AuthServer/eshoponabp-authserver.pfx new file mode 100644 index 00000000..3b0c5860 Binary files /dev/null and b/apps/auth-server/src/EShopOnAbp.AuthServer/eshoponabp-authserver.pfx differ diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs index 7da26e01..663505e7 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs @@ -55,6 +55,7 @@ namespace EShopOnAbp.PublicWeb public override void ConfigureServices(ServiceConfigurationContext context) { + Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true; var hostingEnvironment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); @@ -104,7 +105,8 @@ namespace EShopOnAbp.PublicWeb var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); context.Services .AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys"); + .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys") + .SetApplicationName("eShopOnAbp-PublicWeb"); Configure(options => { diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/appsettings.json b/apps/public-web/src/EShopOnAbp.PublicWeb/appsettings.json index bbc66d71..9d2fea29 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/appsettings.json +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/appsettings.json @@ -38,7 +38,7 @@ "AuthServer": { "Authority": "https://localhost:44330", "RequireHttpsMetadata": "true", - "ClientId": "EShopOnAbp_PublicWeb", + "ClientId": "PublicWeb", "ClientSecret": "1q2w3e*" } } \ No newline at end of file diff --git a/etc/k8s/README.md b/etc/k8s/README.md index e34481e5..96bc32bf 100644 --- a/etc/k8s/README.md +++ b/etc/k8s/README.md @@ -4,7 +4,7 @@ * Install [NGINX ingress](https://kubernetes.github.io/ingress-nginx/deploy/) for k8s OR * Install NGINX ingress using helm -``` +```powershell helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo update @@ -17,13 +17,16 @@ helm install ingress-nginx ingress-nginx/ingress-nginx * Add entries to the hosts file (in Windows: `C:\Windows\System32\drivers\etc\hosts`): -```` -127.0.0.1 eshoponabp-public-web -127.0.0.1 eshoponabp-authserver -127.0.0.1 eshoponabp-identity -127.0.0.1 eshoponabp-administration -127.0.0.1 eshoponabp-saas -127.0.0.1 eshoponabp-public-webgateway +````powershell +127.0.0.1 eshop-st-web +127.0.0.1 eshop-st-public-web +127.0.0.1 eshop-st-authserver +127.0.0.1 eshop-st-identity +127.0.0.1 eshop-st-administration +127.0.0.1 eshop-st-saas +127.0.0.1 eshop-st-gateway-web +127.0.0.1 eshop-st-gateway-public-web +127.0.0.1 eshop-st-gateway-internal ```` * Run `build-images.ps1` in the `scripts` directory. diff --git a/etc/k8s/deploy-staging.ps1 b/etc/k8s/deploy-staging.ps1 index ad6e28ce..cbdda161 100644 --- a/etc/k8s/deploy-staging.ps1 +++ b/etc/k8s/deploy-staging.ps1 @@ -1,3 +1,3 @@ param ($version='latest') -helm upgrade --install eshoponabp eshoponabp --namespace eshop --create-namespace --set global.eshoponabpImageVersion=$version \ No newline at end of file +helm upgrade --install es-st eshoponabp --namespace eshop --create-namespace --set global.eshoponabpImageVersion=$version \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/administration/values.yaml b/etc/k8s/eshoponabp/charts/administration/values.yaml index e69de29b..7f7eb7c5 100644 --- a/etc/k8s/eshoponabp/charts/administration/values.yaml +++ b/etc/k8s/eshoponabp/charts/administration/values.yaml @@ -0,0 +1,10 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-administration" + - name: "App__CorsOrigins" + value: "https://eshop-st-gateway-web,https://eshop-st-gateway-public-web,https://eshop-st-gateway-internal" + - name: "RemoteServices__Default__BaseUrl" + value: "https://eshop-st-gateway-internal/" + - name: "IdentityClients__IdentityClients__Authority" + value: "https://eshop-st-authserver" + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/authserver/templates/authserver.yaml b/etc/k8s/eshoponabp/charts/authserver/templates/authserver.yaml index e59d1c5a..80c14085 100644 --- a/etc/k8s/eshoponabp/charts/authserver/templates/authserver.yaml +++ b/etc/k8s/eshoponabp/charts/authserver/templates/authserver.yaml @@ -27,4 +27,8 @@ spec: - name: "ConnectionStrings__AdministrationService" value: {{ .Values.global.administrationService.connString }} - name: "ConnectionStrings__SaasService" - value: {{ .Values.global.saasService.connString }} \ No newline at end of file + value: {{ .Values.global.saasService.connString }} + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/authserver/values.yaml b/etc/k8s/eshoponabp/charts/authserver/values.yaml index e69de29b..1f7d9b61 100644 --- a/etc/k8s/eshoponabp/charts/authserver/values.yaml +++ b/etc/k8s/eshoponabp/charts/authserver/values.yaml @@ -0,0 +1,8 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-authserver" + - name: "App__CorsOrigins" + value: "https://eshop-st-identity,https://eshop-st-administration,https://eshop-st-saas" + - name: "App__RedirectAllowedUrls" + value: "http://localhost:4200" + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/consul/templates/consul-service.yaml b/etc/k8s/eshoponabp/charts/consul/templates/consul-service.yaml deleted file mode 100644 index 1af77696..00000000 --- a/etc/k8s/eshoponabp/charts/consul/templates/consul-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - name: {{ .Release.Name }}-{{ .Chart.Name }} - name: {{ .Release.Name }}-{{ .Chart.Name }} -spec: - type: ClusterIP - ports: - - name: consul-1 - protocol: TCP - port: 8500 - - name: consul-2 - protocol: TCP - port: 8600 - selector: - app: {{ .Release.Name }}-{{ .Chart.Name }} \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/consul/templates/consul.yaml b/etc/k8s/eshoponabp/charts/consul/templates/consul.yaml deleted file mode 100644 index cb1cc9e1..00000000 --- a/etc/k8s/eshoponabp/charts/consul/templates/consul.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ .Release.Name }}-{{ .Chart.Name }} -spec: - replicas: 1 - selector: - matchLabels: - app: {{ .Release.Name }}-{{ .Chart.Name }} - template: - metadata: - labels: - app: {{ .Release.Name }}-{{ .Chart.Name }} - spec: - containers: - - image: consul - name: {{ .Release.Name }}-{{ .Chart.Name }} - ports: - - name: consul-1 - protocol: TCP - containerPort: 8500 - - name: consul-2 - protocol: TCP - containerPort: 8600 \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/consul/values.yaml b/etc/k8s/eshoponabp/charts/consul/values.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/etc/k8s/eshoponabp/charts/gateway-internal/Chart.yaml b/etc/k8s/eshoponabp/charts/gateway-internal/Chart.yaml new file mode 100644 index 00000000..473c97b8 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-internal/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: gateway-internal +appVersion: "1.0" +description: eShopOnAbp Internal Web Gateway Application +version: 1.0.0 +type: application diff --git a/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-configmap.yaml b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-configmap.yaml new file mode 100644 index 00000000..815bb151 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-configmap.yaml @@ -0,0 +1,113 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap +data: + appsettings.json: |- + { + "Routes": [ + { + "ServiceKey": "Identity Service", + "DownstreamPathTemplate": "/api/identity/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-identity", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/identity/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Identity Service", + "DownstreamPathTemplate": "/api/account/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-identity", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/account/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Saas Service", + "DownstreamPathTemplate": "/api/saas/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-saas", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/saas/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/abp/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/abp/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/feature-management/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/feature-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/permission-management/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/permission-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/setting-management/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/setting-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Payment Service", + "DownstreamPathTemplate": "/api/payment/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-payment", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/payment/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }] + } \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-ingress.yaml b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-ingress.yaml new file mode 100644 index 00000000..b084df3b --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-ingress.yaml @@ -0,0 +1,37 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}" + nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}" +{{- if eq .Release.Name "es-az" }} + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" +{{- end }} + cert-manager.io/cluster-issuer: letsencrypt +spec: + tls: + - hosts: + - {{ .Values.global.gatewayInternal.domain }} +{{- if eq .Release.Name "es-az" }} + - {{ print "www." .Values.global.gatewayInternal.domain }} +{{- end }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls + rules: +{{- if eq .Release.Name "es-az" }} + - host: "{{ print "www." .Values.global.gatewayInternal.domain }}" +{{- else }} + - host: "{{ .Values.global.gatewayInternal.domain }}" +{{- end }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-{{ .Chart.Name }} + port: + number: 80 \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway-service.yaml b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-service.yaml similarity index 100% rename from etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway-service.yaml rename to etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal-service.yaml diff --git a/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal.yaml b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal.yaml new file mode 100644 index 00000000..9e81e9a9 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-internal/templates/gateway-internal.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + spec: + containers: + - image: {{ .Values.global.gatewayInternal.containerImage }}:{{ .Values.global.eshoponabpImageVersion }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} + name: {{ .Release.Name }}-{{ .Chart.Name }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + volumeMounts: + - name: config-volume + mountPath: /app/config + env: +{{ include "eshoponabp.global.env" . | indent 8 }} + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} + volumes: + - name: config-volume + configMap: + name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-internal/values.yaml b/etc/k8s/eshoponabp/charts/gateway-internal/values.yaml new file mode 100644 index 00000000..343d766e --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-internal/values.yaml @@ -0,0 +1,35 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-gateway-internal" + - name: "GlobalConfiguration__BaseUrl" + value: "http://eshop-st-gateway-internal" + - name: "Routes__0__DownstreamScheme" + value: "http" + - name: "Routes__0__DownstreamHostAndPorts__0__Host" + value: "eshop-st-identity" + - name: "Routes__0__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__1__DownstreamScheme" + value: "http" + - name: "Routes__1__DownstreamHostAndPorts__0__Host" + value: "eshop-st-identity" + - name: "Routes__1__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__2__DownstreamScheme" + value: "http" + - name: "Routes__2__DownstreamHostAndPorts__0__Host" + value: "eshop-st-saas" + - name: "Routes__2__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__3__DownstreamScheme" + value: "http" + - name: "Routes__3__DownstreamHostAndPorts__0__Host" + value: "eshop-st-administration" + - name: "Routes__3__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__4__DownstreamScheme" + value: "http" + - name: "Routes__4__DownstreamHostAndPorts__0__Host" + value: "eshop-st-administration" + - name: "Routes__4__DownstreamHostAndPorts__0__Port" + value: "80" \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/public-webgateway/Chart.yaml b/etc/k8s/eshoponabp/charts/gateway-public-web/Chart.yaml similarity index 70% rename from etc/k8s/eshoponabp/charts/public-webgateway/Chart.yaml rename to etc/k8s/eshoponabp/charts/gateway-public-web/Chart.yaml index b2cd0e01..e80e736d 100644 --- a/etc/k8s/eshoponabp/charts/public-webgateway/Chart.yaml +++ b/etc/k8s/eshoponabp/charts/gateway-public-web/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: public-webgateway +name: gateway-public-web appVersion: "1.0" description: eShopOnAbp Public Web Gateway Application version: 1.0.0 -type: application \ No newline at end of file +type: application diff --git a/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-configmap.yaml b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-configmap.yaml new file mode 100644 index 00000000..fe62f397 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-configmap.yaml @@ -0,0 +1,74 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap +data: + appsettings.json: |- + { + "Routes": [ + { + "ServiceKey": "Identity Service", + "DownstreamPathTemplate": "/api/account/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-identity", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/account/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/abp/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/abp/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Catalog Service", + "DownstreamPathTemplate": "/api/catalog/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-catalog", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/catalog/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Basket Service", + "DownstreamPathTemplate": "/api/basket/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-basket", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/basket/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Ordering Service", + "DownstreamPathTemplate": "/api/ordering/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-ordering", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/ordering/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }] + } \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-ingress.yaml b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-ingress.yaml new file mode 100644 index 00000000..b67aa230 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-ingress.yaml @@ -0,0 +1,37 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}" + nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}" +{{- if eq .Release.Name "es-az" }} + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" +{{- end }} + cert-manager.io/cluster-issuer: letsencrypt +spec: + tls: + - hosts: + - {{ .Values.global.gatewayPublicWeb.domain }} +{{- if eq .Release.Name "es-az" }} + - {{ print "www." .Values.global.gatewayPublicWeb.domain }} +{{- end }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls + rules: +{{- if eq .Release.Name "es-az" }} + - host: "{{ print "www." .Values.global.gatewayPublicWeb.domain }}" +{{- else }} + - host: "{{ .Values.global.gatewayPublicWeb.domain }}" +{{- end }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-{{ .Chart.Name }} + port: + number: 80 \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-service.yaml b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-service.yaml new file mode 100644 index 00000000..ee157c01 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + ports: + - name: "80" + port: 80 + - name: "443" + port: 443 + selector: + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web.yaml b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web.yaml new file mode 100644 index 00000000..9b465971 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-public-web/templates/gateway-public-web.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + spec: + containers: + - image: {{ .Values.global.gatewayPublicWeb.containerImage }}:{{ .Values.global.eshoponabpImageVersion }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} + name: {{ .Release.Name }}-{{ .Chart.Name }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + volumeMounts: + - name: config-volume + mountPath: /app/config + env: +{{ include "eshoponabp.global.env" . | indent 8 }} + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} + volumes: + - name: config-volume + configMap: + name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-public-web/values.yaml b/etc/k8s/eshoponabp/charts/gateway-public-web/values.yaml new file mode 100644 index 00000000..20d3d7bb --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-public-web/values.yaml @@ -0,0 +1,18 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-gateway-public-web" + - name: "GlobalConfiguration__BaseUrl" + value: "http://eshop-st-gateway-public-web" + - name: "Routes__0__DownstreamScheme" + value: "http" + - name: "Routes__0__DownstreamHostAndPorts__0__Host" + value: "eshop-st-identity" + - name: "Routes__0__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__1__DownstreamScheme" + value: "http" + - name: "Routes__1__DownstreamHostAndPorts__0__Host" + value: "eshop-st-administration" + - name: "Routes__1__DownstreamHostAndPorts__0__Port" + value: "80" + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/consul/Chart.yaml b/etc/k8s/eshoponabp/charts/gateway-web/Chart.yaml similarity index 50% rename from etc/k8s/eshoponabp/charts/consul/Chart.yaml rename to etc/k8s/eshoponabp/charts/gateway-web/Chart.yaml index ae174a63..d251efb7 100644 --- a/etc/k8s/eshoponabp/charts/consul/Chart.yaml +++ b/etc/k8s/eshoponabp/charts/gateway-web/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: consul +name: gateway-web appVersion: "1.0" -description: Runs Consul instance +description: eShopOnAbp Web Gateway Application version: 1.0.0 type: application diff --git a/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-configmap.yaml b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-configmap.yaml new file mode 100644 index 00000000..48931b6c --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-configmap.yaml @@ -0,0 +1,100 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap +data: + appsettings.json: |- + { + "Routes": [ + { + "ServiceKey": "Identity Service", + "DownstreamPathTemplate": "/api/identity/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-identity", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/identity/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Identity Service", + "DownstreamPathTemplate": "/api/account/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-identity", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/account/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Saas Service", + "DownstreamPathTemplate": "/api/saas/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-saas", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/saas/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/abp/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/abp/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/feature-management/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/feature-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/permission-management/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/permission-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/setting-management/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "eshop-st-administration", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/setting-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }] + } \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-ingress.yaml b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-ingress.yaml new file mode 100644 index 00000000..e1d4b1a4 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-ingress.yaml @@ -0,0 +1,37 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: "{{ .Values.global.nginxProxyBufferSize }}" + nginx.ingress.kubernetes.io/proxy-buffers-number: "{{ .Values.global.nginxProxyBuffersNumber }}" +{{- if eq .Release.Name "es-az" }} + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" +{{- end }} + cert-manager.io/cluster-issuer: letsencrypt +spec: + tls: + - hosts: + - {{ .Values.global.gatewayWeb.domain }} +{{- if eq .Release.Name "es-az" }} + - {{ print "www." .Values.global.gatewayWeb.domain }} +{{- end }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls + rules: +{{- if eq .Release.Name "es-az" }} + - host: "{{ print "www." .Values.global.gatewayWeb.domain }}" +{{- else }} + - host: "{{ .Values.global.gatewayWeb.domain }}" +{{- end }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ .Release.Name }}-{{ .Chart.Name }} + port: + number: 80 \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-service.yaml b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-service.yaml new file mode 100644 index 00000000..ee157c01 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + ports: + - name: "80" + port: 80 + - name: "443" + port: 443 + selector: + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web.yaml b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web.yaml new file mode 100644 index 00000000..47d90710 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-web/templates/gateway-web.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + spec: + containers: + - image: {{ .Values.global.gatewayWeb.containerImage }}:{{ .Values.global.eshoponabpImageVersion }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} + name: {{ .Release.Name }}-{{ .Chart.Name }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + volumeMounts: + - name: config-volume + mountPath: /app/config + env: +{{ include "eshoponabp.global.env" . | indent 8 }} + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} + volumes: + - name: config-volume + configMap: + name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/gateway-web/values.yaml b/etc/k8s/eshoponabp/charts/gateway-web/values.yaml new file mode 100644 index 00000000..d9e1898b --- /dev/null +++ b/etc/k8s/eshoponabp/charts/gateway-web/values.yaml @@ -0,0 +1,37 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-gateway-web" + - name: "App__CorsOrigins" + value: "https://eshop-st-web" + - name: "GlobalConfiguration__BaseUrl" + value: "http://eshop-st-gateway-web" + - name: "Routes__0__DownstreamScheme" + value: "http" + - name: "Routes__0__DownstreamHostAndPorts__0__Host" + value: "eshop-st-identity" + - name: "Routes__0__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__1__DownstreamScheme" + value: "http" + - name: "Routes__1__DownstreamHostAndPorts__0__Host" + value: "eshop-st-identity" + - name: "Routes__1__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__2__DownstreamScheme" + value: "http" + - name: "Routes__2__DownstreamHostAndPorts__0__Host" + value: "eshop-st-saas" + - name: "Routes__2__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__3__DownstreamScheme" + value: "http" + - name: "Routes__3__DownstreamHostAndPorts__0__Host" + value: "eshop-st-administration" + - name: "Routes__3__DownstreamHostAndPorts__0__Port" + value: "80" + - name: "Routes__4__DownstreamScheme" + value: "http" + - name: "Routes__4__DownstreamHostAndPorts__0__Host" + value: "eshop-st-administration" + - name: "Routes__4__DownstreamHostAndPorts__0__Port" + value: "80" \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/identity/templates/identity.yaml b/etc/k8s/eshoponabp/charts/identity/templates/identity.yaml index 89128bd8..a34773ed 100644 --- a/etc/k8s/eshoponabp/charts/identity/templates/identity.yaml +++ b/etc/k8s/eshoponabp/charts/identity/templates/identity.yaml @@ -28,4 +28,6 @@ spec: value: {{ .Values.global.administrationService.connString }} - name: "ConnectionStrings__SaasService" value: {{ .Values.global.saasService.connString }} - + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} diff --git a/etc/k8s/eshoponabp/charts/identity/values.yaml b/etc/k8s/eshoponabp/charts/identity/values.yaml index e69de29b..168e1bc5 100644 --- a/etc/k8s/eshoponabp/charts/identity/values.yaml +++ b/etc/k8s/eshoponabp/charts/identity/values.yaml @@ -0,0 +1,22 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-identity" + - name: "App__CorsOrigins" + value: "https://eshop-st-gateway-web,https://eshop-st-gateway-public-web,https://eshop-st-gateway-internal" + - name: "IdentityServerClients__Web__RootUrl" + value: "https://eshop-st-web/" + - name: "IdentityServerClients__PublicWeb__RootUrl" + value: "https://eshop-st-public-web/" + - name: "IdentityServerClients__IdentityService__RootUrl" + value: "https://eshop-st-identity/" + - name: "IdentityServerClients__SaasService__RootUrl" + value: "https://eshop-st-saas/" + - name: "IdentityServerClients__AdministrationService__RootUrl" + value: "https://eshop-st-administration/" + - name: "IdentityServerClients__InternalGateway__RootUrl" + value: "https://eshop-st-gateway-internal/" + - name: "IdentityServerClients__PublicWebGateway__RootUrl" + value: "https://eshop-st-gateway-public-web/" + - name: "IdentityServerClients__WebGateway__RootUrl" + value: "https://eshop-st-gateway-web/" + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/public-web/templates/public-web.yaml b/etc/k8s/eshoponabp/charts/public-web/templates/public-web.yaml index 8e688a21..0f39e988 100644 --- a/etc/k8s/eshoponabp/charts/public-web/templates/public-web.yaml +++ b/etc/k8s/eshoponabp/charts/public-web/templates/public-web.yaml @@ -22,5 +22,6 @@ spec: containerPort: 443 env: {{ include "eshoponabp.global.env" . | indent 8 }} - - name: "RemoteServices__Default__BaseUrl" - value: {{ .Values.global.publicWeb.remoteServiceUrl }} \ No newline at end of file + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/public-web/values.yaml b/etc/k8s/eshoponabp/charts/public-web/values.yaml index e69de29b..4c7f7c88 100644 --- a/etc/k8s/eshoponabp/charts/public-web/values.yaml +++ b/etc/k8s/eshoponabp/charts/public-web/values.yaml @@ -0,0 +1,6 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-public-web" + - name: "RemoteServices__Default__BaseUrl" + value: "http://eshop-st-gateway-public-web/" + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/public-webgateway/values.yaml b/etc/k8s/eshoponabp/charts/public-webgateway/values.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/etc/k8s/eshoponabp/charts/saas/templates/saas-ingress.yaml b/etc/k8s/eshoponabp/charts/saas/templates/saas-ingress.yaml index 3e8002eb..7dcfc3ec 100644 --- a/etc/k8s/eshoponabp/charts/saas/templates/saas-ingress.yaml +++ b/etc/k8s/eshoponabp/charts/saas/templates/saas-ingress.yaml @@ -12,10 +12,10 @@ metadata: spec: tls: - hosts: - - {{ .Values.global.identityService.domain }} + - {{ .Values.global.saasService.domain }} secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: - - host: "{{ .Values.global.identityService.domain }}" + - host: "{{ .Values.global.saasService.domain }}" http: paths: - path: / diff --git a/etc/k8s/eshoponabp/charts/saas/templates/saas.yaml b/etc/k8s/eshoponabp/charts/saas/templates/saas.yaml index 58845209..0ee5dd34 100644 --- a/etc/k8s/eshoponabp/charts/saas/templates/saas.yaml +++ b/etc/k8s/eshoponabp/charts/saas/templates/saas.yaml @@ -25,5 +25,8 @@ spec: - name: "ConnectionStrings__AdministrationService" value: {{ .Values.global.administrationService.connString }} - name: "ConnectionStrings__SaasService" - value: {{ .Values.global.saasService.connString }} + value: {{ .Values.global.saasService.connString }} + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} diff --git a/etc/k8s/eshoponabp/charts/saas/values.yaml b/etc/k8s/eshoponabp/charts/saas/values.yaml index e69de29b..94682c50 100644 --- a/etc/k8s/eshoponabp/charts/saas/values.yaml +++ b/etc/k8s/eshoponabp/charts/saas/values.yaml @@ -0,0 +1,6 @@ + env: + - name: "App__SelfUrl" + value: "https://eshop-st-saas" + - name: "App__CorsOrigins" + value: "https://eshop-st-gateway-web,https://eshop-st-gateway-public-web,https://eshop-st-gateway-internal" + \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/sqlserver/templates/sqlserver.yaml b/etc/k8s/eshoponabp/charts/sqlserver/templates/sqlserver.yaml index 57a5bcac..dfe41eb8 100644 --- a/etc/k8s/eshoponabp/charts/sqlserver/templates/sqlserver.yaml +++ b/etc/k8s/eshoponabp/charts/sqlserver/templates/sqlserver.yaml @@ -16,7 +16,7 @@ spec: containers: - image: mcr.microsoft.com/mssql/server name: {{ .Release.Name }}-{{ .Chart.Name }} -{{- if eq .Release.Name "eh-az" }} +{{- if eq .Release.Name "es-az" }} volumeMounts: - mountPath: "/var/opt/mssql" name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume @@ -30,7 +30,7 @@ spec: value: "myPassw@rd" - name: ACCEPT_EULA value: "Y" -{{- if eq .Release.Name "eh-az" }} +{{- if eq .Release.Name "es-az" }} volumeClaimTemplates: - metadata: name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume diff --git a/etc/k8s/eshoponabp/charts/web/Chart.yaml b/etc/k8s/eshoponabp/charts/web/Chart.yaml new file mode 100644 index 00000000..3a66440f --- /dev/null +++ b/etc/k8s/eshoponabp/charts/web/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: web +appVersion: "1.0" +description: eShopOnAbp BackOffice Web Application +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway-ingress.yaml b/etc/k8s/eshoponabp/charts/web/templates/web-ingress.yaml similarity index 78% rename from etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway-ingress.yaml rename to etc/k8s/eshoponabp/charts/web/templates/web-ingress.yaml index 0a24b78c..59748ad2 100644 --- a/etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway-ingress.yaml +++ b/etc/k8s/eshoponabp/charts/web/templates/web-ingress.yaml @@ -15,16 +15,16 @@ metadata: spec: tls: - hosts: - - {{ .Values.global.publicWebGateway.domain }} + - {{ .Values.global.web.domain }} {{- if eq .Release.Name "eh-az" }} - - {{ print "www." .Values.global.publicWebGateway.domain }} + - {{ print "www." .Values.global.web.domain }} {{- end }} secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: {{- if eq .Release.Name "eh-az" }} - - host: "{{ print "www." .Values.global.publicWebGateway.domain }}" + - host: "{{ print "www." .Values.global.web.domain }}" {{- else }} - - host: "{{ .Values.global.publicWebGateway.domain }}" + - host: "{{ .Values.global.web.domain }}" {{- end }} http: paths: diff --git a/etc/k8s/eshoponabp/charts/web/templates/web-service.yaml b/etc/k8s/eshoponabp/charts/web/templates/web-service.yaml new file mode 100644 index 00000000..ee157c01 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/web/templates/web-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + ports: + - name: "80" + port: 80 + - name: "443" + port: 443 + selector: + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway.yaml b/etc/k8s/eshoponabp/charts/web/templates/web.yaml similarity index 76% rename from etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway.yaml rename to etc/k8s/eshoponabp/charts/web/templates/web.yaml index 470e520d..da0d1103 100644 --- a/etc/k8s/eshoponabp/charts/public-webgateway/templates/public-webgateway.yaml +++ b/etc/k8s/eshoponabp/charts/web/templates/web.yaml @@ -12,7 +12,7 @@ spec: app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - - image: {{ .Values.global.publicWebGateway.containerImage }}:{{ .Values.global.eshoponabpImageVersion }} + - image: {{ .Values.global.web.containerImage }}:{{ .Values.global.eshoponabpImageVersion }} imagePullPolicy: {{ .Values.global.imagePullPolicy }} name: {{ .Release.Name }}-{{ .Chart.Name }} ports: @@ -22,3 +22,6 @@ spec: containerPort: 443 env: {{ include "eshoponabp.global.env" . | indent 8 }} + {{- if .Values.env }} +{{ toYaml .Values.env | indent 8 }} + {{- end }} \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/web/values.yaml b/etc/k8s/eshoponabp/charts/web/values.yaml new file mode 100644 index 00000000..d09efec5 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/web/values.yaml @@ -0,0 +1,3 @@ + env: + - name: "BASE_URL" + value: "https://eshop-st-web" \ No newline at end of file diff --git a/etc/k8s/eshoponabp/templates/_helpers.tpl b/etc/k8s/eshoponabp/templates/_helpers.tpl index c9dd2693..140c753f 100644 --- a/etc/k8s/eshoponabp/templates/_helpers.tpl +++ b/etc/k8s/eshoponabp/templates/_helpers.tpl @@ -64,8 +64,6 @@ Create the name of the service account to use {{- define "eshoponabp.global.env" -}} - name: "DOTNET_ENVIRONMENT" value: "{{ .Values.global.dotnetEnvironment }}" -- name: "AppUrls__ApiInternal" - value: "{{ .Values.global.apiUrlInternal }}" - name: "Redis__Configuration" value: "{{ .Values.global.redisConfiguration }}" - name: "AuthServer__Authority" @@ -76,6 +74,6 @@ Create the name of the service account to use value: "{{ .Values.global.stringEncryptionDefaultPassPhrase }}" - name: "RabbitMQ__Connections__Default__HostName" value: "{{ .Values.global.rabbitMqHostName }}" -- name: "Consul__Host" - value: "{{ .Values.global.consulHostname }}" +- name: "ElasticSearch__Url" + value: "{{ .Values.global.elasticSearchUrl }}" {{- end }} diff --git a/etc/k8s/eshoponabp/values.yaml b/etc/k8s/eshoponabp/values.yaml index 16d8a212..23160090 100644 --- a/etc/k8s/eshoponabp/values.yaml +++ b/etc/k8s/eshoponabp/values.yaml @@ -10,8 +10,8 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: "" -administration: - env: +# administration: + # env: # - name: "ADMIN_SPECIFIC_ENV_NAME" # value: "ADMIN_SPECIFIC_ENV_VALUE" @@ -90,39 +90,50 @@ global: dotnetEnvironment: "Staging" imagePullPolicy: Never eshoponabpImageVersion: latest + web: + domain: eshop-st-web + url: https://eshop-st-web + containerImage: "eshoponabp/app-web" publicWeb: - domain: eshoponabp-public-web - url: https://eshoponabp-public-web + domain: eshop-st-public-web + url: https://eshop-st-public-web containerImage: "eshoponabp/app-publicweb" - remoteServiceUrl: http://eshoponabp-public-webgateway authServer: - domain: eshoponabp-authserver - url: https://eshoponabp-authserver + domain: eshop-st-authserver + url: https://eshop-st-authserver containerImage: "eshoponabp/app-authserver" identityService: - domain: eshoponabp-identity - url: https://eshoponabp-identity + domain: eshop-st-identity + url: https://eshop-st-identity containerImage: "eshoponabp/service-identity" - connString: "Server=eshoponabp-sqldb,1433;Database=EShopOnAbp_Identity;User Id=sa;password=myPassw@rd;MultipleActiveResultSets=true" + connString: "Server=es-st-sqldb,1433;Database=EShopOnAbp_Identity;User Id=sa;password=myPassw@rd;MultipleActiveResultSets=true" administrationService: - domain: eshoponabp-administration - url: https://eshoponabp-administration + domain: eshop-st-administration + url: https://eshop-st-administration containerImage: "eshoponabp/service-administration" - connString: "Server=eshoponabp-sqldb,1433;Database=EShopOnAbp_Administration;User Id=sa;password=myPassw@rd;MultipleActiveResultSets=true" + connString: "Server=es-st-sqldb,1433;Database=EShopOnAbp_Administration;User Id=sa;password=myPassw@rd;MultipleActiveResultSets=true" saasService: - domain: eshoponabp-saas - url: https://eshoponabp-saas + domain: eshop-st-saas + url: https://eshop-st-saas containerImage: "eshoponabp/service-saas" - connString: "Server=eshoponabp-sqldb,1433;Database=EShopOnAbp_Saas;User Id=sa;password=myPassw@rd;MultipleActiveResultSets=true" - publicWebGateway: - domain: eshoponabp-public-webgateway - url: https://eshoponabp-public-webgateway + connString: "Server=es-st-sqldb,1433;Database=EShopOnAbp_Saas;User Id=sa;password=myPassw@rd;MultipleActiveResultSets=true" + gatewayWeb: + domain: eshop-st-gateway-web + url: https://eshop-st-gateway-web + containerImage: "eshoponabp/gateway-web" + gatewayPublicWeb: + domain: eshop-st-gateway-public-web + url: https://eshop-st-gateway-public-web containerImage: "eshoponabp/gateway-publicweb" - redisConfiguration: "eshoponabp-redis" - rabbitMqHostName: "eshoponabp-rabbitmq" - consulHostname: "http://eshoponabp-consul" + gatewayInternal: + domain: eshop-st-gateway-internal + url: https://eshop-st-gateway-internal + containerImage: "eshoponabp/gateway-internal" + redisConfiguration: "es-st-redis" + rabbitMqHostName: "es-st-rabbitmq" + elasticSearchUrl: "" nginxProxyBufferSize: "32k" nginxProxyBuffersNumber: "8" - internalAuthServerAuthority: "http://eshoponabp-authserver" + internalAuthServerAuthority: "http://eshop-st-authserver" internalAuthServerRequireHttpsMetadata: "false" stringEncryptionDefaultPassPhrase: "gsKnGZ041HLL4IM8" \ No newline at end of file diff --git a/etc/scripts/build-images.ps1 b/etc/scripts/build-images.ps1 index 4e5b07f6..2118c03c 100644 --- a/etc/scripts/build-images.ps1 +++ b/etc/scripts/build-images.ps1 @@ -18,7 +18,8 @@ $saasServiceFolder = Join-Path $slnFolder "services/saas/src/EShopOnAbp.SaasServ Write-Host "*** BUILDING WEB (WWW) ****************" -ForegroundColor Green Set-Location $webAppFolder yarn -ng build --prod +# ng build --prod +npm run build:prod docker build -t eshoponabp/app-web:$version . ### AUTH-SERVER diff --git a/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs b/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs index d1d65f16..5dfd16b0 100644 --- a/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs +++ b/gateways/internal/src/EShopOnAbp.InternalGateway/EShopOnAbpInternalGatewayModule.cs @@ -45,6 +45,10 @@ namespace EShopOnAbp.InternalGateway { var url = $"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; + if (!env.IsDevelopment()) + { + url = $"https://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}"; + } options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); diff --git a/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json b/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json index 8c6acb10..fe44a29e 100644 --- a/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json +++ b/gateways/internal/src/EShopOnAbp.InternalGateway/appsettings.json @@ -61,7 +61,12 @@ } ], "UpstreamPathTemplate": "/api/abp/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 5, + "DurationOfBreak": 3000, + "TimeoutValue": 2500 + } }, { "ServiceKey": "Administration Service", diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs index cf71cce0..ec322373 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs @@ -45,6 +45,10 @@ namespace EShopOnAbp.WebPublicGateway { var url = $"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; + if (!env.IsDevelopment()) + { + url = $"https://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}"; + } options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs index cd7274fa..7e4b70f7 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs @@ -37,7 +37,7 @@ namespace EShopOnAbp.WebPublicGateway Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration(build => { - build.AddJsonFile("appsettings.secrets.json", optional: true); + build.AddJsonFile("appsettings.secrets.json", optional: true, reloadOnChange:true); }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }) .UseAutofac() diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json index 312cbe61..fceda57f 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json @@ -42,7 +42,12 @@ } ], "UpstreamPathTemplate": "/api/abp/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 3, + "DurationOfBreak": 3000, + "TimeoutValue": 2500 + } }, { "ServiceKey": "Catalog Service", diff --git a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs index 119ed7b5..977948c6 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs +++ b/gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs @@ -48,6 +48,10 @@ namespace EShopOnAbp.WebGateway { var url = $"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; + if (!env.IsDevelopment()) + { + url = $"https://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}"; + } options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); diff --git a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json index 13fb37e6..e7b9ea22 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json +++ b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json @@ -68,7 +68,12 @@ } ], "UpstreamPathTemplate": "/api/abp/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 3, + "DurationOfBreak": 5000, + "TimeoutValue": 2500 + } }, { "ServiceKey": "Administration Service", diff --git a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json index ba5d742b..0bb09d1e 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json +++ b/services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/appsettings.json @@ -55,10 +55,5 @@ }, "ElasticSearch": { "Url": "http://localhost:9200" - }, - "Consul": { - "Enabled": true, - "Host": "http://localhost:8500", - "Service": "Administration Service" } } diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs index 504be8b6..98b4cb84 100644 --- a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs +++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs @@ -215,10 +215,10 @@ namespace EShopOnAbp.IdentityService.DbMigrations }; //Public Web Client - var publicWebClientRootUrl = _configuration["IdentityServerClients:EShopOnAbp_PublicWeb:RootUrl"] + var publicWebClientRootUrl = _configuration["IdentityServerClients:PublicWeb:RootUrl"] .EnsureEndsWith('/'); await CreateClientAsync( - name: "EShopOnAbp_PublicWeb", + name: "PublicWeb", scopes: commonScopes.Union(new[] { "AdministrationService" @@ -233,9 +233,9 @@ namespace EShopOnAbp.IdentityService.DbMigrations //Angular Client var angularClientRootUrl = - _configuration["IdentityServerClients:EShopOnAbp_Angular:RootUrl"].TrimEnd('/'); + _configuration["IdentityServerClients:Web:RootUrl"].TrimEnd('/'); await CreateClientAsync( - name: "EShopOnAbp_Angular", + name: "Web", scopes: commonScopes.Union(new[] { "IdentityService", diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json index f6ddc93a..7d0a81b5 100644 --- a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json +++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/appsettings.json @@ -42,18 +42,22 @@ "ElasticSearch": { "Url": "http://localhost:9200" }, - "Consul": { - "Enabled": true, - "Host": "http://localhost:8500", - "Service": "Identity Service" - }, "IdentityServerClients": { - "EShopOnAbp_Angular": { + "Web": { "RootUrl": "http://localhost:4200" }, - "EShopOnAbp_PublicWeb": { + "PublicWeb": { "RootUrl": "https://localhost:44335/" }, + "InternalGateway": { + "RootUrl": "https://localhost:44371" + }, + "WebGateway": { + "RootUrl": "https://localhost:44372" + }, + "PublicWebGateway": { + "RootUrl": "https://localhost:44373" + }, "IdentityService": { "RootUrl": "https://localhost:44351" }, diff --git a/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/appsettings.json b/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/appsettings.json index e0acb96a..869f9537 100644 --- a/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/appsettings.json +++ b/services/saas/src/EShopOnAbp.SaasService.HttpApi.Host/appsettings.json @@ -40,10 +40,5 @@ }, "ElasticSearch": { "Url": "http://localhost:9200" - }, - "Consul": { - "Enabled": true, - "Host": "http://localhost:8500", - "Service": "Saas Service" } }