diff --git a/.gitattributes b/.gitattributes index f2943e52e..1afa507c8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -69,3 +69,15 @@ ############################################################################### *.pfx binary +################################################################################ +# Ocelot config files are shared via volumes, so its EOL are important +################################################################################ +/src/Apigw/configs/linux/mobilemarketingapigw/configuration.json text eol=lf +/src/Apigw/configs/linux/mobileshoppingapigw/configuration.json text eol=lf +/src/Apigw/configs/linux/webmarketingapigw/configuration.json text eol=lf +/src/Apigw/configs/linux/webshoppingapigw/configuration.json text eol=lf + +/src/Apigw/configs/windows/mobilemarketingapigw/configuration.json text eol=crlf +/src/Apigw/configs/windows/mobileshoppingapigw/configuration.json text eol=crlf +/src/Apigw/configs/windows/webmarketingapigw/configuration.json text eol=crlf +/src/Apigw/configs/windows/webshoppingapigw/configuration.json text eol=crlf \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml index b6347824f..152d2ec0e 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -218,12 +218,42 @@ services: - "15672:15672" - "5672:5672" - apigw: + mobileshoppingapigw: environment: - ASPNETCORE_ENVIRONMENT=Development - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. ports: - "5200:80" + volumes: + - ./src/Apigw/configs/mobileshoppingapigw:/app/configuration + + mobilemarketingapigw: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + ports: + - "5201:80" + volumes: + - ./src/Apigw/configs/mobilemarketingapigw:/app/configuration + + webshoppingapigw: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + ports: + - "5202:80" + volumes: + - ./src/Apigw/configs/webshoppingapigw:/app/configuration + + + webmarketingapigw: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + ports: + - "5203:80" + volumes: + - ./src/Apigw/configs/webmarketingapigw:/app/configuration mobileshoppingagg: environment: diff --git a/docker-compose.yml b/docker-compose.yml index 672790166..4b2fb7a1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -108,7 +108,25 @@ services: rabbitmq: image: rabbitmq:3-management-alpine - apigw: + mobileshoppingapigw: + image: eshop/ocelotapigw + build: + context: . + dockerfile: src/Apigw/OcelotApiGw/Dockerfile + + mobilemarketingapigw: + image: eshop/ocelotapigw + build: + context: . + dockerfile: src/Apigw/OcelotApiGw/Dockerfile + + webshoppingapigw: + image: eshop/ocelotapigw + build: + context: . + dockerfile: src/Apigw/OcelotApiGw/Dockerfile + + webmarketingapigw: image: eshop/ocelotapigw build: context: . diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index fc72b85f6..d274f804e 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -105,6 +105,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aggregators", "Aggregators" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mobile.Shopping.HttpAggregator", "src\Aggregators\Mobile.Shopping.HttpAggregator\Mobile.Shopping.HttpAggregator.csproj", "{6E99F232-1536-424F-A28C-91692C8FD325}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "configs", "configs", "{D8D24753-8421-40EE-8FE5-B8BE06A07AC5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MobileBff.Shopping.ApiGw", "MobileBff.Shopping.ApiGw", "{DAEA3807-1578-4B43-9033-E400FAF1DC49}" + ProjectSection(SolutionItems) = preProject + src\Apigw\configs\mobileshoppingapigw\configuration.json = src\Apigw\configs\mobileshoppingapigw\configuration.json + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MobileBff.Marketing.ApiGw", "MobileBff.Marketing.ApiGw", "{AC3EDABD-8EB0-4045-BC12-39865490A79D}" + ProjectSection(SolutionItems) = preProject + src\Apigw\configs\mobilemarketingapigw\configuration.json = src\Apigw\configs\mobilemarketingapigw\configuration.json + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -1465,6 +1477,9 @@ Global {E0C5162E-DF26-4341-9E51-14AE800D7505} = {7A58AA20-67F3-48F3-88C8-24EBFE621792} {EA378316-9D49-4A6B-858E-D4A25F948A74} = {932D8224-11F6-4D07-B109-DA28AD288A63} {6E99F232-1536-424F-A28C-91692C8FD325} = {EA378316-9D49-4A6B-858E-D4A25F948A74} + {D8D24753-8421-40EE-8FE5-B8BE06A07AC5} = {7A58AA20-67F3-48F3-88C8-24EBFE621792} + {DAEA3807-1578-4B43-9033-E400FAF1DC49} = {D8D24753-8421-40EE-8FE5-B8BE06A07AC5} + {AC3EDABD-8EB0-4045-BC12-39865490A79D} = {D8D24753-8421-40EE-8FE5-B8BE06A07AC5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} diff --git a/src/Apigw/configs/linux/mobilemarketingapigw/configuration.json b/src/Apigw/configs/linux/mobilemarketingapigw/configuration.json new file mode 100644 index 000000000..22fdca1b2 --- /dev/null +++ b/src/Apigw/configs/linux/mobilemarketingapigw/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Apigw/configs/linux/mobileshoppingapigw/configuration.json b/src/Apigw/configs/linux/mobileshoppingapigw/configuration.json new file mode 100644 index 000000000..22fdca1b2 --- /dev/null +++ b/src/Apigw/configs/linux/mobileshoppingapigw/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Apigw/configs/linux/webmarketingapigw/configuration.json b/src/Apigw/configs/linux/webmarketingapigw/configuration.json new file mode 100644 index 000000000..22fdca1b2 --- /dev/null +++ b/src/Apigw/configs/linux/webmarketingapigw/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Apigw/OcelotApiGw/configuration/configuration.json b/src/Apigw/configs/linux/webshoppingapigw/configuration.json similarity index 100% rename from src/Apigw/OcelotApiGw/configuration/configuration.json rename to src/Apigw/configs/linux/webshoppingapigw/configuration.json diff --git a/src/Apigw/configs/windows/mobilemarketingapigw/configuration.json b/src/Apigw/configs/windows/mobilemarketingapigw/configuration.json new file mode 100644 index 000000000..22fdca1b2 --- /dev/null +++ b/src/Apigw/configs/windows/mobilemarketingapigw/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Apigw/configs/windows/mobileshoppingapigw/configuration.json b/src/Apigw/configs/windows/mobileshoppingapigw/configuration.json new file mode 100644 index 000000000..22fdca1b2 --- /dev/null +++ b/src/Apigw/configs/windows/mobileshoppingapigw/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Apigw/configs/windows/webmarketingapigw/configuration.json b/src/Apigw/configs/windows/webmarketingapigw/configuration.json new file mode 100644 index 000000000..22fdca1b2 --- /dev/null +++ b/src/Apigw/configs/windows/webmarketingapigw/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Apigw/configs/windows/webshoppingapigw/configuration.json b/src/Apigw/configs/windows/webshoppingapigw/configuration.json new file mode 100644 index 000000000..80d3f1116 --- /dev/null +++ b/src/Apigw/configs/windows/webshoppingapigw/configuration.json @@ -0,0 +1,142 @@ +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/shopping/api/{version}/c/{everything}", + "UpstreamHttpMethod": [ "GET" ] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/shopping/api/{version}/b/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/shopping/api/{version}/o/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "mobileshoppingagg", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/shopping/{everything}", + "UpstreamHttpMethod": [ "POST", "PUT", "GET" ], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/orders-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/basket-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/catalog-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/marketing-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "payment.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/payment-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/location-api/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } + } + \ No newline at end of file