From d87fa068bd0be0c482e356022ef735e508127518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 4 Aug 2021 13:40:26 +0300 Subject: [PATCH] Used release name in helm templates --- .../account/templates/account-ingress.yaml | 10 ++++---- .../account/templates/account-service.yaml | 6 ++--- .../account/templates/account-tls-secret.yaml | 2 +- .../charts/account/templates/account.yaml | 12 +++++----- .../eventhub/charts/account/values.yaml | 3 +++ .../charts/api/templates/api-ingress.yaml | 6 ++--- .../charts/api/templates/api-service.yaml | 6 ++--- .../eventhub/charts/api/templates/api.yaml | 20 ++++++---------- .../eventhub/charts/api/values.yaml | 3 +++ .../charts/dbmigrator/templates/migrator.yaml | 4 ++-- .../eventhub/charts/dbmigrator/values.yaml | 3 +++ .../eventhub/charts/postgresql/Chart.yaml | 2 +- .../templates/postgresql-service.yaml | 6 ++--- .../postgresql/templates/postgresql.yaml | 8 +++---- .../charts/redis/templates/redis-service.yaml | 6 ++--- .../charts/redis/templates/redis.yaml | 15 ++++-------- .../helm-chart/eventhub/charts/www/Chart.yaml | 6 +++++ .../charts/www/templates/www-ingress.yaml | 23 +++++++++++++++++++ .../charts/www/templates/www-service.yaml | 14 +++++++++++ .../eventhub/charts/www/templates/www.yaml | 22 ++++++++++++++++++ .../eventhub/charts/www/values.yaml | 3 +++ etc/k8s/helm-chart/eventhub/values.yaml | 3 +++ src/EventHub.DbMigrator/appsettings.json | 8 +++---- src/EventHub.HttpApi.Host/appsettings.json | 10 ++++---- .../EventHubIdentityServerModule.cs | 2 ++ src/EventHub.IdentityServer/appsettings.json | 10 ++++---- src/EventHub.Web/Dockerfile | 4 ++++ src/EventHub.Web/EventHubWebModule.cs | 13 +++++++++++ src/EventHub.Web/Program.cs | 1 + src/EventHub.Web/appsettings.json | 10 ++++---- 30 files changed, 165 insertions(+), 76 deletions(-) create mode 100644 etc/k8s/helm-chart/eventhub/charts/account/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/api/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml create mode 100644 etc/k8s/helm-chart/eventhub/charts/www/values.yaml create mode 100644 src/EventHub.Web/Dockerfile diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml index e97bb76..a678100 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml @@ -1,23 +1,23 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: account-ingress + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/force-ssl-redirect: "true" spec: tls: - hosts: - - account.openeventhub.com - secretName: account-tls + - {{ .Values.accountUrl }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls rules: - - host: "account.openeventhub.com" + - host: "{{ .Values.accountUrl }}" http: paths: - path: / pathType: Prefix backend: service: - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} port: number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml index 075e7d7..ee157c0 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: account - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: ports: - name: "80" @@ -11,4 +11,4 @@ spec: - name: "443" port: 443 selector: - app: account + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml index 312e1ee..b03c72e 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account-tls-secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 type: kubernetes.io/tls kind: Secret metadata: - name: account-tls + name: {{ .Release.Name }}-{{ .Chart.Name }}-tls data: tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURUVENDQWpXZ0F3SUJBZ0lVZTVMQzk5RVFUcHRJQitzTHRobi9Kc1RjR1Zzd0RRWUpLb1pJaHZjTkFRRUwKQlFBd05qRWhNQjhHQTFVRUF3d1lZV05qYjNWdWRDNXZjR1Z1WlhabGJuUm9kV0l1WTI5dE1SRXdEd1lEVlFRSwpEQWhXYjJ4dmMyOW1kREFlRncweU1UQTRNRE14TWpJNU5UVmFGdzB5TWpBNE1ETXhNakk1TlRWYU1EWXhJVEFmCkJnTlZCQU1NR0dGalkyOTFiblF1YjNCbGJtVjJaVzUwYUhWaUxtTnZiVEVSTUE4R0ExVUVDZ3dJVm05c2IzTnYKWm5Rd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUNuOUZzSCtCenNsai81L0p1WQpuK1pQYjhrOEN0dXZPTC9xVjZtbWF5ZWZLVVBRdTFWb2w2enI4bkZJTmU3cjRHR3RFM0N2VEVtYXVaeG5qUkQwCmVHb0pSanBPMzFIYTB5MktST1p4OVU0TGFlTFEzdm9RT1Izd0tvL2ZzZnRXczFvdnM4Z3NNeS9YemwxTHB2WDEKSWFhSVl2bEVyakhkeVBUbTdoTUxGS09HRGpZWHNp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0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K diff --git a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml index e67dbcb..171f8de 100644 --- a/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/account/templates/account.yaml @@ -1,22 +1,22 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: selector: matchLabels: - app: account + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: account + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: eventhub.account imagePullPolicy: Never - name: account + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - - name: accounthttp + - name: http containerPort: 80 - - name: accounthttps + - name: https containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/account/values.yaml b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/account/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml index efc2deb..18cbfe3 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-ingress.yaml @@ -1,18 +1,18 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: api-ingress + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules: - - host: "api.openeventhub.com" + - host: "{{ .Values.apiUrl }}" http: paths: - path: / pathType: Prefix backend: service: - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} port: number: 80 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml index e4b7ee7..ee157c0 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: api - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: ports: - name: "80" @@ -11,4 +11,4 @@ spec: - name: "443" port: 443 selector: - app: api + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml index 8a40a70..8602009 100644 --- a/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/api/templates/api.yaml @@ -1,28 +1,22 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: selector: matchLabels: - app: api + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: api + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: eventhub.api imagePullPolicy: Never - name: api + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - - name: apihttp + - name: http containerPort: 80 - - name: apihttps - containerPort: 443 - hostAliases: - - ip: 10.105.172.183 - hostnames: - - "account.openeventhub.com" - - "openeventhub.com" - - "api.openeventhub.com" \ No newline at end of file + - name: https + containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/api/values.yaml b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/api/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml index 18f6233..e77b1c5 100644 --- a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/templates/migrator.yaml @@ -1,13 +1,13 @@ apiVersion: batch/v1 kind: Job metadata: - name: migrator + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: activeDeadlineSeconds: 100 template: spec: containers: - - name: migrator + - name: {{ .Release.Name }}-{{ .Chart.Name }} image: eventhubmigrator imagePullPolicy: Never restartPolicy: Never diff --git a/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/dbmigrator/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml index 49bbcd8..ce984f6 100644 --- a/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: database +name: postgresql appVersion: "1.0" description: Runs PostgreSQL Instance version: 1.0.0 diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml index c4fa04a..2b0ce51 100644 --- a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: postgresql - name: postgresql + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: type: LoadBalancer ports: @@ -11,5 +11,5 @@ spec: port: 5435 targetPort: 5432 selector: - app: postgresql + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml index fd6e1e0..b967635 100644 --- a/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/postgresql/templates/postgresql.yaml @@ -1,20 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: postgresql + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: replicas: 1 selector: matchLabels: - app: postgresql + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: postgresql + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: postgres - name: postgresql + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - name: postgresql containerPort: 5432 diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml index 5c2d9ef..de91146 100644 --- a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis-service.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: Service metadata: labels: - name: redis - name: redis + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: type: ClusterIP ports: @@ -11,5 +11,5 @@ spec: port: 6379 targetPort: 6379 selector: - app: redis + app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml index 22e1f51..2ba176d 100644 --- a/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml +++ b/etc/k8s/helm-chart/eventhub/charts/redis/templates/redis.yaml @@ -1,25 +1,20 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: redis + name: {{ .Release.Name }}-{{ .Chart.Name }} spec: replicas: 1 selector: matchLabels: - app: redis + app: {{ .Release.Name }}-{{ .Chart.Name }} template: metadata: labels: - app: redis + app: {{ .Release.Name }}-{{ .Chart.Name }} spec: containers: - image: redis:6.0.10-alpine - name: redis + name: {{ .Release.Name }}-{{ .Chart.Name }} ports: - name: redis - containerPort: 6379 - env: - - name: POSTGRES_USER - value: "root" - - name: POSTGRES_PASSWORD - value: "root" \ No newline at end of file + containerPort: 6379 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml b/etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml new file mode 100644 index 0000000..319d808 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: www +appVersion: "1.0" +description: EventHub WWW Application +version: 1.0.0 +type: application \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml new file mode 100644 index 0000000..3b237eb --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" +spec: + tls: + - hosts: + - {{ .Values.wwwUrl }} + secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls + rules: + - host: "{{ .Values.wwwUrl }}" + 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/helm-chart/eventhub/charts/www/templates/www-service.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-service.yaml new file mode 100644 index 0000000..ee157c0 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www-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/helm-chart/eventhub/charts/www/templates/www.yaml b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml new file mode 100644 index 0000000..08ad03b --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/templates/www.yaml @@ -0,0 +1,22 @@ +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: eventhub.www + imagePullPolicy: Never + name: {{ .Release.Name }}-{{ .Chart.Name }} + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/charts/www/values.yaml b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml new file mode 100644 index 0000000..d44ed88 --- /dev/null +++ b/etc/k8s/helm-chart/eventhub/charts/www/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/etc/k8s/helm-chart/eventhub/values.yaml b/etc/k8s/helm-chart/eventhub/values.yaml index e69de29..d44ed88 100644 --- a/etc/k8s/helm-chart/eventhub/values.yaml +++ b/etc/k8s/helm-chart/eventhub/values.yaml @@ -0,0 +1,3 @@ +accountUrl: eh-st-account +apiUrl: eh-st-api +wwwUrl: eh-st-www \ No newline at end of file diff --git a/src/EventHub.DbMigrator/appsettings.json b/src/EventHub.DbMigrator/appsettings.json index 07155fd..c8f7067 100644 --- a/src/EventHub.DbMigrator/appsettings.json +++ b/src/EventHub.DbMigrator/appsettings.json @@ -1,22 +1,22 @@ { "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "IdentityServer": { "Clients": { "EventHub_Web": { "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*", - "RootUrl": "https://openeventhub.com" + "RootUrl": "https://eh-st-www" }, "EventHub_Blazor": { "ClientId": "EventHub_Blazor", - "RootUrl": "https://admin.openeventhub.com" + "RootUrl": "https://eh-st-admin" }, "EventHub_Swagger": { "ClientId": "EventHub_Swagger", "ClientSecret": "1q2w3e*", - "RootUrl": "https://api.openeventhub.com" + "RootUrl": "https://eh-st-api" } } } diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json index e379370..0548fb9 100644 --- a/src/EventHub.HttpApi.Host/appsettings.json +++ b/src/EventHub.HttpApi.Host/appsettings.json @@ -1,16 +1,16 @@ { "App": { - "CorsOrigins": "https://*.openeventhub.com,https://localhost:44307,https://localhost:44308" + "CorsOrigins": "https://eh-st-www,eh-st-admin" }, "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "Redis": { - "Configuration": "redis" + "Configuration": "eh-st-redis" }, "AuthServer": { - "Authority": "https://account.openeventhub.com", - "RequireHttpsMetadata": "true", + "Authority": "http://eh-st-account", + "RequireHttpsMetadata": "false", "SwaggerClientId": "EventHub_Swagger", "SwaggerClientSecret": "1q2w3e*" }, diff --git a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs index f35016c..15b82d9 100644 --- a/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs +++ b/src/EventHub.IdentityServer/EventHubIdentityServerModule.cs @@ -187,11 +187,13 @@ namespace EventHub var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); + /* app.Use((context, next) => { context.Request.Scheme = "https"; return next(); }); + */ if (env.IsDevelopment()) { diff --git a/src/EventHub.IdentityServer/appsettings.json b/src/EventHub.IdentityServer/appsettings.json index d4b0c6a..f361f09 100644 --- a/src/EventHub.IdentityServer/appsettings.json +++ b/src/EventHub.IdentityServer/appsettings.json @@ -1,14 +1,14 @@ { "App": { - "SelfUrl": "https://account.openeventhub.com", - "CorsOrigins": "https://*.openeventhub.com,http://localhost:4200,https://localhost:44307,https://localhost:44362", - "RedirectAllowedUrls": "https://openeventhub.com,https://admin.openeventhub.com" + "SelfUrl": "https://eh-st-account", + "CorsOrigins": "https://eh-st-www,https://eh-st-api,https://localhost:44307,https://localhost:44362", + "RedirectAllowedUrls": "https://eh-st-api,https://eh-st-www,http://eh-st-api,http://eh-st-www" }, "ConnectionStrings": { - "Default": "Host=postgresql;Port=5435;Database=EventHub;Username=root;Password=root" + "Default": "Host=eh-st-postgresql;Port=5435;Database=EventHub;Username=root;Password=root" }, "Redis": { - "Configuration": "redis" + "Configuration": "eh-st-redis" }, "StringEncryption": { "DefaultPassPhrase": "TxVIZFPxK33czbbv" diff --git a/src/EventHub.Web/Dockerfile b/src/EventHub.Web/Dockerfile new file mode 100644 index 0000000..ab31322 --- /dev/null +++ b/src/EventHub.Web/Dockerfile @@ -0,0 +1,4 @@ + FROM mcr.microsoft.com/dotnet/aspnet:5.0 + COPY bin/Release/net5.0/publish/ app/ + WORKDIR /app + ENTRYPOINT ["dotnet", "EventHub.Web.dll"] \ No newline at end of file diff --git a/src/EventHub.Web/EventHubWebModule.cs b/src/EventHub.Web/EventHubWebModule.cs index 473c746..3f5a04e 100644 --- a/src/EventHub.Web/EventHubWebModule.cs +++ b/src/EventHub.Web/EventHubWebModule.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; @@ -150,6 +151,12 @@ namespace EventHub.Web options.Scope.Add("email"); options.Scope.Add("phone"); options.Scope.Add("EventHub"); + + options.Events.OnRedirectToIdentityProvider = redirectContext => + { + redirectContext.ProtocolMessage.RedirectUri = $"{configuration["App:SelfUrl"]}/signin-oidc"; + return Task.CompletedTask; + }; }); } @@ -214,6 +221,12 @@ namespace EventHub.Web { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); + + app.Use((context, next) => + { + context.Request.Scheme = "https"; + return next(); + }); if (env.IsDevelopment()) { diff --git a/src/EventHub.Web/Program.cs b/src/EventHub.Web/Program.cs index 010a36d..bb1f758 100644 --- a/src/EventHub.Web/Program.cs +++ b/src/EventHub.Web/Program.cs @@ -45,6 +45,7 @@ namespace EventHub.Web .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); + //webBuilder.UseUrls("http://localhost:80", "https://localhost:443"); }) .UseAutofac() .UseSerilog(); diff --git a/src/EventHub.Web/appsettings.json b/src/EventHub.Web/appsettings.json index 2d20ae9..830df47 100644 --- a/src/EventHub.Web/appsettings.json +++ b/src/EventHub.Web/appsettings.json @@ -1,18 +1,18 @@ { "App": { - "SelfUrl": "https://localhost:44308" + "SelfUrl": "https://eh-st-www" }, "RemoteServices": { "Default": { - "BaseUrl": "https://localhost:44362/" + "BaseUrl": "http://eh-st-api/" } }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "eh-st-redis" }, "AuthServer": { - "Authority": "https://localhost:44313", - "RequireHttpsMetadata": "true", + "Authority": "http://eh-st-account", + "RequireHttpsMetadata": "false", "ClientId": "EventHub_Web", "ClientSecret": "1q2w3e*" },