diff --git a/.gitignore b/.gitignore index 8f5d1ce45..b10401dd4 100644 --- a/.gitignore +++ b/.gitignore @@ -273,3 +273,8 @@ pub/ # Ignore HealthCheckdb *healthchecksdb* + +# Ignores all extra inf.yaml and app.yaml that are copied by prepare-devspaces.ps1 +src/**/app.yaml +src/**/inf.yaml + diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index 447b73073..882bca09f 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -142,9 +142,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Webhooks", "Webhooks", "{E0AA11C4-2873-461D-8F82-53392530FB7A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webhooks.API", "src\Services\Webhooks\Webhooks.API\Webhooks.API.csproj", "{84E2016E-0435-44C6-8020-3D288AA38B2C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webhooks.API", "src\Services\Webhooks\Webhooks.API\Webhooks.API.csproj", "{84E2016E-0435-44C6-8020-3D288AA38B2C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebhookClient", "src\Web\WebhookClient\WebhookClient.csproj", "{766D7E92-6AF0-476C-ADD5-282BF4D8C576}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebhookClient", "src\Web\WebhookClient\WebhookClient.csproj", "{766D7E92-6AF0-476C-ADD5-282BF4D8C576}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Devspace.Support", "Devspace.Support", "{68F5041D-51F2-4630-94B6-B49789F5E51A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Devspaces.Support", "src\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj", "{56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1744,6 +1748,54 @@ Global {766D7E92-6AF0-476C-ADD5-282BF4D8C576}.Release|x64.Build.0 = Release|Any CPU {766D7E92-6AF0-476C-ADD5-282BF4D8C576}.Release|x86.ActiveCfg = Release|Any CPU {766D7E92-6AF0-476C-ADD5-282BF4D8C576}.Release|x86.Build.0 = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|ARM.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|iPhone.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|x64.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|x64.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|x86.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.AppStore|x86.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|ARM.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|ARM.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|iPhone.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|x64.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|x64.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|x86.ActiveCfg = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Debug|x86.Build.0 = Debug|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|Any CPU.Build.0 = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|ARM.ActiveCfg = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|ARM.Build.0 = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|iPhone.ActiveCfg = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|iPhone.Build.0 = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x64.ActiveCfg = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x64.Build.0 = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x86.ActiveCfg = Release|Any CPU + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1808,6 +1860,8 @@ Global {E0AA11C4-2873-461D-8F82-53392530FB7A} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} {84E2016E-0435-44C6-8020-3D288AA38B2C} = {E0AA11C4-2873-461D-8F82-53392530FB7A} {766D7E92-6AF0-476C-ADD5-282BF4D8C576} = {E279BF0F-7F66-4F3A-A3AB-2CDA66C1CD04} + {68F5041D-51F2-4630-94B6-B49789F5E51A} = {DB0EFB20-B024-4E5E-A75C-52143C131D25} + {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35} = {68F5041D-51F2-4630-94B6-B49789F5E51A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} diff --git a/k8s/helm/apigwmm/templates/_names.tpl b/k8s/helm/apigwmm/templates/_names.tpl index a6eeb9965..d44859fea 100644 --- a/k8s/helm/apigwmm/templates/_names.tpl +++ b/k8s/helm/apigwmm/templates/_names.tpl @@ -33,14 +33,13 @@ {{- end -}} + {{- define "pathBase" -}} -{{- $name := first .}} -{{- $ctx := last .}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- printf "/%s-%s" $name $suffix -}} +{{- if .Values.inf.k8s.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} -{{- printf "/%s" $name -}} +{{- .Values.pathBase -}} {{- end -}} {{- end -}} diff --git a/k8s/helm/apigwmm/templates/deployment.yaml b/k8s/helm/apigwmm/templates/deployment.yaml index 6dc58bf50..c9abb0b62 100644 --- a/k8s/helm/apigwmm/templates/deployment.yaml +++ b/k8s/helm/apigwmm/templates/deployment.yaml @@ -61,10 +61,10 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config - mountPath: /app/configuration + mountPath: {{ .Values.ocelot.configPath }} env: - name: PATH_BASE - value: {{ include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) }} + value: {{ include "pathBase" . }} - name: k8sname value: {{ .Values.clusterName }} {{- if .Values.env.values -}} diff --git a/k8s/helm/apigwmm/templates/ingress.yaml b/k8s/helm/apigwmm/templates/ingress.yaml index 28e2aa84d..290aac0b3 100644 --- a/k8s/helm/apigwmm/templates/ingress.yaml +++ b/k8s/helm/apigwmm/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.ingress.enabled -}} -{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.mobilemarketingapigw -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +24,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.mobilemarketingapigw }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/apigwmm/values.yaml b/k8s/helm/apigwmm/values.yaml index 501266780..ea87a6c05 100644 --- a/k8s/helm/apigwmm/values.yaml +++ b/k8s/helm/apigwmm/values.yaml @@ -62,3 +62,5 @@ probes: initialDelaySeconds: 90 periodSeconds: 60 port: 80 +ocelot: + configPath: /app/configuration diff --git a/k8s/helm/apigwms/templates/_names.tpl b/k8s/helm/apigwms/templates/_names.tpl index 1e840c56c..d44859fea 100644 --- a/k8s/helm/apigwms/templates/_names.tpl +++ b/k8s/helm/apigwms/templates/_names.tpl @@ -35,13 +35,11 @@ {{- define "pathBase" -}} -{{- $name := first .}} -{{- $ctx := last .}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- printf "/%s-%s" $name $suffix -}} +{{- if .Values.inf.k8s.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} -{{- printf "/%s" $name -}} +{{- .Values.pathBase -}} {{- end -}} {{- end -}} diff --git a/k8s/helm/apigwms/templates/deployment.yaml b/k8s/helm/apigwms/templates/deployment.yaml index 8a4fd8942..b22922f89 100644 --- a/k8s/helm/apigwms/templates/deployment.yaml +++ b/k8s/helm/apigwms/templates/deployment.yaml @@ -61,10 +61,10 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config - mountPath: /app/configuration + mountPath: {{ .Values.ocelot.configPath }} env: - name: PATH_BASE - value: {{ include "pathBase" (list .Values.app.ingress.entries.mobileshoppingapigw .) }} + value: {{ include "pathBase" . }} - name: k8sname value: {{ .Values.clusterName }} {{- if .Values.env.values -}} diff --git a/k8s/helm/apigwms/templates/ingress.yaml b/k8s/helm/apigwms/templates/ingress.yaml index 7dd50d8dd..e93ddc2c6 100644 --- a/k8s/helm/apigwms/templates/ingress.yaml +++ b/k8s/helm/apigwms/templates/ingress.yaml @@ -1,5 +1,7 @@ {{- if .Values.ingress.enabled -}} -{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.mobileshoppingapigw .) -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.mobileshoppingapigw -}} + apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +25,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.mobileshoppingapigw }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/apigwms/values.yaml b/k8s/helm/apigwms/values.yaml index 58377ec5b..650ab6449 100644 --- a/k8s/helm/apigwms/values.yaml +++ b/k8s/helm/apigwms/values.yaml @@ -61,4 +61,6 @@ probes: timeoutSeconds: 5 initialDelaySeconds: 90 periodSeconds: 60 - port: 80 \ No newline at end of file + port: 80 +ocelot: + configPath: /app/configuration \ No newline at end of file diff --git a/k8s/helm/apigwwm/templates/_names.tpl b/k8s/helm/apigwwm/templates/_names.tpl index 1e840c56c..d44859fea 100644 --- a/k8s/helm/apigwwm/templates/_names.tpl +++ b/k8s/helm/apigwwm/templates/_names.tpl @@ -35,13 +35,11 @@ {{- define "pathBase" -}} -{{- $name := first .}} -{{- $ctx := last .}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- printf "/%s-%s" $name $suffix -}} +{{- if .Values.inf.k8s.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} -{{- printf "/%s" $name -}} +{{- .Values.pathBase -}} {{- end -}} {{- end -}} diff --git a/k8s/helm/apigwwm/templates/deployment.yaml b/k8s/helm/apigwwm/templates/deployment.yaml index 5cbce9f22..d1f39ab6c 100644 --- a/k8s/helm/apigwwm/templates/deployment.yaml +++ b/k8s/helm/apigwwm/templates/deployment.yaml @@ -61,10 +61,10 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config - mountPath: /app/configuration + mountPath: {{ .Values.ocelot.configPath }} env: - name: PATH_BASE - value: {{ include "pathBase" (list .Values.app.ingress.entries.webmarketingapigw .) }} + value: {{ include "pathBase" . }} - name: k8sname value: {{ .Values.clusterName }} {{- if .Values.env.values -}} diff --git a/k8s/helm/apigwwm/templates/ingress.yaml b/k8s/helm/apigwwm/templates/ingress.yaml index 0a79c4660..297fea52b 100644 --- a/k8s/helm/apigwwm/templates/ingress.yaml +++ b/k8s/helm/apigwwm/templates/ingress.yaml @@ -1,5 +1,7 @@ {{- if .Values.ingress.enabled -}} -{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.webmarketingapigw .) -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.webmarketingapigw -}} + apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +25,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.webmarketingapigw }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/apigwwm/values.yaml b/k8s/helm/apigwwm/values.yaml index 68cbb89c4..63deb5832 100644 --- a/k8s/helm/apigwwm/values.yaml +++ b/k8s/helm/apigwwm/values.yaml @@ -61,4 +61,6 @@ probes: timeoutSeconds: 5 initialDelaySeconds: 90 periodSeconds: 60 - port: 80 \ No newline at end of file + port: 80 +ocelot: + configPath: /app/configuration \ No newline at end of file diff --git a/k8s/helm/apigwws/templates/_names.tpl b/k8s/helm/apigwws/templates/_names.tpl index a6eeb9965..d44859fea 100644 --- a/k8s/helm/apigwws/templates/_names.tpl +++ b/k8s/helm/apigwws/templates/_names.tpl @@ -33,14 +33,13 @@ {{- end -}} + {{- define "pathBase" -}} -{{- $name := first .}} -{{- $ctx := last .}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- printf "/%s-%s" $name $suffix -}} +{{- if .Values.inf.k8s.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} -{{- printf "/%s" $name -}} +{{- .Values.pathBase -}} {{- end -}} {{- end -}} diff --git a/k8s/helm/apigwws/templates/deployment.yaml b/k8s/helm/apigwws/templates/deployment.yaml index 4912d12bb..327eb50b7 100644 --- a/k8s/helm/apigwws/templates/deployment.yaml +++ b/k8s/helm/apigwws/templates/deployment.yaml @@ -60,10 +60,10 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config - mountPath: /app/configuration + mountPath: {{ .Values.ocelot.configPath }} env: - name: PATH_BASE - value: {{ include "pathBase" (list .Values.app.ingress.entries.webshoppingapigw .) }} + value: {{ include "pathBase" . }} - name: k8sname value: {{ .Values.clusterName }} {{- if .Values.env.values -}} diff --git a/k8s/helm/apigwws/templates/ingress.yaml b/k8s/helm/apigwws/templates/ingress.yaml index ee1f681ad..8bd2cfc6d 100644 --- a/k8s/helm/apigwws/templates/ingress.yaml +++ b/k8s/helm/apigwws/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.ingress.enabled -}} -{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.webshoppingapigw .) -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.webshoppingapigw -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +24,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.webshoppingapigw }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/apigwws/values.yaml b/k8s/helm/apigwws/values.yaml index 94b8a203f..2b047de99 100644 --- a/k8s/helm/apigwws/values.yaml +++ b/k8s/helm/apigwws/values.yaml @@ -62,3 +62,5 @@ probes: initialDelaySeconds: 90 periodSeconds: 60 port: 80 +ocelot: + configPath: /app/configuration \ No newline at end of file diff --git a/k8s/helm/basket-api/templates/ingress.yaml b/k8s/helm/basket-api/templates/ingress.yaml new file mode 100644 index 000000000..f99bd55a6 --- /dev/null +++ b/k8s/helm/basket-api/templates/ingress.yaml @@ -0,0 +1,37 @@ +{{- if .Values.ingress.enabled -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.basket -}} + +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "basket-api.fullname" . }} + labels: + app: {{ template "basket-api.name" . }} + chart: {{ template "basket-api.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + - {{ .Values.inf.k8s.dns }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: http + {{- end }} +{{- end }} \ No newline at end of file diff --git a/k8s/helm/basket-api/values.yaml b/k8s/helm/basket-api/values.yaml index 6c264afba..a773700fe 100644 --- a/k8s/helm/basket-api/values.yaml +++ b/k8s/helm/basket-api/values.yaml @@ -53,3 +53,6 @@ probes: initialDelaySeconds: 90 periodSeconds: 60 port: 80 + +ingress: + enabled: false \ No newline at end of file diff --git a/k8s/helm/catalog-api/templates/ingress.yaml b/k8s/helm/catalog-api/templates/ingress.yaml new file mode 100644 index 000000000..238d7b07e --- /dev/null +++ b/k8s/helm/catalog-api/templates/ingress.yaml @@ -0,0 +1,37 @@ +{{- if .Values.ingress.enabled -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.catalog -}} + +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "catalog-api.fullname" . }} + labels: + app: {{ template "catalog-api.name" . }} + chart: {{ template "catalog-api.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + - {{ .Values.inf.k8s.dns }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: http + {{- end }} +{{- end }} \ No newline at end of file diff --git a/k8s/helm/deploy-all.ps1 b/k8s/helm/deploy-all.ps1 index 42ba3ab27..879749679 100644 --- a/k8s/helm/deploy-all.ps1 +++ b/k8s/helm/deploy-all.ps1 @@ -5,6 +5,7 @@ Param( [parameter(Mandatory=$false)][string]$externalDns, [parameter(Mandatory=$false)][string]$appName="eshop", [parameter(Mandatory=$false)][bool]$deployInfrastructure=$true, + [parameter(Mandatory=$false)][bool]$deployCharts=$true, [parameter(Mandatory=$false)][bool]$clean=$true, [parameter(Mandatory=$false)][string]$aksName="", [parameter(Mandatory=$false)][string]$aksRg="", @@ -66,20 +67,28 @@ $charts = ("eshop-common", "apigwmm", "apigwms", "apigwwm", "apigwws", "basket-a if ($deployInfrastructure) { foreach ($infra in $infras) { Write-Host "Installing infrastructure: $infra" -ForegroundColor Green - helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --name="$appName-$infra" $infra + helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --name="$appName-$infra" $infra } } +else { + Write-Host "eShopOnContainers infrastructure (bbdd, redis, ...) charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow +} -foreach ($chart in $charts) { - Write-Host "Installing: $chart" -ForegroundColor Green - if ($useCustomRegistry) { - helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart - } - else { - if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed - helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart +if ($deployCharts) { + foreach ($chart in $charts) { + Write-Host "Installing: $chart" -ForegroundColor Green + if ($useCustomRegistry) { + helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart + } + else { + if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed + helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart + } } } } +else { + Write-Host "eShopOnContainers non-infrastructure charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow +} Write-Host "helm charts installed." -ForegroundColor Green \ No newline at end of file diff --git a/k8s/helm/identity-api/templates/configmap.yaml b/k8s/helm/identity-api/templates/configmap.yaml index 24d71b699..67c0f21cb 100644 --- a/k8s/helm/identity-api/templates/configmap.yaml +++ b/k8s/helm/identity-api/templates/configmap.yaml @@ -36,5 +36,4 @@ data: xamarin_callback_e: http://{{ $xamarincallback }} webhooksapi_e: http://{{ $webhooks_url }} webhooksweb_e: http://{{ $webhooksweb_url }} - - + enableDevspaces: "{{ .Values.enableDevspaces }}" \ No newline at end of file diff --git a/k8s/helm/identity-api/templates/ingress.yaml b/k8s/helm/identity-api/templates/ingress.yaml index 5824f91e2..1d2d3d5d5 100644 --- a/k8s/helm/identity-api/templates/ingress.yaml +++ b/k8s/helm/identity-api/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.identity }} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +24,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.identity }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/identity-api/values.yaml b/k8s/helm/identity-api/values.yaml index c0fd38192..7b57dfde1 100644 --- a/k8s/helm/identity-api/values.yaml +++ b/k8s/helm/identity-api/values.yaml @@ -58,6 +58,8 @@ env: key: webhooksapi_e - name: WebhooksWebClient key: webhooksweb_e + - name: EnableDevspaces + key: enableDevspaces values: - name: ASPNETCORE_ENVIRONMENT value: Development @@ -65,6 +67,7 @@ env: value: 'K8S' - name: IsClusterEnv value: 'True' + probes: liveness: path: /liveness @@ -76,4 +79,6 @@ probes: timeoutSeconds: 5 initialDelaySeconds: 90 periodSeconds: 60 - port: 80 \ No newline at end of file + port: 80 + +enableDevspaces: "false" \ No newline at end of file diff --git a/k8s/helm/locations-api/templates/ingress.yaml b/k8s/helm/locations-api/templates/ingress.yaml new file mode 100644 index 000000000..8c846944e --- /dev/null +++ b/k8s/helm/locations-api/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.locations }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "locations-api.fullname" . }} + labels: + app: {{ template "locations-api.name" . }} + chart: {{ template "locations-api.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + - {{ .Values.inf.k8s.dns }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/k8s/helm/marketing-api/templates/ingress.yaml b/k8s/helm/marketing-api/templates/ingress.yaml new file mode 100644 index 000000000..7a5b29b12 --- /dev/null +++ b/k8s/helm/marketing-api/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.marketing }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "marketing-api.fullname" . }} + labels: + app: {{ template "marketing-api.name" . }} + chart: {{ template "marketing-api.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + - {{ .Values.inf.k8s.dns }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/k8s/helm/mobileshoppingagg/templates/ingress.yaml b/k8s/helm/mobileshoppingagg/templates/ingress.yaml new file mode 100644 index 000000000..6c50a574e --- /dev/null +++ b/k8s/helm/mobileshoppingagg/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.mobileshoppingagg }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "mobileshoppingagg.fullname" . }} + labels: + app: {{ template "mobileshoppingagg.name" . }} + chart: {{ template "mobileshoppingagg.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + - {{ .Values.inf.k8s.dns }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/k8s/helm/ordering-backgroundtasks/templates/configmap.yaml b/k8s/helm/ordering-backgroundtasks/templates/configmap.yaml index 54fec785b..23041d4ac 100644 --- a/k8s/helm/ordering-backgroundtasks/templates/configmap.yaml +++ b/k8s/helm/ordering-backgroundtasks/templates/configmap.yaml @@ -1,10 +1,11 @@ {{- $name := include "ordering-backgroundtasks.fullname" . -}} {{- $sqlsrv := include "sql-name" . -}} +{{- $cfgname := printf "cfg-%s" $name | trunc 63 }} apiVersion: v1 kind: ConfigMap metadata: - name: "cfg-{{ $name }}" + name: "{{ $cfgname }}" labels: app: {{ template "ordering-backgroundtasks.name" . }} chart: {{ template "ordering-backgroundtasks.chart" .}} diff --git a/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml b/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml index 017f9f3dd..d93c7f764 100644 --- a/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml +++ b/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml @@ -1,11 +1,11 @@ {{- $name := include "ordering-backgroundtasks.fullname" . -}} -{{- $cfgname := printf "%s-%s" "cfg" $name -}} +{{- $cfgname := printf "cfg-%s" $name | trunc 63 }} + apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "ordering-backgroundtasks.fullname" . }} labels: - ufo: {{ $cfgname}} app: {{ template "ordering-backgroundtasks.name" . }} chart: {{ template "ordering-backgroundtasks.chart" . }} release: {{ .Release.Name }} diff --git a/k8s/helm/webhooks-api/templates/ingress.yaml b/k8s/helm/webhooks-api/templates/ingress.yaml index 293f8e47e..debf0f84a 100644 --- a/k8s/helm/webhooks-api/templates/ingress.yaml +++ b/k8s/helm/webhooks-api/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.webhooks }} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +24,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.webhooks }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/webmvc/templates/configmap.yaml b/k8s/helm/webmvc/templates/configmap.yaml index 60dacdadd..55c4e6b33 100644 --- a/k8s/helm/webmvc/templates/configmap.yaml +++ b/k8s/helm/webmvc/templates/configmap.yaml @@ -2,7 +2,6 @@ {{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} {{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} {{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}} -{{- $mongo := include "mongo-name" . -}} apiVersion: v1 diff --git a/k8s/helm/webmvc/templates/ingress.yaml b/k8s/helm/webmvc/templates/ingress.yaml index abfb62b2f..892fa4273 100644 --- a/k8s/helm/webmvc/templates/ingress.yaml +++ b/k8s/helm/webmvc/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.mvc -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -23,11 +24,13 @@ spec: {{- end }} {{- end }} rules: - - host: {{ .Values.inf.k8s.dns }} + {{- range .Values.ingress.hosts }} + - host: {{ . }} http: paths: - path: {{ $ingressPath }} backend: - serviceName: {{ .Values.app.svc.mvc }} + serviceName: {{ $serviceName }} servicePort: http + {{- end }} {{- end }} diff --git a/k8s/helm/webshoppingagg/templates/ingress.yaml b/k8s/helm/webshoppingagg/templates/ingress.yaml new file mode 100644 index 000000000..742db4d30 --- /dev/null +++ b/k8s/helm/webshoppingagg/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled -}} +{{- $ingressPath := include "pathBase" . -}} +{{- $serviceName := .Values.app.svc.webshoppingagg }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "webshoppingagg.fullname" . }} + labels: + app: {{ template "webshoppingagg.name" . }} + chart: {{ template "webshoppingagg.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + - {{ .Values.inf.k8s.dns }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/src/ApiGateways/ApiGw-Base/Dockerfile.develop b/src/ApiGateways/ApiGw-Base/Dockerfile.develop new file mode 100644 index 000000000..4da230d68 --- /dev/null +++ b/src/ApiGateways/ApiGw-Base/Dockerfile.develop @@ -0,0 +1,14 @@ +FROM microsoft/dotnet:2.2-sdk +ARG BUILD_CONFIGURATION=Debug +ENV ASPNETCORE_ENVIRONMENT=Development +ENV DOTNET_USE_POLLING_FILE_WATCHER=true +EXPOSE 80 + +WORKDIR /src +COPY ["src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj", "src/ApiGateways/ApiGw-Base/"] +RUN dotnet restore "src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj" +COPY . . +WORKDIR "/src/src/ApiGateways/ApiGw-Base" +RUN dotnet build --no-restore "OcelotApiGw.csproj" -c $BUILD_CONFIGURATION + +ENTRYPOINT ["dotnet", "run", "--no-build", "--no-launch-profile", "-c", "$BUILD_CONFIGURATION", "--"] \ No newline at end of file diff --git a/src/ApiGateways/Mobile.Bff.Marketing/apigw/azds.yaml b/src/ApiGateways/Mobile.Bff.Marketing/apigw/azds.yaml new file mode 100644 index 000000000..46375343b --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Marketing/apigw/azds.yaml @@ -0,0 +1,44 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\..\ + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile +install: + chart: ../../../../k8s/helm/apigwmm + set: + replicaCount: 1 + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + # This expands to [space.s.]webmvc...aksapp.io + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - inf.yaml + - app.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile.develop + args: + BUILD_CONFIGURATION: ${BUILD_CONFIGURATION:-Debug} + container: + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: [dotnet, run, --no-restore, --no-build, --no-launch-profile, -c, "${BUILD_CONFIGURATION:-Debug}"] + iterate: + processesToKill: [dotnet, vsdbg] + buildCommands: + - [dotnet, build, --no-restore, -c, "${BUILD_CONFIGURATION:-Debug}"] diff --git a/src/ApiGateways/Mobile.Bff.Marketing/apigw/values.dev.yaml b/src/ApiGateways/Mobile.Bff.Marketing/apigw/values.dev.yaml new file mode 100644 index 000000000..fb59d98d5 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Marketing/apigw/values.dev.yaml @@ -0,0 +1,2 @@ +ocelot: + configPath: /src/src/ApiGateways/ApiGw-Base/configuration \ No newline at end of file diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop new file mode 100644 index 000000000..c4330c370 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile.develop @@ -0,0 +1,16 @@ +FROM microsoft/dotnet:2.2-sdk +ARG BUILD_CONFIGURATION=Debug +ENV ASPNETCORE_ENVIRONMENT=Development +ENV DOTNET_USE_POLLING_FILE_WATCHER=true +EXPOSE 80 + +WORKDIR /src +COPY ["src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj", "src/ApiGateways/Mobile.Bff.Shopping/aggregator/"] +COPY ["src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj", "src/BuildingBlocks/Devspaces.Support/"] + +RUN dotnet restore src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj -nowarn:msb3202,nu1503 +COPY . . +WORKDIR "/src/src/ApiGateways/Mobile.Bff.Shopping/aggregator" +RUN dotnet build --no-restore -c $BUILD_CONFIGURATION + +CMD ["dotnet", "run", "--no-build", "--no-launch-profile", "-c", "$BUILD_CONFIGURATION", "--"]] \ No newline at end of file diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj index fcb9fdf90..1dd1ba1b6 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj @@ -23,4 +23,8 @@ + + + + diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Properties/launchSettings.json b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Properties/launchSettings.json index 925e70b0d..c259d5094 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Properties/launchSettings.json +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Properties/launchSettings.json @@ -24,6 +24,13 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://localhost:61632/" + }, + "Azure Dev Spaces": { + "commandName": "AzureDevSpaces", + "launchBrowser": true, + "resourceGroup": "eshoptestedu", + "aksName": "eshoptestedu", + "subscriptionId": "e3035ac1-c06c-4daf-8939-57b3c5f1f759" } } } \ No newline at end of file diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs index 924b5b1aa..eee0d9c6e 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs @@ -20,6 +20,7 @@ using Swashbuckle.AspNetCore.Swagger; using HealthChecks.UI.Client; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Devspaces.Support; namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator { @@ -47,6 +48,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator services.AddCustomMvc(Configuration) .AddCustomAuthentication(Configuration) + .AddDevspaces() .AddHttpServices(); } @@ -188,15 +190,18 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator services.AddHttpClient() .AddHttpMessageHandler() .AddPolicyHandler(GetRetryPolicy()) - .AddPolicyHandler(GetCircuitBreakerPolicy()); + .AddPolicyHandler(GetCircuitBreakerPolicy()) + .AddDevspacesSupport(); services.AddHttpClient() .AddPolicyHandler(GetRetryPolicy()) - .AddPolicyHandler(GetCircuitBreakerPolicy()); + .AddPolicyHandler(GetCircuitBreakerPolicy()) + .AddDevspacesSupport(); services.AddHttpClient() .AddPolicyHandler(GetRetryPolicy()) - .AddPolicyHandler(GetCircuitBreakerPolicy()); + .AddPolicyHandler(GetCircuitBreakerPolicy()) + .AddDevspacesSupport(); return services; } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/azds.yaml b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/azds.yaml new file mode 100644 index 000000000..8dbac7128 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/azds.yaml @@ -0,0 +1,55 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\.. + dockerfile: Dockerfile +install: + chart: ../../../../k8s/helm/mobileshoppingagg + set: + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + # This expands to [space.s.]apigwms...aksapp.io + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - app.yaml + - inf.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: Dockerfile.develop + container: + syncTarget: /src + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: + - dotnet + - run + - --no-restore + - --no-build + - --no-launch-profile + - -c + - ${Configuration:-Debug} + iterate: + processesToKill: + - dotnet + - vsdbg + buildCommands: + - - dotnet + - build + - --no-restore + - -c + - ${Configuration:-Debug} diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/values.dev.yaml b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/values.dev.yaml new file mode 100644 index 000000000..eaed45149 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/values.dev.yaml @@ -0,0 +1,3 @@ +ingress: + enabled: true + tls: [] \ No newline at end of file diff --git a/src/ApiGateways/Mobile.Bff.Shopping/apigw/azds.yaml b/src/ApiGateways/Mobile.Bff.Shopping/apigw/azds.yaml new file mode 100644 index 000000000..9e2d09e42 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/apigw/azds.yaml @@ -0,0 +1,44 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\..\ + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile +install: + chart: ../../../../k8s/helm/apigwms + set: + replicaCount: 1 + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + # This expands to [space.s.]webmvc...aksapp.io + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - inf.yaml + - app.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile.develop + args: + BUILD_CONFIGURATION: ${BUILD_CONFIGURATION:-Debug} + container: + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: [dotnet, run, --no-restore, --no-build, --no-launch-profile, -c, "${BUILD_CONFIGURATION:-Debug}"] + iterate: + processesToKill: [dotnet, vsdbg] + buildCommands: + - [dotnet, build, --no-restore, -c, "${BUILD_CONFIGURATION:-Debug}"] diff --git a/src/ApiGateways/Mobile.Bff.Shopping/apigw/values.dev.yaml b/src/ApiGateways/Mobile.Bff.Shopping/apigw/values.dev.yaml new file mode 100644 index 000000000..fb59d98d5 --- /dev/null +++ b/src/ApiGateways/Mobile.Bff.Shopping/apigw/values.dev.yaml @@ -0,0 +1,2 @@ +ocelot: + configPath: /src/src/ApiGateways/ApiGw-Base/configuration \ No newline at end of file diff --git a/src/ApiGateways/Web.Bff.Marketing/apigw/azds.yaml b/src/ApiGateways/Web.Bff.Marketing/apigw/azds.yaml new file mode 100644 index 000000000..8f60cbcc7 --- /dev/null +++ b/src/ApiGateways/Web.Bff.Marketing/apigw/azds.yaml @@ -0,0 +1,44 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\..\ + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile +install: + chart: ../../../../k8s/helm/apigwwm + set: + replicaCount: 1 + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + # This expands to [space.s.]webmvc...aksapp.io + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - inf.yaml + - app.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile.develop + args: + BUILD_CONFIGURATION: ${BUILD_CONFIGURATION:-Debug} + container: + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: [dotnet, run, --no-restore, --no-build, --no-launch-profile, -c, "${BUILD_CONFIGURATION:-Debug}"] + iterate: + processesToKill: [dotnet, vsdbg] + buildCommands: + - [dotnet, build, --no-restore, -c, "${BUILD_CONFIGURATION:-Debug}"] diff --git a/src/ApiGateways/Web.Bff.Marketing/apigw/values.dev.yaml b/src/ApiGateways/Web.Bff.Marketing/apigw/values.dev.yaml new file mode 100644 index 000000000..fb59d98d5 --- /dev/null +++ b/src/ApiGateways/Web.Bff.Marketing/apigw/values.dev.yaml @@ -0,0 +1,2 @@ +ocelot: + configPath: /src/src/ApiGateways/ApiGw-Base/configuration \ No newline at end of file diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop new file mode 100644 index 000000000..3d0d16dd3 --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile.develop @@ -0,0 +1,16 @@ +FROM microsoft/dotnet:2.2-sdk +ARG BUILD_CONFIGURATION=Debug +ENV ASPNETCORE_ENVIRONMENT=Development +ENV DOTNET_USE_POLLING_FILE_WATCHER=true +EXPOSE 80 + +WORKDIR /src +COPY ["src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj", "src/ApiGateways/Web.Bff.Shopping/aggregator/"] +COPY ["src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj", "src/BuildingBlocks/Devspaces.Support/"] + +RUN dotnet restore src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj -nowarn:msb3202,nu1503 +COPY . . +WORKDIR "/src/src/ApiGateways/Web.Bff.Shopping/aggregator" +RUN dotnet build --no-restore -c $BUILD_CONFIGURATION + +CMD ["dotnet", "run", "--no-build", "--no-launch-profile", "-c", "$BUILD_CONFIGURATION", "--"]] \ No newline at end of file diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs index 6d3da29b7..dd5e1cc8c 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs @@ -21,6 +21,7 @@ using System.Net.Http; using HealthChecks.UI.Client; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Devspaces.Support; namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator { @@ -48,6 +49,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator services.AddCustomMvc(Configuration) .AddCustomAuthentication(Configuration) + .AddDevspaces() .AddApplicationServices(); } @@ -182,21 +184,23 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator services.AddSingleton(); //register http services - + services.AddHttpClient() .AddHttpMessageHandler() .AddPolicyHandler(GetRetryPolicy()) - .AddPolicyHandler(GetCircuitBreakerPolicy()); + .AddPolicyHandler(GetCircuitBreakerPolicy()) + .AddDevspacesSupport(); services.AddHttpClient() .AddPolicyHandler(GetRetryPolicy()) - .AddPolicyHandler(GetCircuitBreakerPolicy()); + .AddPolicyHandler(GetCircuitBreakerPolicy()) + .AddDevspacesSupport(); services.AddHttpClient() .AddHttpMessageHandler() .AddPolicyHandler(GetRetryPolicy()) - .AddPolicyHandler(GetCircuitBreakerPolicy()); - + .AddPolicyHandler(GetCircuitBreakerPolicy()) + .AddDevspacesSupport(); return services; } diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj b/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj index 53a6db8f9..d438e4602 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj @@ -22,4 +22,8 @@ + + + + diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/azds.yaml b/src/ApiGateways/Web.Bff.Shopping/aggregator/azds.yaml new file mode 100644 index 000000000..189d2261d --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/azds.yaml @@ -0,0 +1,55 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\.. + dockerfile: Dockerfile +install: + chart: ../../../../k8s/helm/webshoppingagg + set: + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + # This expands to [space.s.]apigwms...aksapp.io + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - app.yaml + - inf.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: Dockerfile.develop + container: + syncTarget: /src + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: + - dotnet + - run + - --no-restore + - --no-build + - --no-launch-profile + - -c + - ${Configuration:-Debug} + iterate: + processesToKill: + - dotnet + - vsdbg + buildCommands: + - - dotnet + - build + - --no-restore + - -c + - ${Configuration:-Debug} diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/values.dev.yaml b/src/ApiGateways/Web.Bff.Shopping/aggregator/values.dev.yaml new file mode 100644 index 000000000..45f664d6a --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/values.dev.yaml @@ -0,0 +1,2 @@ +ocelot: + configPath: /app/configuration \ No newline at end of file diff --git a/src/ApiGateways/Web.Bff.Shopping/apigw/azds.yaml b/src/ApiGateways/Web.Bff.Shopping/apigw/azds.yaml new file mode 100644 index 000000000..69f26cdca --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/apigw/azds.yaml @@ -0,0 +1,43 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\..\ + dockerfile: ..\..\..\..\ApiGateways\ApiGw-Base\Dockerfile +install: + chart: ../../../../k8s/helm/apigwws + set: + replicaCount: 1 + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - inf.yaml + - app.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: ..\..\..\ApiGateways\ApiGw-Base\Dockerfile.develop + args: + BUILD_CONFIGURATION: ${BUILD_CONFIGURATION:-Debug} + container: + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: [dotnet, run, --no-restore, --no-build, --no-launch-profile, -c, "${BUILD_CONFIGURATION:-Debug}"] + iterate: + processesToKill: [dotnet, vsdbg] + buildCommands: + - [dotnet, build, --no-restore, -c, "${BUILD_CONFIGURATION:-Debug}"] diff --git a/src/ApiGateways/Web.Bff.Shopping/apigw/values.dev.yaml b/src/ApiGateways/Web.Bff.Shopping/apigw/values.dev.yaml new file mode 100644 index 000000000..fb59d98d5 --- /dev/null +++ b/src/ApiGateways/Web.Bff.Shopping/apigw/values.dev.yaml @@ -0,0 +1,2 @@ +ocelot: + configPath: /src/src/ApiGateways/ApiGw-Base/configuration \ No newline at end of file diff --git a/src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj b/src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj new file mode 100644 index 000000000..81a897bad --- /dev/null +++ b/src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/src/BuildingBlocks/Devspaces.Support/DevspacesMessageHandler.cs b/src/BuildingBlocks/Devspaces.Support/DevspacesMessageHandler.cs new file mode 100644 index 000000000..0895b752a --- /dev/null +++ b/src/BuildingBlocks/Devspaces.Support/DevspacesMessageHandler.cs @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Devspaces.Support +{ + public class DevspacesMessageHandler : DelegatingHandler + { + private const string DevspacesHeaderName = "azds-route-as"; + private readonly IHttpContextAccessor _httpContextAccessor; + public DevspacesMessageHandler(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor; + } + + protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + var req = _httpContextAccessor.HttpContext.Request; + + if (req.Headers.ContainsKey(DevspacesHeaderName)) + { + request.Headers.Add(DevspacesHeaderName, req.Headers[DevspacesHeaderName] as IEnumerable); + } + return base.SendAsync(request, cancellationToken); + } + } +} diff --git a/src/BuildingBlocks/Devspaces.Support/HttpClientBuilderDevspacesExtensions.cs b/src/BuildingBlocks/Devspaces.Support/HttpClientBuilderDevspacesExtensions.cs new file mode 100644 index 000000000..60108301d --- /dev/null +++ b/src/BuildingBlocks/Devspaces.Support/HttpClientBuilderDevspacesExtensions.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Devspaces.Support +{ + public static class HttpClientBuilderDevspacesExtensions + { + public static IHttpClientBuilder AddDevspacesSupport(this IHttpClientBuilder builder) + { + builder.AddHttpMessageHandler(); + return builder; + } + } +} diff --git a/src/BuildingBlocks/Devspaces.Support/ServiceCollectionDevspacesExtensions.cs b/src/BuildingBlocks/Devspaces.Support/ServiceCollectionDevspacesExtensions.cs new file mode 100644 index 000000000..0ac5c9e1b --- /dev/null +++ b/src/BuildingBlocks/Devspaces.Support/ServiceCollectionDevspacesExtensions.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Devspaces.Support +{ + public static class ServiceCollectionDevspacesExtensions + { + public static IServiceCollection AddDevspaces(this IServiceCollection services) + { + services.AddTransient(); + return services; + } + } +} diff --git a/src/Services/Basket/Basket.API/.dockerignore b/src/Services/Basket/Basket.API/.dockerignore new file mode 100644 index 000000000..04f7b133d --- /dev/null +++ b/src/Services/Basket/Basket.API/.dockerignore @@ -0,0 +1,14 @@ +.dockerignore +.git +.gitignore +.vs +.vscode +**/*.*proj.user +**/azds.yaml +**/bin +**/charts +**/Dockerfile +**/Dockerfile.develop +**/obj +**/secrets.dev.yaml +**/values.dev.yaml \ No newline at end of file diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 7bab4e969..69f601579 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -41,14 +41,14 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers { var basket = await _repository.GetBasketAsync(id); - return basket ?? new CustomerBasket(id); + return Ok(basket ?? new CustomerBasket(id)); } [HttpPost] [ProducesResponseType(typeof(CustomerBasket), (int)HttpStatusCode.OK)] public async Task> UpdateBasketAsync([FromBody]CustomerBasket value) { - return await _repository.UpdateBasketAsync(value); + return Ok(await _repository.UpdateBasketAsync(value)); } [Route("checkout")] diff --git a/src/Services/Basket/Basket.API/Dockerfile.develop b/src/Services/Basket/Basket.API/Dockerfile.develop new file mode 100644 index 000000000..5ae5cc235 --- /dev/null +++ b/src/Services/Basket/Basket.API/Dockerfile.develop @@ -0,0 +1,19 @@ +FROM microsoft/dotnet:2.2-sdk +ARG BUILD_CONFIGURATION=Debug +ENV ASPNETCORE_ENVIRONMENT=Development +ENV DOTNET_USE_POLLING_FILE_WATCHER=true +EXPOSE 80 + +WORKDIR /src + +COPY ["src/BuildingBlocks/EventBus/EventBus/EventBus.csproj", "src/BuildingBlocks/EventBus/EventBus/"] +COPY ["src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj", "src/BuildingBlocks/EventBus/EventBusRabbitMQ/"] +COPY ["src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj", "src/BuildingBlocks/EventBus/EventBusServiceBus/"] +COPY ["src/Services/Basket/Basket.API/Basket.API.csproj", "src/Services/Basket/Basket.API/"] + +RUN dotnet restore src/Services/Basket/Basket.API/Basket.API.csproj -nowarn:msb3202,nu1503 +COPY . . +WORKDIR /src/src/Services/Basket/Basket.API +RUN dotnet build --no-restore -c $BUILD_CONFIGURATION + +ENTRYPOINT ["dotnet", "run", "--no-build", "--no-launch-profile", "-c", "$BUILD_CONFIGURATION", "--"] \ No newline at end of file diff --git a/src/Services/Basket/Basket.API/azds.yaml b/src/Services/Basket/Basket.API/azds.yaml new file mode 100644 index 000000000..4fbbb7be4 --- /dev/null +++ b/src/Services/Basket/Basket.API/azds.yaml @@ -0,0 +1,56 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\.. + dockerfile: Dockerfile +install: + chart: ../../../../k8s/helm/basket-api + set: + replicaCount: 1 + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - inf.yaml + - app.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: Dockerfile.develop + args: + BUILD_CONFIGURATION: ${BUILD_CONFIGURATION:-Debug} + container: + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: + - dotnet + - run + - --no-restore + - --no-build + - --no-launch-profile + - -c + - ${BUILD_CONFIGURATION:-Debug} + iterate: + processesToKill: + - dotnet + - vsdbg + buildCommands: + - - dotnet + - build + - --no-restore + - -c + - ${BUILD_CONFIGURATION:-Debug} diff --git a/src/Services/Basket/Basket.API/values.dev.yaml b/src/Services/Basket/Basket.API/values.dev.yaml new file mode 100644 index 000000000..eaed45149 --- /dev/null +++ b/src/Services/Basket/Basket.API/values.dev.yaml @@ -0,0 +1,3 @@ +ingress: + enabled: true + tls: [] \ No newline at end of file diff --git a/src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj b/src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj index e781b218d..4fd8cb9ec 100644 --- a/src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj +++ b/src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj @@ -17,6 +17,8 @@ + + diff --git a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs index d9fa4002e..5dfb10a96 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs @@ -60,6 +60,15 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers .Take(pageSize) .ToListAsync(); + /* The "awesome" fix for testing Devspaces */ + + /* + foreach (var pr in itemsOnPage) { + pr.Name = "Awesome " + pr.Name; + } + + */ + itemsOnPage = ChangeUriPlaceholder(itemsOnPage); var model = new PaginatedItemsViewModel(pageIndex, pageSize, totalItems, itemsOnPage); diff --git a/src/Services/Catalog/Catalog.API/Dockerfile.develop b/src/Services/Catalog/Catalog.API/Dockerfile.develop new file mode 100644 index 000000000..11034a2bc --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Dockerfile.develop @@ -0,0 +1,21 @@ +FROM microsoft/dotnet:2.2-sdk +ARG BUILD_CONFIGURATION=Debug +ENV ASPNETCORE_ENVIRONMENT=Development +ENV DOTNET_USE_POLLING_FILE_WATCHER=true +EXPOSE 80 + +WORKDIR /src + +COPY ["src/BuildingBlocks/EventBus/EventBus/EventBus.csproj", "src/BuildingBlocks/EventBus/EventBus/"] +COPY ["src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj", "src/BuildingBlocks/EventBus/EventBusRabbitMQ/"] +COPY ["src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj", "src/BuildingBlocks/EventBus/EventBusServiceBus/"] +COPY ["src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj", "src/BuildingBlocks/EventBus/IntegrationEventLogEF/"] +COPY ["src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj", "src/BuildingBlocks/WebHostCustomization/WebHost.Customization/"] +COPY ["src/Services/Catalog/Catalog.API/Catalog.API.csproj", "src/Services/Catalog/Catalog.API/"] + +RUN dotnet restore src/Services/Catalog/Catalog.API/Catalog.API.csproj -nowarn:msb3202,nu1503 +COPY . . +WORKDIR "/src/src/Services/Catalog/Catalog.API" +RUN dotnet build --no-restore -c $BUILD_CONFIGURATION + +ENTRYPOINT ["dotnet", "run", "--no-build", "--no-launch-profile", "-c", "$BUILD_CONFIGURATION", "--"] \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Properties/launchSettings.json b/src/Services/Catalog/Catalog.API/Properties/launchSettings.json index 3aaed933a..f842f80d0 100644 --- a/src/Services/Catalog/Catalog.API/Properties/launchSettings.json +++ b/src/Services/Catalog/Catalog.API/Properties/launchSettings.json @@ -27,6 +27,13 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Azure Dev Spaces": { + "commandName": "AzureDevSpaces", + "launchBrowser": true, + "resourceGroup": "edu-devspaces3", + "aksName": "edu-devspaces3", + "subscriptionId": "e3035ac1-c06c-4daf-8939-57b3c5f1f759" } } } \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/azds.yaml b/src/Services/Catalog/Catalog.API/azds.yaml new file mode 100644 index 000000000..9f98a3793 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/azds.yaml @@ -0,0 +1,54 @@ +kind: helm-release +apiVersion: 1.1 +build: + context: ..\..\..\.. + dockerfile: Dockerfile +install: + chart: ../../../../k8s/helm/catalog-api + set: + image: + tag: $(tag) + pullPolicy: Never + ingress: + annotations: + kubernetes.io/ingress.class: traefik-azds + hosts: + - $(spacePrefix)eshop$(hostSuffix) + inf: + k8s: + dns: $(spacePrefix)eshop$(hostSuffix) + values: + - values.dev.yaml? + - secrets.dev.yaml? + - inf.yaml + - app.yaml +configurations: + develop: + build: + useGitIgnore: true + dockerfile: Dockerfile.develop + container: + syncTarget: /src + sync: + - '**/Pages/**' + - '**/Views/**' + - '**/wwwroot/**' + - '!**/*.{sln,csproj}' + command: + - dotnet + - run + - --no-restore + - --no-build + - --no-launch-profile + - -c + - ${Configuration:-Debug} + iterate: + processesToKill: + - dotnet + - vsdbg + buildCommands: + - - dotnet + - build + - --no-restore + - -c + - ${Configuration:-Debug} diff --git a/src/Services/Catalog/Catalog.API/values.dev.yaml b/src/Services/Catalog/Catalog.API/values.dev.yaml new file mode 100644 index 000000000..eaed45149 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/values.dev.yaml @@ -0,0 +1,3 @@ +ingress: + enabled: true + tls: [] \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj b/src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj index 07e9e2991..455dfb0bc 100644 --- a/src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj +++ b/src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj @@ -33,6 +33,8 @@ + + diff --git a/src/Services/Identity/Identity.API/.dockerignore b/src/Services/Identity/Identity.API/.dockerignore new file mode 100644 index 000000000..04f7b133d --- /dev/null +++ b/src/Services/Identity/Identity.API/.dockerignore @@ -0,0 +1,14 @@ +.dockerignore +.git +.gitignore +.vs +.vscode +**/*.*proj.user +**/azds.yaml +**/bin +**/charts +**/Dockerfile +**/Dockerfile.develop +**/obj +**/secrets.dev.yaml +**/values.dev.yaml \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Devspaces/DevspacesRedirectUriValidator.cs b/src/Services/Identity/Identity.API/Devspaces/DevspacesRedirectUriValidator.cs new file mode 100644 index 000000000..53e497b59 --- /dev/null +++ b/src/Services/Identity/Identity.API/Devspaces/DevspacesRedirectUriValidator.cs @@ -0,0 +1,31 @@ +using IdentityServer4.Models; +using IdentityServer4.Validation; +using Microsoft.Extensions.Logging; +using System.Threading.Tasks; + + +namespace Microsoft.eShopOnContainers.Services.Identity.API.Devspaces +{ + public class DevspacesRedirectUriValidator : IRedirectUriValidator + { + private readonly ILogger _logger; + public DevspacesRedirectUriValidator(ILogger logger) + { + _logger = logger; + } + + public Task IsPostLogoutRedirectUriValidAsync(string requestedUri, Client client) + { + + _logger.LogInformation($"Client {client.ClientName} used post logout uri {requestedUri}."); + return Task.FromResult(true); + } + + public Task IsRedirectUriValidAsync(string requestedUri, Client client) + { + _logger.LogInformation($"Client {client.ClientName} used redirect uri {requestedUri}."); + return Task.FromResult(true); + } + + } +} \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Devspaces/IdentityDevspacesBuilderExtensions.cs b/src/Services/Identity/Identity.API/Devspaces/IdentityDevspacesBuilderExtensions.cs new file mode 100644 index 000000000..4dadb0e54 --- /dev/null +++ b/src/Services/Identity/Identity.API/Devspaces/IdentityDevspacesBuilderExtensions.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.eShopOnContainers.Services.Identity.API.Devspaces +{ + static class IdentityDevspacesBuilderExtensions + { + public static IIdentityServerBuilder AddDevspacesIfNeeded(this IIdentityServerBuilder builder, bool useDevspaces) + { + if (useDevspaces) + { + builder.AddRedirectUriValidator(); + } + return builder; + } + } +} diff --git a/src/Services/Identity/Identity.API/Dockerfile.develop b/src/Services/Identity/Identity.API/Dockerfile.develop new file mode 100644 index 000000000..3ab1fbe7c --- /dev/null +++ b/src/Services/Identity/Identity.API/Dockerfile.develop @@ -0,0 +1,15 @@ +FROM microsoft/dotnet:2.2-sdk +ARG BUILD_CONFIGURATION=Debug +ENV ASPNETCORE_ENVIRONMENT=Development +ENV DOTNET_USE_POLLING_FILE_WATCHER=true +EXPOSE 80 + +WORKDIR /src +COPY ["src/Services/Identity/Identity.API/Identity.API.csproj", "src/Services/Identity/Identity.API/"] +COPY ["src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj", "src/BuildingBlocks/WebHostCustomization/WebHost.Customization/"] +RUN dotnet restore src/Services/Identity/Identity.API/Identity.API.csproj -nowarn:msb3202,nu1503 +COPY . . +WORKDIR "/src/src/Services/Identity/Identity.API" +RUN dotnet build --no-restore -c $BUILD_CONFIGURATION + +ENTRYPOINT ["dotnet", "run", "--no-build", "--no-launch-profile", "-c", "$BUILD_CONFIGURATION", "--"] diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index e672bab60..6ea7e3888 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -13,6 +13,7 @@ using Microsoft.eShopOnContainers.Services.Identity.API.Certificates; using Microsoft.eShopOnContainers.Services.Identity.API.Data; using Microsoft.eShopOnContainers.Services.Identity.API.Models; using Microsoft.eShopOnContainers.Services.Identity.API.Services; +using Microsoft.eShopOnContainers.Services.Identity.API.Devspaces; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -85,6 +86,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API x.IssuerUri = "null"; x.Authentication.CookieLifetime = TimeSpan.FromHours(2); }) + .AddDevspacesIfNeeded(Configuration.GetValue("EnableDevspaces", false)) .AddSigningCredential(Certificate.Get()) .AddAspNetIdentity() .AddConfigurationStore(options => diff --git a/src/Services/Identity/Identity.API/Views/Shared/_LoginPartial.cshtml b/src/Services/Identity/Identity.API/Views/Shared/_LoginPartial.cshtml index 3d0a461f5..e110e459c 100644 --- a/src/Services/Identity/Identity.API/Views/Shared/_LoginPartial.cshtml +++ b/src/Services/Identity/Identity.API/Views/Shared/_LoginPartial.cshtml @@ -7,7 +7,7 @@ @if (SignInManager.IsSignedIn(User)) { -