From 60db144c98c2064a6f88f3748c56805169b76525 Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 12:28:00 +0100 Subject: [PATCH 1/7] use mac ip --- src/.env | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/.env b/src/.env index 3aac89a3f..6319fbe04 100644 --- a/src/.env +++ b/src/.env @@ -5,12 +5,12 @@ # The IP below should be swapped to your real IP or DNS name, like 192.168.88.248, etc. if testing from remote browsers or mobile devices # Use this values to run the app locally in Windows -ESHOP_EXTERNAL_DNS_NAME_OR_IP=host.docker.internal -ESHOP_STORAGE_CATALOG_URL=http://host.docker.internal:5202/c/api/v1/catalog/items/[0]/pic/ +# ESHOP_EXTERNAL_DNS_NAME_OR_IP=host.docker.internal +# ESHOP_STORAGE_CATALOG_URL=http://host.docker.internal:5202/c/api/v1/catalog/items/[0]/pic/ # Use this values to run the app locally in Mac -# ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.mac.localhost -# ESHOP_STORAGE_CATALOG_URL=http://docker.for.mac.localhost:5202/c/api/v1/catalog/items/[0]/pic/ +ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.mac.localhost +ESHOP_STORAGE_CATALOG_URL=http://docker.for.mac.localhost:5202/c/api/v1/catalog/items/[0]/pic/ # Use this values to run the app locally in Linux # ESHOP_EXTERNAL_DNS_NAME_OR_IP=docker.for.linux.localhost From e5f7d835e69b09f9bedbc9fff3d0d800ce796317 Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 12:31:18 +0100 Subject: [PATCH 2/7] M1 fix: use Azure SQL Edge instead of SQL Server + use newer Envoy version --- src/docker-compose-tests.yml | 2 +- src/docker-compose.windows.yml | 2 +- src/docker-compose.yml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/docker-compose-tests.yml b/src/docker-compose-tests.yml index 82fee17db..95913cfee 100644 --- a/src/docker-compose-tests.yml +++ b/src/docker-compose-tests.yml @@ -2,7 +2,7 @@ version: '3.4' services: sql-data-test: - image: mcr.microsoft.com/mssql/server:2019-latest + image: mcr.microsoft.com/azure-sql-edge:latest nosql-data-test: image: mongo diff --git a/src/docker-compose.windows.yml b/src/docker-compose.windows.yml index 11ecfa3cd..ef3210394 100644 --- a/src/docker-compose.windows.yml +++ b/src/docker-compose.windows.yml @@ -6,7 +6,7 @@ version: '3.4' services: sqldata: - image: mcr.microsoft.com/mssql/server:2019-latest + image: mcr.microsoft.com/azure-sql-edge:latest nosqldata: image: mongo:windowsservercore diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 3ae5d431a..ea9985ab1 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -6,8 +6,8 @@ services: image: datalust/seq:latest sqldata: - image: mcr.microsoft.com/mssql/server:2019-latest - + image: mcr.microsoft.com/azure-sql-edge:latest + nosqldata: image: mongo @@ -79,7 +79,7 @@ services: - sqldata mobileshoppingapigw: - image: envoyproxy/envoy:v1.11.1 + image: envoyproxy/envoy:v1.16.0 mobileshoppingagg: image: ${REGISTRY:-eshop}/mobileshoppingagg:${PLATFORM:-linux}-${TAG:-latest} @@ -158,4 +158,4 @@ services: - webhooks-api webshoppingapigw: - image: envoyproxy/envoy:v1.11.1 + image: envoyproxy/envoy:v1.16.0 From 0ab118a06468aaafeb8cc17910a637149bf2ed7e Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 12:37:18 +0100 Subject: [PATCH 3/7] disable frontend containers in docker-compose --- src/docker-compose.override.yml | 297 ++++++++++++++++---------------- src/docker-compose.prod.yml | 184 ++++++++++---------- src/docker-compose.yml | 178 +++++++++---------- 3 files changed, 330 insertions(+), 329 deletions(-) diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index 421231107..89b3e9925 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -160,155 +160,156 @@ services: ports: - "5108:80" - webhooks-api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_WEBHOOKS_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.WebhooksDb;User Id=sa;Password=Pass@word;Encrypt=False} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - - IdentityUrl=http://identity-api - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - ports: - - "5113:80" - - mobileshoppingapigw: - volumes: - - ./ApiGateways/Envoy/config/mobileshopping:/etc/envoy - ports: - - "5200:80" - - "15200:8001" - - webshoppingapigw: - volumes: - - ./ApiGateways/Envoy/config/webshopping:/etc/envoy - ports: - - "5202:80" - - "15202:8001" - - mobileshoppingagg: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - urls__basket=http://basket-api - - urls__catalog=http://catalog-api - - urls__orders=http://ordering-api - - urls__identity=http://identity-api - - urls__grpcBasket=http://basket-api:81 - - urls__grpcCatalog=http://catalog-api:81 - - urls__grpcOrdering=http://ordering-api:81 - - CatalogUrlHC=http://catalog-api/hc - - OrderingUrlHC=http://ordering-api/hc - - IdentityUrlHC=http://identity-api/hc - - BasketUrlHC=http://basket-api/hc - - PaymentUrlHC=http://payment-api/hc - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - ports: - - "5120:80" - - webshoppingagg: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - urls__basket=http://basket-api - - urls__catalog=http://catalog-api - - urls__orders=http://ordering-api - - urls__identity=http://identity-api - - urls__grpcBasket=http://basket-api:81 - - urls__grpcCatalog=http://catalog-api:81 - - urls__grpcOrdering=http://ordering-api:81 - - CatalogUrlHC=http://catalog-api/hc - - OrderingUrlHC=http://ordering-api/hc - - IdentityUrlHC=http://identity-api/hc - - BasketUrlHC=http://basket-api/hc - - PaymentUrlHC=http://payment-api/hc - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - ports: - - "5121:80" - - ordering-signalrhub: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - - AzureServiceBusEnabled=False - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - - identityUrl=http://identity-api - ports: - - "5112:80" - - webstatus: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - HealthChecksUI__HealthChecks__0__Name=WebMVC HTTP Check - - HealthChecksUI__HealthChecks__0__Uri=http://webmvc/hc - - HealthChecksUI__HealthChecks__1__Name=WebSPA HTTP Check - - HealthChecksUI__HealthChecks__1__Uri=http://webspa/hc - - HealthChecksUI__HealthChecks__2__Name=Web Shopping Aggregator GW HTTP Check - - HealthChecksUI__HealthChecks__2__Uri=http://webshoppingagg/hc - - HealthChecksUI__HealthChecks__3__Name=Mobile Shopping Aggregator HTTP Check - - HealthChecksUI__HealthChecks__3__Uri=http://mobileshoppingagg/hc - - HealthChecksUI__HealthChecks__4__Name=Ordering HTTP Check - - HealthChecksUI__HealthChecks__4__Uri=http://ordering-api/hc - - HealthChecksUI__HealthChecks__5__Name=Basket HTTP Check - - HealthChecksUI__HealthChecks__5__Uri=http://basket-api/hc - - HealthChecksUI__HealthChecks__6__Name=Catalog HTTP Check - - HealthChecksUI__HealthChecks__6__Uri=http://catalog-api/hc - - HealthChecksUI__HealthChecks__7__Name=Identity HTTP Check - - HealthChecksUI__HealthChecks__7__Uri=http://identity-api/hc - - HealthChecksUI__HealthChecks__8__Name=Payments HTTP Check - - HealthChecksUI__HealthChecks__8__Uri=http://payment-api/hc - - HealthChecksUI__HealthChecks__9__Name=Ordering SignalRHub HTTP Check - - HealthChecksUI__HealthChecks__9__Uri=http://ordering-signalrhub/hc - - HealthChecksUI__HealthChecks__10__Name=Ordering HTTP Background Check - - HealthChecksUI__HealthChecks__10__Uri=http://ordering-backgroundtasks/hc - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - ports: - - "5107:80" +# webhooks-api: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - ConnectionString=${ESHOP_AZURE_WEBHOOKS_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.WebhooksDb;User Id=sa;Password=Pass@word;Encrypt=False} +# - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} +# - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} +# - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} +# - IdentityUrl=http://identity-api +# - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 +# ports: +# - "5113:80" +# +# mobileshoppingapigw: +# volumes: +# - ./ApiGateways/Envoy/config/mobileshopping:/etc/envoy +# ports: +# - "5200:80" +# - "15200:8001" +# +# webshoppingapigw: +# volumes: +# - ./ApiGateways/Envoy/config/webshopping:/etc/envoy +# ports: +# - "5202:80" +# - "15202:8001" +# +# mobileshoppingagg: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - urls__basket=http://basket-api +# - urls__catalog=http://catalog-api +# - urls__orders=http://ordering-api +# - urls__identity=http://identity-api +# - urls__grpcBasket=http://basket-api:81 +# - urls__grpcCatalog=http://catalog-api:81 +# - urls__grpcOrdering=http://ordering-api:81 +# - CatalogUrlHC=http://catalog-api/hc +# - OrderingUrlHC=http://ordering-api/hc +# - IdentityUrlHC=http://identity-api/hc +# - BasketUrlHC=http://basket-api/hc +# - PaymentUrlHC=http://payment-api/hc +# - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 +# ports: +# - "5120:80" +# +# webshoppingagg: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - urls__basket=http://basket-api +# - urls__catalog=http://catalog-api +# - urls__orders=http://ordering-api +# - urls__identity=http://identity-api +# - urls__grpcBasket=http://basket-api:81 +# - urls__grpcCatalog=http://catalog-api:81 +# - urls__grpcOrdering=http://ordering-api:81 +# - CatalogUrlHC=http://catalog-api/hc +# - OrderingUrlHC=http://ordering-api/hc +# - IdentityUrlHC=http://identity-api/hc +# - BasketUrlHC=http://basket-api/hc +# - PaymentUrlHC=http://payment-api/hc +# - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 +# ports: +# - "5121:80" +# +# ordering-signalrhub: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} +# - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} +# - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} +# - AzureServiceBusEnabled=False +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# - identityUrl=http://identity-api +# ports: +# - "5112:80" +# +# webstatus: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - HealthChecksUI__HealthChecks__0__Name=WebMVC HTTP Check +# - HealthChecksUI__HealthChecks__0__Uri=http://webmvc/hc +# - HealthChecksUI__HealthChecks__1__Name=WebSPA HTTP Check +# - HealthChecksUI__HealthChecks__1__Uri=http://webspa/hc +# - HealthChecksUI__HealthChecks__2__Name=Web Shopping Aggregator GW HTTP Check +# - HealthChecksUI__HealthChecks__2__Uri=http://webshoppingagg/hc +# - HealthChecksUI__HealthChecks__3__Name=Mobile Shopping Aggregator HTTP Check +# - HealthChecksUI__HealthChecks__3__Uri=http://mobileshoppingagg/hc +# - HealthChecksUI__HealthChecks__4__Name=Ordering HTTP Check +# - HealthChecksUI__HealthChecks__4__Uri=http://ordering-api/hc +# - HealthChecksUI__HealthChecks__5__Name=Basket HTTP Check +# - HealthChecksUI__HealthChecks__5__Uri=http://basket-api/hc +# - HealthChecksUI__HealthChecks__6__Name=Catalog HTTP Check +# - HealthChecksUI__HealthChecks__6__Uri=http://catalog-api/hc +# - HealthChecksUI__HealthChecks__7__Name=Identity HTTP Check +# - HealthChecksUI__HealthChecks__7__Uri=http://identity-api/hc +# - HealthChecksUI__HealthChecks__8__Name=Payments HTTP Check +# - HealthChecksUI__HealthChecks__8__Uri=http://payment-api/hc +# - HealthChecksUI__HealthChecks__9__Name=Ordering SignalRHub HTTP Check +# - HealthChecksUI__HealthChecks__9__Uri=http://ordering-signalrhub/hc +# - HealthChecksUI__HealthChecks__10__Name=Ordering HTTP Background Check +# - HealthChecksUI__HealthChecks__10__Uri=http://ordering-backgroundtasks/hc +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# ports: +# - "5107:80" +# +# webspa: +# environment: +# - ASPNETCORE_ENVIRONMENT=Production +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 +# - PurchaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202 +# - IdentityUrlHC=http://identity-api/hc +# - UseCustomizationData=True +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# - SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202 +# ports: +# - "5104:80" +# +# webmvc: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - PurchaseUrl=http://webshoppingapigw +# - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 +# - SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202 +# - IdentityUrlHC=http://identity-api/hc +# - UseCustomizationData=True +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# - UseLoadTest=${USE_LOADTEST:-False} +# ports: +# - "5100:80" +# +# webhooks-client: +# environment: +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - Token=6168DB8D-DC58-4094-AF24-483278923590 # Webhooks are registered with this token (any value is valid) but the client won't check it +# - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 +# - CallBackUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5114 +# - WebhooksUrl=http://webhooks-api +# - SelfUrl=http://webhooks-client/ +# ports: +# - "5114:80" - webspa: - environment: - - ASPNETCORE_ENVIRONMENT=Production - - ASPNETCORE_URLS=http://0.0.0.0:80 - - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - PurchaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202 - - IdentityUrlHC=http://identity-api/hc - - UseCustomizationData=True - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - - SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202 - ports: - - "5104:80" - - webmvc: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - PurchaseUrl=http://webshoppingapigw - - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - SignalrHubUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202 - - IdentityUrlHC=http://identity-api/hc - - UseCustomizationData=True - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - - UseLoadTest=${USE_LOADTEST:-False} - ports: - - "5100:80" - - webhooks-client: - environment: - - ASPNETCORE_URLS=http://0.0.0.0:80 - - Token=6168DB8D-DC58-4094-AF24-483278923590 # Webhooks are registered with this token (any value is valid) but the client won't check it - - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - CallBackUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5114 - - WebhooksUrl=http://webhooks-api - - SelfUrl=http://webhooks-client/ - ports: - - "5114:80" volumes: eshop-sqldata: external: false diff --git a/src/docker-compose.prod.yml b/src/docker-compose.prod.yml index 3ff3aa2f2..ae62f1a36 100644 --- a/src/docker-compose.prod.yml +++ b/src/docker-compose.prod.yml @@ -107,56 +107,56 @@ services: ports: - "5111:80" - webspa: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - PurchaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5202 - - CatalogUrlHC=http://catalog-api/hc - - OrderingUrlHC=http://ordering-api/hc - - IdentityUrlHC=http://identity-api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. - - BasketUrlHC=http://basket-api/hc - - PaymentUrlHC=http://payment-api/hc - - UseCustomizationData=True - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - ports: - - "5104:80" - - webmvc: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - PurchaseUrl=http://webshoppingapigw - - IdentityUrl=http://10.0.75.1:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. - - CatalogUrlHC=http://catalog-api/hc - - OrderingUrlHC=http://ordering-api/hc - - IdentityUrlHC=http://identity-api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. - - BasketUrlHC=http://basket-api/hc - - PaymentUrlHC=http://payment-api/hc - - UseCustomizationData=True - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - - UseLoadTest=${USE_LOADTEST:-False} - ports: - - "5100:80" - - webstatus: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - CatalogUrl=http://catalog-api/hc - - OrderingUrl=http://ordering-api/hc - - BasketUrl=http://basket-api/hc - - IdentityUrl=http://identity-api/hc - - PaymentUrl=http://payment-api/hc - - mvc=http://webmvc/hc - - spa=http://webspa/hc - - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - - OrchestratorType=${ORCHESTRATOR_TYPE} - ports: - - "5107:80" +# webspa: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. +# - PurchaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5202 +# - CatalogUrlHC=http://catalog-api/hc +# - OrderingUrlHC=http://ordering-api/hc +# - IdentityUrlHC=http://identity-api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. +# - BasketUrlHC=http://basket-api/hc +# - PaymentUrlHC=http://payment-api/hc +# - UseCustomizationData=True +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# ports: +# - "5104:80" +# +# webmvc: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - PurchaseUrl=http://webshoppingapigw +# - IdentityUrl=http://10.0.75.1:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. +# - CatalogUrlHC=http://catalog-api/hc +# - OrderingUrlHC=http://ordering-api/hc +# - IdentityUrlHC=http://identity-api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. +# - BasketUrlHC=http://basket-api/hc +# - PaymentUrlHC=http://payment-api/hc +# - UseCustomizationData=True +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# - UseLoadTest=${USE_LOADTEST:-False} +# ports: +# - "5100:80" +# +# webstatus: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - ASPNETCORE_URLS=http://0.0.0.0:80 +# - CatalogUrl=http://catalog-api/hc +# - OrderingUrl=http://ordering-api/hc +# - BasketUrl=http://basket-api/hc +# - IdentityUrl=http://identity-api/hc +# - PaymentUrl=http://payment-api/hc +# - mvc=http://webmvc/hc +# - spa=http://webspa/hc +# - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} +# - OrchestratorType=${ORCHESTRATOR_TYPE} +# ports: +# - "5107:80" payment-api: environment: @@ -191,45 +191,45 @@ services: - "15672:15672" # Important: In a production environment your should remove the external port - "5672:5672" # Important: In a production environment your should remove the external port - 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" # Important: In a production environment your should remove the external port (5200) kept here for microservice debugging purposes. - # The API Gateway redirects and access through the internal port (80). - volumes: - - ./ApiGateways/Mobile.Bff.Shopping/apigw:/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" # Important: In a production environment your should remove the external port (5202) kept here for microservice debugging purposes. - # The API Gateway redirects and access through the internal port (80). - volumes: - - ./ApiGateways/Web.Bff.Shopping/apigw:/app/configuration - - mobileshoppingagg: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - urls__basket=http://basket-api - - urls__catalog=http://catalog-api - - urls__orders=http://ordering-api - - urls__identity=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. - ports: - - "80" # Important: In a production environment your should remove the external port (5120) kept here for microservice debugging purposes. - # The API Gateway redirects and access through the internal port (80). - - webshoppingagg: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - urls__basket=http://basket-api - - urls__catalog=http://catalog-api - - urls__orders=http://ordering-api - - urls__identity=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. - ports: - - "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes. - # The API Gateway redirects and access through the internal port (80). - +# 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" # Important: In a production environment your should remove the external port (5200) kept here for microservice debugging purposes. +# # The API Gateway redirects and access through the internal port (80). +# volumes: +# - ./ApiGateways/Mobile.Bff.Shopping/apigw:/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" # Important: In a production environment your should remove the external port (5202) kept here for microservice debugging purposes. +# # The API Gateway redirects and access through the internal port (80). +# volumes: +# - ./ApiGateways/Web.Bff.Shopping/apigw:/app/configuration +# +# mobileshoppingagg: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - urls__basket=http://basket-api +# - urls__catalog=http://catalog-api +# - urls__orders=http://ordering-api +# - urls__identity=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. +# ports: +# - "80" # Important: In a production environment your should remove the external port (5120) kept here for microservice debugging purposes. +# # The API Gateway redirects and access through the internal port (80). +# +# webshoppingagg: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - urls__basket=http://basket-api +# - urls__catalog=http://catalog-api +# - urls__orders=http://ordering-api +# - urls__identity=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. +# ports: +# - "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes. +# # The API Gateway redirects and access through the internal port (80). +# diff --git a/src/docker-compose.yml b/src/docker-compose.yml index ea9985ab1..6821bad81 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -70,92 +70,92 @@ services: depends_on: - rabbitmq - webhooks-api: - image: ${REGISTRY:-eshop}/webhooks.api:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: Services/Webhooks/Webhooks.API/Dockerfile - depends_on: - - sqldata - - mobileshoppingapigw: - image: envoyproxy/envoy:v1.16.0 - - mobileshoppingagg: - image: ${REGISTRY:-eshop}/mobileshoppingagg:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile - depends_on: - - nosqldata - - sqldata - - identity-api - - rabbitmq - - ordering-api - - catalog-api - - basket-api - - webshoppingagg: - image: ${REGISTRY:-eshop}/webshoppingagg:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile - depends_on: - - nosqldata - - sqldata - - identity-api - - rabbitmq - - ordering-api - - catalog-api - - basket-api - - ordering-signalrhub: - image: ${REGISTRY:-eshop}/ordering.signalrhub:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: Services/Ordering/Ordering.SignalrHub/Dockerfile - depends_on: - - nosqldata - - sqldata - - identity-api - - rabbitmq - - ordering-api - - catalog-api - - basket-api - - webstatus: - image: ${REGISTRY:-eshop}/webstatus:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: Web/WebStatus/Dockerfile - - webspa: - image: ${REGISTRY:-eshop}/webspa:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: Web/WebSPA/Dockerfile - args: - NODE_IMAGE: ${NODE_IMAGE:-node:12.0} - depends_on: - - webshoppingagg - - webshoppingapigw - - webmvc: - image: ${REGISTRY:-eshop}/webmvc:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: Web/WebMVC/Dockerfile - depends_on: - - webshoppingagg - - webshoppingapigw - - webhooks-client: - image: ${REGISTRY:-eshop}/webhooks.client:${PLATFORM:-linux}-${TAG:-latest} - build: - context: . - dockerfile: Web/WebhookClient/Dockerfile - depends_on: - - webhooks-api - - webshoppingapigw: - image: envoyproxy/envoy:v1.16.0 +# webhooks-api: +# image: ${REGISTRY:-eshop}/webhooks.api:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: Services/Webhooks/Webhooks.API/Dockerfile +# depends_on: +# - sqldata +# +# mobileshoppingapigw: +# image: envoyproxy/envoy:v1.16.0 +# +# mobileshoppingagg: +# image: ${REGISTRY:-eshop}/mobileshoppingagg:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile +# depends_on: +# - nosqldata +# - sqldata +# - identity-api +# - rabbitmq +# - ordering-api +# - catalog-api +# - basket-api +# +# webshoppingagg: +# image: ${REGISTRY:-eshop}/webshoppingagg:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile +# depends_on: +# - nosqldata +# - sqldata +# - identity-api +# - rabbitmq +# - ordering-api +# - catalog-api +# - basket-api +# +# ordering-signalrhub: +# image: ${REGISTRY:-eshop}/ordering.signalrhub:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: Services/Ordering/Ordering.SignalrHub/Dockerfile +# depends_on: +# - nosqldata +# - sqldata +# - identity-api +# - rabbitmq +# - ordering-api +# - catalog-api +# - basket-api +# +# webstatus: +# image: ${REGISTRY:-eshop}/webstatus:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: Web/WebStatus/Dockerfile +# +# webspa: +# image: ${REGISTRY:-eshop}/webspa:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: Web/WebSPA/Dockerfile +# args: +# NODE_IMAGE: ${NODE_IMAGE:-node:12.0} +# depends_on: +# - webshoppingagg +# - webshoppingapigw +# +# webmvc: +# image: ${REGISTRY:-eshop}/webmvc:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: Web/WebMVC/Dockerfile +# depends_on: +# - webshoppingagg +# - webshoppingapigw +# +# webhooks-client: +# image: ${REGISTRY:-eshop}/webhooks.client:${PLATFORM:-linux}-${TAG:-latest} +# build: +# context: . +# dockerfile: Web/WebhookClient/Dockerfile +# depends_on: +# - webhooks-api +# +# webshoppingapigw: +# image: envoyproxy/envoy:v1.16.0 From eef41bbf8a34b569ac3aa512df9e659aa54eec23 Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 12:38:10 +0100 Subject: [PATCH 4/7] disable authorization in Orders and Basket controllers --- src/Services/Basket/Basket.API/Controllers/BasketController.cs | 2 +- .../Ordering/Ordering.API/Controllers/OrdersController.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 5468bbc15..959094a52 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -1,7 +1,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers; [Route("api/v1/[controller]")] -[Authorize] +// [Authorize] [ApiController] public class BasketController : ControllerBase { diff --git a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs index 2cfd4063f..0d72ffdb1 100644 --- a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs +++ b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs @@ -6,7 +6,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries; using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services; [Route("api/v1/[controller]")] -[Authorize] +// [Authorize] [ApiController] public class OrdersController : ControllerBase { From 792866c8d5ab9ce7c83c013eed07f92f12226c29 Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 13:01:23 +0100 Subject: [PATCH 5/7] hack: disable authorization + add fake identity service which takes userID straight from the header --- .../Controllers/BasketController.cs | 8 +++- .../Basket.API/Services/IdentityService.cs | 32 +++++++++++++-- src/Services/Basket/Basket.API/Startup.cs | 4 +- .../Services/IdentityService.cs | 39 ++++++++++++++++--- src/Services/Ordering/Ordering.API/Startup.cs | 4 +- 5 files changed, 74 insertions(+), 13 deletions(-) diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 959094a52..9041ca46c 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -1,6 +1,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers; [Route("api/v1/[controller]")] +// HACK: no auth // [Authorize] [ApiController] public class BasketController : ControllerBase @@ -56,8 +57,11 @@ public class BasketController : ControllerBase return BadRequest(); } - var userName = this.HttpContext.User.FindFirst(x => x.Type == ClaimTypes.Name).Value; - + // HACK: no auth + // Authorization is disabled so the Name claim will not be available + // var userName = this.HttpContext.User.FindFirst(x => x.Type == ClaimTypes.Name).Value; + var userName = "Dummy User Name"; + var eventMessage = new UserCheckoutAcceptedIntegrationEvent(userId, userName, basketCheckout.City, basketCheckout.Street, basketCheckout.State, basketCheckout.Country, basketCheckout.ZipCode, basketCheckout.CardNumber, basketCheckout.CardHolderName, basketCheckout.CardExpiration, basketCheckout.CardSecurityNumber, basketCheckout.CardTypeId, basketCheckout.Buyer, basketCheckout.RequestId, basket); diff --git a/src/Services/Basket/Basket.API/Services/IdentityService.cs b/src/Services/Basket/Basket.API/Services/IdentityService.cs index 9dded4ea3..2dc23ffe3 100644 --- a/src/Services/Basket/Basket.API/Services/IdentityService.cs +++ b/src/Services/Basket/Basket.API/Services/IdentityService.cs @@ -1,17 +1,41 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Services; -public class IdentityService : IIdentityService +public class IdentityServiceFake : IIdentityService { private IHttpContextAccessor _context; - public IdentityService(IHttpContextAccessor context) + public IdentityServiceFake(IHttpContextAccessor context) { _context = context ?? throw new ArgumentNullException(nameof(context)); } - + public string GetUserIdentity() { - return _context.HttpContext.User.FindFirst("sub").Value; + if (_context.HttpContext + .Request + .Headers + .TryGetValue("user-id", out var value)) + { + return value.Single(); + } + + return null; } } +// HACK: no auth +// public class IdentityService : IIdentityService +// { +// private IHttpContextAccessor _context; +// +// public IdentityService(IHttpContextAccessor context) +// { +// _context = context ?? throw new ArgumentNullException(nameof(context)); +// } +// +// public string GetUserIdentity() +// { +// return _context.HttpContext.User.FindFirst("sub").Value; +// } +// } + diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 89b8934e9..5e22bebce 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -135,7 +135,9 @@ public class Startup }); services.AddSingleton(); services.AddTransient(); - services.AddTransient(); + // HACK: no auth + // services.AddTransient(); + services.AddTransient(); services.AddOptions(); diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Services/IdentityService.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Services/IdentityService.cs index 0849805e2..c6e2db317 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Services/IdentityService.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Services/IdentityService.cs @@ -1,21 +1,50 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services; -public class IdentityService : IIdentityService +public class IdentityServiceFake : IIdentityService { private IHttpContextAccessor _context; - public IdentityService(IHttpContextAccessor context) + public IdentityServiceFake(IHttpContextAccessor context) { _context = context ?? throw new ArgumentNullException(nameof(context)); } - + public string GetUserIdentity() { - return _context.HttpContext.User.FindFirst("sub").Value; + if (_context.HttpContext + .Request + .Headers + .TryGetValue("user-id", out var value)) + { + return value.Single(); + } + + return null; } public string GetUserName() { - return _context.HttpContext.User.Identity.Name; + return "Dummy User Name"; } } + +// HACK: no auth +// public class IdentityService : IIdentityService +// { +// private IHttpContextAccessor _context; +// +// public IdentityService(IHttpContextAccessor context) +// { +// _context = context ?? throw new ArgumentNullException(nameof(context)); +// } +// +// public string GetUserIdentity() +// { +// return _context.HttpContext.User.FindFirst("sub").Value; +// } +// +// public string GetUserName() +// { +// return _context.HttpContext.User.Identity.Name; +// } +// } diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 153f74ea1..16d73fc93 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -250,7 +250,9 @@ static class CustomExtensionsMethods public static IServiceCollection AddCustomIntegrations(this IServiceCollection services, IConfiguration configuration) { services.AddSingleton(); - services.AddTransient(); + // HACK: no auth + // services.AddTransient(); + services.AddTransient(); services.AddTransient>( sp => (DbConnection c) => new IntegrationEventLogService(c)); From 6471d2524479524dbe62506906aa8294215541d8 Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 13:02:03 +0100 Subject: [PATCH 6/7] ensure static userIDs on db seeding --- src/Services/Identity/Identity.API/SeedData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/Identity/Identity.API/SeedData.cs b/src/Services/Identity/Identity.API/SeedData.cs index ece8c6d54..d097ff575 100644 --- a/src/Services/Identity/Identity.API/SeedData.cs +++ b/src/Services/Identity/Identity.API/SeedData.cs @@ -30,7 +30,7 @@ public class SeedData City = "Redmond", Country = "U.S.", Expiration = "12/24", - Id = Guid.NewGuid().ToString(), + Id = "10000000-0000-0000-0000-000000000000", LastName = "Smith", Name = "Alice", PhoneNumber = "1234567890", @@ -69,7 +69,7 @@ public class SeedData City = "Redmond", Country = "U.S.", Expiration = "12/24", - Id = Guid.NewGuid().ToString(), + Id = "20000000-0000-0000-0000-000000000000", LastName = "Smith", Name = "Bob", PhoneNumber = "1234567890", From 6c544eb5235b544df7cfc13ae2f81e68743b0faa Mon Sep 17 00:00:00 2001 From: kct949 Date: Sat, 11 Feb 2023 13:08:53 +0100 Subject: [PATCH 7/7] add user-id header field to swagger --- src/Services/Basket/Basket.API/Startup.cs | 17 +++++++++++++++++ src/Services/Ordering/Ordering.API/Startup.cs | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 5e22bebce..3ef2aa33f 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -57,6 +57,7 @@ public class Startup }); options.OperationFilter(); + options.OperationFilter(); }); ConfigureAuthService(services); @@ -291,4 +292,20 @@ public class Startup eventBus.Subscribe(); eventBus.Subscribe(); } + + // HACK: no auth + private class AddUserIdHeaderFilter : IOperationFilter + { + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + operation.Parameters ??= new List(); + + operation.Parameters.Add(new OpenApiParameter + { + Name = "user-id", + In = ParameterLocation.Header, + Required = false + }); + } + } } \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 16d73fc93..95635e39d 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -242,6 +242,7 @@ static class CustomExtensionsMethods }); options.OperationFilter(); + options.OperationFilter(); }); return services; @@ -400,4 +401,20 @@ static class CustomExtensionsMethods }); return services; } + + // HACK: no auth + private class AddUserIdHeaderFilter : IOperationFilter + { + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + operation.Parameters ??= new List(); + + operation.Parameters.Add(new OpenApiParameter + { + Name = "user-id", + In = ParameterLocation.Header, + Required = false + }); + } + } } \ No newline at end of file