New-NetFirewallRule-DisplayNameeShopOnContainers-Inbound-Confirm-Description"eShopOnContainers Inbound Rule for port range 5100-5110"-LocalAddressAny-LocalPort5100-5110-Protocoltcp-RemoteAddressAny-RemotePortAny-DirectionInbound
New-NetFirewallRule-DisplayNameeShopOnContainers-Outbound-Confirm-Description"eShopOnContainers Outbound Rule for port range 5100-5110"-LocalAddressAny-LocalPort5100-5110-Protocoltcp-RemoteAddressAny-RemotePortAny-DirectionOutbound
New-NetFirewallRule-DisplayNameeShopOnContainers-Inbound-Confirm-Description"eShopOnContainers Inbound Rule for port range 5100-5150"-LocalAddressAny-LocalPort5100-5150-Protocoltcp-RemoteAddressAny-RemotePortAny-DirectionInbound
New-NetFirewallRule-DisplayNameeShopOnContainers-Outbound-Confirm-Description"eShopOnContainers Outbound Rule for port range 5100-5150"-LocalAddressAny-LocalPort5100-5150-Protocoltcp-RemoteAddressAny-RemotePortAny-DirectionOutbound
# Deploying a Service Fabric cluster based on Linux nodes
The ARM template `servicefabricdeploy.json` and its parameter file (`servicefabricdeploy.parameters.json`) are used to create a service fabric cluster environment for linux containers.
You can always deploy a SF cluster through the Azure portal, as explained in this article: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-azure-cluster
However, when creating a cluster, there are quite a few configurations to take into account, like enabling the internal DNS service or Reverse Proxy service, choosing between Linux/Windows, open/publish your application ports in the load-balancer and most of all (the most complex setup) how to create a secure cluster.
Because of those reasons, we have created a set of ARM templates and scripts so you can create, re-create and configure the SF clusters much faster, as explained below:
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\LinuxContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/LinuxContainers), you can find the ARM template `servicefabricdeploy.json` and its parameters file (`servicefabricdeploy.parameters.json`) to create a Service Fabric cluster environment for Linux Containers.
## Edit the servicefabricdeploy.parameters.json file
Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
- clusterName: Name of your SF cluster
- clusterName: Name of your SF cluster
- clusterLocation: Datacenter location, like westus or westeurope
- computeLocation: Datacenter location, like westus or westeurope
- adminUserName: user-name for VMs administration
- adminPassword: user-password for VMs administration
- dnsName: Name assigned to your SF dns
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
- webMvcHttpPort: port externally exposed for the WebMVC app
- webSpaHttpPort: port externally exposed for the WebSPA app
- webStatusHttpPort: port externally exposed for the WebStatus app
- IdSrvHttpRule: port externally exposed for the Identity app
Optionally, you could modify which ports are opened in the LoadBalancer for the multiple eShopOnContainer apps and API services.
By default, they are setup as:
- webMvcHttpPort: 5100
- webSpaHttpPort: 5104
- webStatusHttpPort: 5107
- IdSrvHttpRule: 5105
- BasketApiHttpRule: 5103
- CatalogApiHttpRule: 5101
- OrderingApiHttpRule: 5102
- MarketingApiHttpRule: 5110
- LocationsApiHttpRule: 5109
## Deploy the template
## Deploy the Service Fabric cluster using the script and ARM templates
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type:
For example, to deploy the cluster to a new resourcegroup located in westus, go to `deploy\az` folder and type:
## Deploy eShopOnServiceFabric with Visual Studio.
Alternatively, instead of using ARM templates, you can deploy eShop on service fabric directly by publishing the project eShopOnServiceFabric in eShopOnContainers-ServicesAndWebApps.sln with Visual Studio publish tool.
You should see a similar execution to the following:
In this case, this is an unsecured SF cluster with a single Linux node, good for initial tests and getting started with SF.
## B. Secured cluster (SF Linux cluster)
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\LinuxContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/LinuxContainers), you can find the ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) to create a secured Service Fabric cluster environment for Linux Containers (IN THIS CASE, IT IS A SECURED CLUSTER USING A CERTIFICATE).
The ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) are used to create a service fabric cluster environment for linux containers secured with a certificate.
The ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) are used to create a service fabric cluster environment for linux containers secured with a certificate.
## Create Azure Keyvault service
## Create Azure Keyvault service
Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
In a POWER-SHELL window, move to the folder [..\deploy\az\servicefabric\LinuxContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/LinuxContainers).
**Select your Azure subscription** You might have [several Azure subscriptions](https://docs.microsoft.com/en-us/cli/azure/account#set) as shown if you type the following.
>```
>az account list
>```
If you have multiple subscription accounts, you first need to select the Azure subscription account you want to target. Type the following:
>```
>az account set --subscription "Your Azure Subscription Name or ID"
>```
Execute the gen-keyvaultcert.ps1 script to generate and download a certificate from Keyvault.
Execute the gen-keyvaultcert.ps1 script to generate and download a certificate from Keyvault.
Edit the following params in `servicefabricdeploysecured.parameters.json`file to set your values:
Edit the parameters in `servicefabricdeploysecured.parameters.json`in a similar way you can do with the unsecured .json file shown above (clusterName, dnsName, etc.), plus edit the following values:
- clusterName: Name of your SF cluster
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
- sourceVaultValue: keyvault resource id (check azure keyvault properties)
- sourceVaultValue: Your Azure Keyvault's RESOURCE ID (check Azure keyvault properties, similar to: /subscriptions/e1234ac1-c09c-3jaf-6767-98b3c5f1f246/resourceGroups/eshop-global-resgrp/providers/Microsoft.KeyVault/vaults/eshopkeyvault")
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
- certificateUrlValue: Your certificate Secret Identifier (check Azure Keyvault secret certificate properties, should be in the format of https://<nameofthevault>.vault.azure.net:443/secrets/<exactlocation>, similar to:
## Deploy eShopOnServiceFabric with Visual Studio.
## Deploy eShopOnServiceFabric with Visual Studio.
Modify the cloud.xml file of each Service Fabric application in PublishProfile directory and set your certificate settings to be able to deploy eshopOnContainers in the secured cluster:
Modify the cloud.xml file of each Service Fabric application in PublishProfile directory and set your certificate settings to be able to deploy eshopOnContainers in the secured cluster:
# Deploying a Service Fabric cluster based on Windows nodes
The ARM template `servicefabricdeploy.json` and its parameter file (`servicefabricdeploy.parameters.json`) are used to create a service fabric cluster environment for windows containers.
You can always deploy a SF cluster through the Azure portal, as explained in this article: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-azure-cluster
However, when creating a cluster, there are quite a few configurations to take into account, like enabling the internal DNS service or Reverse Proxy service, choosing between Linux/Windows, open/publish your application ports in the load-balancer and most of all (the most complex setup) how to create a secure cluster.
Because of those reasons, we have created a set of ARM templates and scripts so you can create, re-create and configure the SF clusters much faster, as explained below:
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\WindowsContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/WindowsContainers), you can find the ARM template `servicefabricdeploy.json` and its parameters file (`servicefabricdeploy.parameters.json`) to create a Service Fabric cluster environment for Windows Containers (NOT SECURED CLUSTER).
## Edit the servicefabricdeploy.parameters.json file
Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
- clusterName: Name of your SF cluster
- clusterName: Name of your SF cluster
- clusterLocation: Datacenter location, like westus or westeurope
- computeLocation: Datacenter location, like westus or westeurope
- adminUserName: user-name for VMs administration
- adminPassword: user-password for VMs administration
- dnsName: Name assigned to your SF dns
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
Optionally, you could modify which ports are opened in the LoadBalancer for the multiple eShopOnContainer apps and API services.
By default, they are setup as:
- webMvcHttpPort: 5100
- webSpaHttpPort: 5104
- webStatusHttpPort: 5107
- IdSrvHttpRule: 5105
- BasketApiHttpRule: 5103
- CatalogApiHttpRule: 5101
- OrderingApiHttpRule: 5102
- MarketingApiHttpRule: 5110
- LocationsApiHttpRule: 5109
- webMvcHttpPort: port externally exposed for the WebMVC app
- webSpaHttpPort: port externally exposed for the WebSPA app
- webStatusHttpPort: port externally exposed for the WebStatus app
- IdSrvHttpRule: port externally exposed for the Identity app
## Deploy the template
## Deploy the Service Fabric cluster using the script and ARM templates
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type:
For example, to deploy the cluster to a new resourcegroup located in westus, using the Command Prompt, go to `deploy\az` folder and type:
## Deploy eShopOnServiceFabric with Visual Studio.
Alternatively, instead of using ARM templates, you can deploy eShop on service fabric directly by publishing the project eShopOnServiceFabric in eShopOnContainers-ServicesAndWebApps.sln with Visual Studio publish tool.
You should see a similar execution to the following:
The ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) are used to create a service fabric cluster environment for windows containers secured with a certificate.
In this case, this is an unsecured SF cluster with a single Windows node, good for initial tests and getting started with SF.
## B. Secured cluster (SF Windows cluster)
Within eShopOnContainers root folder, at the folder [..\deploy\az\servicefabric\WindowsContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/WindowsContainers), you can find the ARM template `servicefabricdeploysecured.json` and its parameter file (`servicefabricdeploysecured.parameters.json`) to create a secured Service Fabric cluster environment for Windows Containers (IN THIS CASE, IT IS A SECURED CLUSTER USING A CERTIFICATE).
## Create Azure Keyvault service
## Create Azure Keyvault service
Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
Execute the gen-keyvaultcert.ps1 script to generate and download a certificate from Keyvault.
In a POWER-SHELL window, move to the folder [..\deploy\az\servicefabric\WindowsContainers](https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/az/servicefabric/WindowsContainers).
**Select your Azure subscription** You might have [several Azure subscriptions](https://docs.microsoft.com/en-us/cli/azure/account#set) as shown if you type the following.
>```
>az account list
>```
If you have multiple subscription accounts, you first need to select the Azure subscription account you want to target. Type the following:
>```
>az account set --subscription "Your Azure Subscription Name or ID"
>```
**Execute the gen-keyvaultcert.ps1 script** to generate and download a certificate from Keyvault.
Make sure you're going to run it against the Azure subscription you mean it.
You might need to authenticate from the browser when running this PowerShell script.
Edit the following params in `servicefabricdeploysecured.parameters.json` file to set your values:
Edit the parameters in `servicefabricdeploysecured.parameters.json`in a similar way you can do with the unsecured .json file shown above (clusterName, dnsName, etc.), plus edit the following values:
- clusterName: Name of your SF cluster
- dnsName: Name assigned to your SF dns
- adminUserName: user name for administration
- adminPassword: user password for administration
- sourceVaultValue: keyvault resource id (check azure keyvault properties)
- sourceVaultValue: Your Azure Keyvault's RESOURCE ID (check Azure keyvault properties, similar to: /subscriptions/e1234ac1-c09c-3jaf-6767-98b3c5f1f246/resourceGroups/eshop-global-resgrp/providers/Microsoft.KeyVault/vaults/eshopkeyvault")
Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
- certificateUrlValue: Your certificate Secret Identifier (check Azure Keyvault secret certificate properties, should be in the format of https://<nameofthevault>.vault.azure.net:443/secrets/<exactlocation>, similar to:
In this case, the ARM template is creating a 5 node cluster when creating a SECURE cluster for "production".
# Deploy eShopOnServiceFabric with Visual Studio.
Modify the cloud.xml file of each Service Fabric application in PublishProfile directory and set your certificate settings to be able to deploy eshopOnContainers in the secured cluster:
Modify the cloud.xml file of each Service Fabric application in PublishProfile directory and set your certificate settings to be able to deploy eshopOnContainers in the secured cluster:
image: microsoft/aspnetcore-build:2.0.2 #Depending on the bug below, you can also try this other SDK image:microsoft/aspnetcore-build:1.0-2.0-2017-10 or microsoft/aspnetcore-build:1.0-2.0
volumes:
volumes:
- .:/src
- .:/src
- ./cli-linux:/cli-linux
- ./cli-linux:/cli-linux
@ -11,8 +11,8 @@ services:
# Next line is using the .sln file to compile all the projects.
# Next line is using the .sln file to compile all the projects.
# Sometime there is an issue in msbuild exits the process before finishing building the bits: (https://github.com/Microsoft/msbuild/issues/2153)
# Sometime there is an issue in msbuild exits the process before finishing building the bits: (https://github.com/Microsoft/msbuild/issues/2153)
# Random error: error MSB4017: The build stopped unexpectedly be cause of an unexpected logger failure.
# Random error: error MSB4017: The build stopped unexpectedly be cause of an unexpected logger failure.
# but values present in the environment vars at runtime will always override those defined inside the .env file
# but values present in the environment vars at runtime will always override those defined inside the .env file
# An external IP or DNS name has to be used when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance.
# An external IP or DNS name has to be used when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance.
#
#
# Set ASPNETCORE_ENVIRONMENT=Development to get errors while testing.
# IMPORTANT: Note that this compose file uses ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP instead of ESHOP_EXTERNAL_DNS_NAME_OR_IP
# Set ASPNETCORE_ENVIRONMENT=Development, instead Production, if you want to show up errors while testing.
#
#
# You need to start it with the following CLI command:
# You need to start it with the following CLI command:
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
services:
services:
basket.api:
basket.api:
environment:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_ENVIRONMENT=Production
@ -21,7 +23,13 @@ services:
- identityUrl=http://identity.api #Local:You need to open your local dev-machine firewall at range 5100-5110.
- identityUrl=http://identity.api #Local:You need to open your local dev-machine firewall at range 5100-5110.
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
- XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback #localhost do not work for UWP login, so we have to use "external" IP always
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5110.
- 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.
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- MarketingUrl=http://marketing.api #Local:Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
- LocationsUrl=http://locations.api
- IdentityUrl=http://10.0.75.1:5105
- MarketingUrl=http://marketing.api #Local:Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. #Remote: 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.
newOrderItem{OrderId=Guid.NewGuid(),ProductId=Common.Common.MockCatalogItemId01,Discount=15,ProductName=".NET Bot Blue Sweatshirt (M)",Quantity=1,UnitPrice=16.50M,PictureUrl=Device.RuntimePlatform!=Device.Windows?"fake_product_01.png":"Assets/fake_product_01.png"},
newOrderItem{OrderId=Guid.NewGuid(),ProductId=Common.Common.MockCatalogItemId03,Discount=0,ProductName=".NET Bot Black Sweatshirt (M)",Quantity=2,UnitPrice=19.95M,PictureUrl=Device.RuntimePlatform!=Device.Windows?"fake_product_03.png":"Assets/fake_product_03.png"}
newOrderItem{OrderId=Guid.NewGuid(),ProductId=Common.Common.MockCatalogItemId01,Discount=15,ProductName=".NET Bot Blue Sweatshirt (M)",Quantity=1,UnitPrice=16.50M,PictureUrl=Device.RuntimePlatform!=Device.Windows?"fake_product_01.png":"Assets/fake_product_01.png"},
newOrderItem{OrderId=Guid.NewGuid(),ProductId=Common.Common.MockCatalogItemId03,Discount=0,ProductName=".NET Bot Black Sweatshirt (M)",Quantity=2,UnitPrice=19.95M,PictureUrl=Device.RuntimePlatform!=Device.Windows?"fake_product_03.png":"Assets/fake_product_03.png"}