You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
5.2 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. # Deploying a Service Fabric cluster based on Windows nodes
  2. ## A. Not secured cluster (SF Windows cluster)
  3. For a secured cluster, see option B. below.
  4. 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
  5. 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.
  6. 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:
  7. 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.
  8. ## Edit the servicefabricdeploy.parameters.json file
  9. Edit the following params in `servicefabricdeploy.parameters.json` file to set your values:
  10. - clusterName: Name of your SF cluster
  11. - clusterLocation: Datacenter location, like westus or westeurope
  12. - computeLocation: Datacenter location, like westus or westeurope
  13. - adminUserName: user-name for VMs administration
  14. - adminPassword: user-password for VMs administration
  15. - dnsName: Name assigned to your SF dns
  16. Optionally, you could modify which ports are opened in the LoadBalancer for the multiple eShopOnContainer apps and API services.
  17. By default, they are setup as:
  18. - webMvcHttpPort: 5100
  19. - webSpaHttpPort: 5104
  20. - webStatusHttpPort: 5107
  21. - IdSrvHttpRule: 5105
  22. - BasketApiHttpRule: 5103
  23. - CatalogApiHttpRule: 5101
  24. - OrderingApiHttpRule: 5102
  25. - MarketingApiHttpRule: 5110
  26. - LocationsApiHttpRule: 5109
  27. ## Deploy the Service Fabric cluster using the script and ARM templates
  28. Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
  29. For example, to deploy the cluster to a new resourcegroup located in westus, using the Command Prompt, go to `deploy\az` folder and type:
  30. ```
  31. create-resources.cmd servicefabric\WindowsContainers\servicefabricdeploy qa-eshop-sfwin-resgrp -c westus
  32. ```
  33. ## Deploy eShopOnServiceFabric with Visual Studio.
  34. 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.
  35. ## B. Secured cluster (SF Windows cluster)
  36. 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.
  37. ## Create Azure Keyvault service
  38. Go to PortalAzure and create a Keyvault service. Make sure Enable access for deployment checkboxes are selected.
  39. <img src="../../../../img/sf/create-kv.PNG">
  40. ## Generate a certificate in Azure Keyvault
  41. Execute the gen-keyvaultcert.ps1 script to generate and download a certificate from Keyvault.
  42. ```
  43. .\gen-keyvaultcert.ps1 -vaultName <your_keyvault_service> -certName <your_cert_name> -certPwd <your_cert_pwd> -subjectName CN=<your_sf_dns_name>.westeurope.cloudapp.azure.com -saveDir C:\Users\<user>\Downloads
  44. ```
  45. ## Install the certificate
  46. Install the certificate under 'Current User' store location and check it as exportable.
  47. <img src="../../../../img/sf/install-cert.PNG">
  48. ## Editing servicefabricdeploysecured.parameters.json file
  49. Edit the following params in `servicefabricdeploysecured.parameters.json` file to set your values:
  50. - clusterName: Name of your SF cluster
  51. - dnsName: Name assigned to your SF dns
  52. - adminUserName: user name for administration
  53. - adminPassword: user password for administration
  54. - sourceVaultValue: keyvault resource id (check azure keyvault properties)
  55. - certificateUrlValue: certificate url (check azure Keyvault certificate properties)
  56. - certificateThumbprint: certificate thumbprint (check azure Keyvault certificate properties)
  57. Optionally, you can modify which ports are opened in the LoadBalancer for accessing externally to the apps:
  58. - webMvcHttpPort: port externally exposed for the WebMVC app
  59. - webSpaHttpPort: port externally exposed for the WebSPA app
  60. - webStatusHttpPort: port externally exposed for the WebStatus app
  61. - IdSrvHttpRule: port externally exposed for the Identity app
  62. ## Deploy the template
  63. Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
  64. ```
  65. create-resources.cmd servicefabric\WindowsContainers\servicefabricdeploysecured newResourceGroup -c westus
  66. ```
  67. ## Deploy eShopOnServiceFabric with Visual Studio.
  68. 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:
  69. <img src="../../../../img/sf/cloud_publishProfile.PNG">