diff --git a/.env b/.env index d9482516b..63fea3389 100644 --- a/.env +++ b/.env @@ -5,4 +5,21 @@ # 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 ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost -ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92 \ No newline at end of file +ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92 + +#ESHOP_AZURE_REDIS_BASKET_DB= +#ESHOP_AZURE_STORAGE_CATALOG= +#ESHOP_AZURE_STORAGE_MARKETING= +#ESHOP_AZURE_SERVICE_BUS= +#ESHOP_AZURE_COSMOSDB= +#ESHOP_AZURE_CATALOG_DB= +#ESHOP_AZURE_IDENTITY_DB= +#ESHOP_AZURE_ORDERING_DB= +#ESHOP_AZURE_MARKETING_DB= +#ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI= +#ESHOP_AZURE_STORAGE_CATALOG_NAME= +#ESHOP_AZURE_STORAGE_CATALOG_KEY= +#ESHOP_AZURE_STORAGE_MARKETING_NAME= +#ESHOP_AZURE_STORAGE_MARKETING_KEY= + + diff --git a/.gitignore b/.gitignore index 0fb1c0ab0..548ad2340 100644 --- a/.gitignore +++ b/.gitignore @@ -189,7 +189,6 @@ ClientBin/ *~ *.dbmdl *.dbproj.schemaview -*.pfx *.publishsettings node_modules/ orleans.codegen.cs diff --git a/Local.testsettings b/Local.testsettings new file mode 100644 index 000000000..4e1e6ab7f --- /dev/null +++ b/Local.testsettings @@ -0,0 +1,13 @@ + + + These are default test settings for a local test run. + + + + + + + + + + \ No newline at end of file diff --git a/README.ENV.md b/README.ENV.md new file mode 100644 index 000000000..bdb436a1a --- /dev/null +++ b/README.ENV.md @@ -0,0 +1,67 @@ +**Note**: It is very important to disable any ESHOP_AZURE variables from .env file when the local storage or container services is set. Remember you can disable any variable from .env file putting '#' character before the variable declaration and you can run and test separately any Azure services. + +With the steps explained in the next section, you will be able to run the application with Azure Redis Cache instead of the container of Redis service. + +# Azure Redis Cache service +To enable the Redis Cache of Azure in eShop it is necessary to have previously configured the Azure Redis service through ARM file or manually through Azure portal. You can use the [ARM files](deploy/az/redis/readme.md) already created in eShop. Once the Redis Cache service is created, it is necessary to get the Primary connection string from information service in the Azure portal and modify the port value from 6380 to 6379 and the ssl value from True to False to establish a without ssl connection with the cache server. This Primary connection must be declared on .env file located in the solution root folder with `ESHOP_AZURE_REDIS_BASKET_DB` variable name. + +For example: +>ESHOP_AZURE_REDIS_BASKET_DB=yourredisservice.redis.cache.windows.net:6379,password=yourredisservicepassword,ssl=False,abortConnect=False + +With the steps explained in the next section, you will be able to run the application with Azure Service Bus instead of the container of RabbitMQ service. + +# Azure Service Bus service +To enable the service bus of Azure in eShop solution it is necessary having created previously the service bus service through ARM file or manually through Azure portal. You can use the [ARM files](deploy/az/servicebus/readme.md) already created in eShop. Finally, it is necessary to get the Shared access policy named "Root" (if you generated the service through ARM file) from eshop_event_bus topic. This policy must be declared on .env file located in the solution root folder with `ESHOP_AZURE_SERVICE_BUS` name. + +For example: +>ESHOP_AZURE_SERVICE_BUS=Endpoint=sb://yourservicebusservice.servicebus.windows.net/;SharedAccessKeyName=Root;SharedAccessKey=yourtopicpolicykey=;EntityPath=eshop_event_bus + +Once the service bus service is created, it is necessary to set to true the "AzureServiceBusEnabled" environment variable from `settings.json` file on Catalog.API, Ordering.API, Basket.API, Payment.API, GracePeriodManager, Marketing.API and Locations.API. + +With the steps explained in the next section, you will be able to run the application with Azure Storage Account instead of the local container storage. + +# Azure Storage Account service +To enable Azure storage of Azure in eShopOnAzure solution it is necessary having created previously the storage service through ARM file or manually through Azure portal. You can use the ARM files find under **deploy/az/storage** folder already created in eShop. Once the storage account is created, it is very important to create a new container(blob kind) and upload the solution catalog pics files before to continue.Later, it is necessary to set to true the "AzureStorageEnabled" environment variable from `settings.json` in Catalog.API and Marketing.API.Finally, it is necessary to get the container endpoint url from information service in the Azure portal, This url must be declared on .env file located in the solution root folder with `ESHOP_AZURE_STORAGE_CATALOG` for the Catalog.API content and `ESHOP_AZURE_STORAGE_MARKETING` for the Marketing.API content. + +Do not forget to put a slash character '/' in the end of the url. + +For example: +>ESHOP_AZURE_STORAGE_CATALOG=https://yourcatalogstorageaccountservice.blob.core.windows.net/yourcontainername/ +>ESHOP_AZURE_STORAGE_MARKETING=https://yourmarketingstorageaccountservice.blob.core.windows.net/yourcontainername/ + + +## Check status of Azure Storage Account with Health Checks +It is possible to add status check for the Azure Storage Account inside the Catalog Web Status. In case that the status check is enabled, for the Catalog and/or Marketing section in the WebStatus page, Azure Storage will be checked as one of the dependencies for theses APIs. To enable this check add the account name and key to the .env file for your account. + +For example: +>ESHOP_AZURE_STORAGE_CATALOG_NAME=storageaccountname +>ESHOP_AZURE_STORAGE_CATALOG_KEY=storageaccountkey +>ESHOP_AZURE_STORAGE_MARKETING_NAME=storageaccountname +>ESHOP_AZURE_STORAGE_MARKETING_KEY=storageaccountkey + +With the steps explained in the next section, you will be able to run the application with Azure SQL Database instead of local storage. + +# Azure SQL Database +To enable Azure SQL Database in eShop is required to have a Azure SQL with the databases for Ordering.API, Identity.API, Catalaog.API and Marketing.API. You can use the [ARM files](deploy/az/sql/readme.md) already created in this project or do it manually. Once the databases are created, it is necessary to get the connection string for each service and set the corresponding variable in the .env file. + +For example: +>ESHOP_AZURE_CATALOG_DB=catalogazureconnectionstring +>ESHOP_AZURE_IDENTITY_DB=identityazureconnectionstring +>ESHOP_AZURE_ORDERING_DB=orderingazureconnectionstring +>ESHOP_AZURE_MARKETING_DB=marketingazureconnectionstring + +With the steps explained in the next section, you will be able to run the application with Azure Cosmos DB Database instead of local storage. + +# Azure Cosmos DB +To enable Azure Cosmos DB in eShop is required to have the connection string. If you do not have an Azure Cosmos DB created you can use the ARM files under **deploy/az/cosmos** folder available in eShop or do it manually. Once the connection string is availabe it is necessary to add it in the .env file in the `ESHOP_AZURE_COSMOSDB`variable. + +For example: +>ESHOP_AZURE_COSMOSDB=cosmosconnectionstring + +# Azure Functions +To enable the Azure Functions in eShop you can add the URI where the functions have been deployed. You can use the ARM files under **deploy/az/azurefunctions** to create the resources in Azure. Once created and available, it is necessary to add to the .env file the `ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI` variable. + +For example: + >ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI=https://marketing-functions.azurewebsites.net/api/MarketingDetailsHttpTrigger?code=AzureFunctioncode + +See Azure Functions deployment Files and Readme for more details [ARM files](deploy/az/azurefunctions/readme.md) \ No newline at end of file diff --git a/README.k8s.md b/README.k8s.md deleted file mode 100644 index 28ebd49e8..000000000 --- a/README.k8s.md +++ /dev/null @@ -1,28 +0,0 @@ -# eShopOnContainers on Kubernetes -The k8s directory contains Kubernetes configuration for the eShopOnContainers app and a PowerShell script to deploy it to a cluster. Each eShopOnContainers microservice has a deployment configuration in `deployments.yaml`, and is exposed to the cluster by a service in `services.yaml`. The microservices are exposed externally on individual routes (`/basket-api`, `/webmvc`, etc.) by an nginx reverse proxy specified in `frontend.yaml` and `nginx.conf`. - -## Prerequisites -* A Kubernetes cluster. Follow Azure Container Service's [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough) to create one. -* A private Docker registry. Follow Azure Container Registry's [guide](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal) to create one. -* Optionally, previous steps can be skipped if you run gen-k8s-env.ps1 script to automatically create the azure environment needed for kubernetes deployment. Azure cli 2.0 must be previously installed [installation guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). For example: ->``` ->./gen-k8s-env -resourceGroupName k8sGroup -location westeurope -registryName k8sregistry -orchestratorName k8s-cluster -dnsName k8s-dns ->``` -* A Docker development environment with `docker` and `docker-compose`. - * Visit [docker.com](https://docker.com) to download the tools and set up the environment. Docker's [installation guide](https://docs.docker.com/engine/getstarted/step_one/#step-3-verify-your-installation) covers verifying your Docker installation. -* The Kubernetes command line client, `kubectl`. - * This can be installed with the `az` tool as described in the Azure Container Service [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough). `az` is also helpful for getting the credentials `kubectl` needs to access your cluster. For other installation options, and information about configuring `kubectl` yourself, see the [Kubernetes documentation](https://kubernetes.io/docs/tasks/kubectl/install/). - -## Deploy the application with the deployment script -1. Open a PowerShell command line at the `k8s` directory of your local eShopOnContainers repository. -1. Ensure `docker`, `docker-compose`, and `kubectl` are on the path, and configured for your Docker machine and Kubernetes cluster. -1. Run `deploy.ps1` with your registry information. The Docker username and password are provided by Azure Container Registry, and can be retrieved from the Azure portal. Optionally, ACR credentials can be obtained by running the following command: ->``` ->az acr credential show -n eshopregistry ->``` - -Once the user and password are retrieved, run the following script for deployment. For example: ->``` ->./deploy.ps1 -registry myregistry.azurecr.io -dockerUser User -dockerPassword SecretPassword ->``` -The script will build the code and corresponding Docker images, push the latter to your registry, and deploy the application to your cluster. You can watch the deployment unfold from the Kubernetes web interface: run `kubectl proxy` and open a browser to [http://localhost:8001/ui](http://localhost:8001/ui) diff --git a/README.md b/README.md index cf389ec18..ae28f7951 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers.

**Note for Pull Requests**: We accept pull request from the community. When doing it, please do it onto the DEV branch which is the consolidated work-in-progress branch. Do not request it onto Master, if possible. +>**PLEASE** Read our [branch guide](./branch-guide.md) to know about our branching policy + > ### DISCLAIMER > **IMPORTANT:** The current state of this sample application is **BETA**, consider it version a 0.1 foundational version, therefore, many areas could be improved and change significantly while refactoring current code and implementing new features. **Feedback with improvements and pull requests from the community will be highly appreciated and accepted.** > @@ -14,9 +16,7 @@ However, this sample application should not be considered as an "eCommerce refer > Read the planned Roadmap and Milestones for future releases of eShopOnContainers within the Wiki for further info about possible new implementations and provide feedback at the ISSUES section if you'd like to see any specific scenario implemented or improved. Also, feel free to discuss on any current issue. **Architecture overview**: This reference application is cross-platform either at the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps. -The architecture proposes a simplified microservice oriented architecture implementation with multiple autonomous microservices (each one owning its own data/db) and implementing different approaches within each microservice (simple CRUD vs. DDD/CQRS patterns) using Http as the current communication protocol. -

-It also supports asynchronous communication for data updates propagation across multiple services based on Integration Events and an Event Bus plus other features defined at the roadmap. +The architecture proposes a simplified microservice oriented architecture implementation with multiple autonomous microservices (each one owning its own data/db) and implementing different approaches within each microservice (simple CRUD vs. DDD/CQRS patterns) using Http as the communication protocol between the client apps and the microservices and supports asynchronous communication for data updates propagation across multiple services based on Integration Events and an Event Bus (a light message broker, to choose between RabbitMQ or Azure Service Bus, underneath) plus other features defined at the roadmap.

@@ -43,7 +43,7 @@ You can download them and start reviewing these Guides/eBooks here: | Architecting & Developing | Containers Lifecycle & CI/CD | App patterns with Xamarin.Forms | | ------------ | ------------| ------------| | | | | -| **Download** (First Edition) | **Download** (First Edition from late 2016) | **Download** (First Edition) | +| **Download** (First Edition) | **Download** (First Edition) | **Download** (First Edition) | Send feedback to [dotnet-architecture-ebooks-feedback@service.microsoft.com](dotnet-architecture-ebooks-feedback@service.microsoft.com)

diff --git a/branch-guide.md b/branch-guide.md new file mode 100644 index 000000000..67b2d0eaf --- /dev/null +++ b/branch-guide.md @@ -0,0 +1,11 @@ +# eShopOnContainers - BRANCH GUIDE + +Following are the most important branches: + +- `dev`: Contains the latest code **and it is the branch actively developed**. Note that **all PRs must be against `dev` branch to be considered**. +- `master`: Synced time to time from dev. It contains "stable" code, although not the latest one. We plan to do periodic merges from `dev` to `master`, but we are not doing it right now. +- `netcore2`: Contains NETCore 2.0 (preview2) based code. All APIs and webs are migrated to netcore2 except `Identity.API` which still uses netcore1.1 (because of Identity Server). Dockerfiles are updated also. Use this branch to test the NETCore 2.0 code. You can also submit PR to this branch if they are related to netcore2. + +Any other branch is considered temporary and could be deleted at any time. Do not do any PR to them! + +Thanks! diff --git a/cli-linux/build-bits-linux.sh b/cli-linux/build-bits-linux.sh index 4421c58bd..cd8c7cc2e 100755 --- a/cli-linux/build-bits-linux.sh +++ b/cli-linux/build-bits-linux.sh @@ -3,7 +3,8 @@ declare -x path=$1 if [ -z "$path" ]; then - $path="$(pwd)/../src"; + $path="$(pwd)/../src"; + echo -e "\e[33mNo path passed. Will use $path" fi declare -a projectList=( @@ -30,9 +31,9 @@ do echo -e "\e[33m\tRemoving old publish output" pushd $path/$project rm -rf obj/Docker/publish - echo -e "\e[33m\tRestoring project" + echo -e "\e[33m\tRestoring project $project" dotnet restore - echo -e "\e[33m\tBuilding and publishing projects" + echo -e "\e[33m\tBuilding and publishing $project" dotnet publish -o obj/Docker/publish popd done diff --git a/cli-linux/run.sh b/cli-linux/run.sh new file mode 100644 index 000000000..aaeb164fa --- /dev/null +++ b/cli-linux/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +docker stop $(docker ps -a -q) +docker rm $(docker ps -a -q) +docker images |grep -v REPOSITORY|awk '{print $1}'|xargs -L1 docker pull +export ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=$(curl ipinfo.io/ip) +docker-compose -f docker-compose.images.yml -f docker-compose.prod.yml up -d --force-recreate + diff --git a/cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1 b/cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1 index 865f24067..e3545c584 100644 --- a/cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1 +++ b/cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1 @@ -21,6 +21,6 @@ try { Write-Host "Rule found" } catch [Exception] { - New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5105" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound - New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5105" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound + New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5110" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound + New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5110" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound } \ No newline at end of file diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 26651da5b..272227b3d 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -14,7 +14,11 @@ $projectPaths = @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"}, @{Path="$rootPath\src\Services\Catalog\Catalog.API";Prj="Catalog.API.csproj"}, @{Path="$rootPath\src\Services\Ordering\Ordering.API";Prj="Ordering.API.csproj"}, - @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"} + @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"}, + @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"}, + @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"}, + @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"}, + @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"} $projectPaths | foreach { diff --git a/deploy/az/azurefunctions/azurefunctionsdeploy.json b/deploy/az/azurefunctions/azurefunctionsdeploy.json new file mode 100644 index 000000000..7f1b8a445 --- /dev/null +++ b/deploy/az/azurefunctions/azurefunctionsdeploy.json @@ -0,0 +1,208 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "SitesEshopfunctionsName": { + "type": "string", + "metadata": { + "description": "Name of the Azure Functions namespace" + } + } + }, + "variables": { + "SitesEshopfunctionsName": "[parameters('SitesEshopfunctionsName')]", + "WebConfigName": "[concat(variables('SitesEshopfunctionsName'), '/web')]", + "Location": "[resourceGroup().location]", + "ServerFarmPlan": "[concat(trim(variables('location')), 'Plan')]", + "StorageAccounts": "[concat(variables('SitesEshopfunctionsName'), 'st')]" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "sku": { + "name": "Standard_LRS", + "tier": "Standard" + }, + "kind": "Storage", + "name": "[variables('StorageAccounts')]", + "apiVersion": "2016-01-01", + "location": "[variables('Location')]", + "tags": {}, + "scale": null, + "properties": {}, + "dependsOn": [] + }, + { + "type": "Microsoft.Web/serverfarms", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "kind": "functionapp", + "name": "[variables('ServerFarmPlan')]", + "apiVersion": "2015-08-01", + "location": "[variables('Location')]", + "scale": null, + "properties": { + "name": "[variables('ServerFarmPlan')]", + "numberOfWorkers": 0 + }, + "dependsOn": [] + }, + { + "type": "Microsoft.Web/sites", + "kind": "functionapp", + "name": "[variables('SitesEshopfunctionsName')]", + "apiVersion": "2015-08-01", + "location": "[variables('Location')]", + "scale": null, + "properties": { + "name": "[variables('SitesEshopfunctionsName')]", + "hostNames": [ + "[concat(variables('SitesEshopfunctionsName'),'.azurewebsites.net')]" + ], + "enabledHostNames": [ + "[concat(variables('SitesEshopfunctionsName'),'.azurewebsites.net')]", + "[concat(variables('SitesEshopfunctionsName'),'.scm.azurewebsites.net')]" + ], + "hostNameSslStates": [ + { + "name": "[concat(variables('SitesEshopfunctionsName'),'.azurewebsites.net')]", + "sslState": 0, + "thumbprint": null, + "ipBasedSslState": 0 + }, + { + "name": "[concat(variables('SitesEshopfunctionsName'),'.scm.azurewebsites.net')]", + "sslState": 0, + "thumbprint": null, + "ipBasedSslState": 0 + } + ], + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarmPlan'))]" + }, + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarmPlan'))]" + ] + }, + { + "type": "Microsoft.Web/sites/config", + "name": "[variables('WebConfigName')]", + "apiVersion": "2015-08-01", + "location": "[variables('Location')]", + "scale": null, + "properties": { + "numberOfWorkers": 1, + "defaultDocuments": [ + "Default.htm", + "Default.html", + "Default.asp", + "index.htm", + "index.html", + "iisstart.htm", + "default.aspx", + "index.php", + "hostingstart.html" + ], + "netFrameworkVersion": "v4.0", + "phpVersion": "5.6", + "pythonVersion": "", + "nodeVersion": "", + "linuxFxVersion": "", + "requestTracingEnabled": false, + "remoteDebuggingEnabled": false, + "remoteDebuggingVersion": null, + "httpLoggingEnabled": false, + "logsDirectorySizeLimit": 35, + "detailedErrorLoggingEnabled": false, + "publishingUsername": "$eshopfunctions", + "publishingPassword": null, + "appSettings": null, + "metadata": null, + "connectionStrings": null, + "machineKey": null, + "handlerMappings": null, + "documentRoot": null, + "scmType": "None", + "use32BitWorkerProcess": true, + "webSocketsEnabled": false, + "alwaysOn": false, + "javaVersion": null, + "javaContainer": null, + "javaContainerVersion": null, + "appCommandLine": "", + "managedPipelineMode": 0, + "virtualApplications": [ + { + "virtualPath": "/", + "physicalPath": "site\\wwwroot", + "preloadEnabled": false, + "virtualDirectories": null + } + ], + "winAuthAdminState": 0, + "winAuthTenantState": 0, + "customAppPoolIdentityAdminState": false, + "customAppPoolIdentityTenantState": false, + "runtimeADUser": null, + "runtimeADUserPassword": null, + "loadBalancing": 1, + "routingRules": [], + "experiments": { + "rampUpRules": [] + }, + "limits": null, + "autoHealEnabled": false, + "autoHealRules": { + "triggers": null, + "actions": null + }, + "tracingOptions": null, + "vnetName": "", + "siteAuthEnabled": false, + "siteAuthSettings": { + "enabled": null, + "unauthenticatedClientAction": null, + "tokenStoreEnabled": null, + "allowedExternalRedirectUrls": null, + "defaultProvider": null, + "clientId": null, + "clientSecret": null, + "issuer": null, + "allowedAudiences": null, + "additionalLoginParams": null, + "isAadAutoProvisioned": false, + "googleClientId": null, + "googleClientSecret": null, + "googleOAuthScopes": null, + "facebookAppId": null, + "facebookAppSecret": null, + "facebookOAuthScopes": null, + "twitterConsumerKey": null, + "twitterConsumerSecret": null, + "microsoftAccountClientId": null, + "microsoftAccountClientSecret": null, + "microsoftAccountOAuthScopes": null + }, + "cors": { + "allowedOrigins": [ + "https://functions.azure.com", + "https://functions-staging.azure.com", + "https://functions-next.azure.com" + ] + }, + "push": null, + "apiDefinition": null, + "autoSwapSlotName": null, + "localMySqlEnabled": false, + "ipSecurityRestrictions": null + }, + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', variables('SitesEshopfunctionsName'))]" + ] + } + ] +} \ No newline at end of file diff --git a/deploy/az/azurefunctions/azurefunctionsdeploy.parameters.json b/deploy/az/azurefunctions/azurefunctionsdeploy.parameters.json new file mode 100644 index 000000000..8472e9998 --- /dev/null +++ b/deploy/az/azurefunctions/azurefunctionsdeploy.parameters.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": {} +} \ No newline at end of file diff --git a/deploy/az/azurefunctions/readme.md b/deploy/az/azurefunctions/readme.md new file mode 100644 index 000000000..5716bf615 --- /dev/null +++ b/deploy/az/azurefunctions/readme.md @@ -0,0 +1,37 @@ +# Deploying Azure Functions + +The ARM template `azurefunctionsdeploy.json` and its parameter file (`azurefunctionsdeploy.parameters.json`) are used to deploy Marketing azure functions. + +## Editing azurefunctionsdeploy.parameters.json file + +You can edit the `azurefunctionsdeploy.parameters.parameters.json` file to set your values, but is not needed. + +## Deploy the template + +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: + +``` +create-resources.cmd azurefunctions\azurefunctionsdeploy newResourceGroup -c westus +``` +## Deploy Marketing azure function with Visual Studio. + +Alternatively, instead of using ARM templates, you can deploy Marketing azure function directly by publishing the project Marketing-functions in eShopOnContainers-AzureFunctions.sln with Visual Studio publish tool. + +## Setting Azure function configurations + +Once deployed, go to azure portal and set the connection string for the azure function under the name "SqlConnection". The value must be the connection string which points to MarketingDB. + +Example: + +"SqlConnection": "Server=tcp:eshopsql.database.windows.net,1433;Initial Catalog=marketingdb;" + +In appsettings section, add a new entry named "MarketingStorageUri". The value must be the uri of the blob storage where the campaign images are stored. + +Example: + +"MarketingStorageUri": "https://marketingcampaign.blob.core.windows.net/pics/" + + + diff --git a/deploy/az/cosmos/deploycosmos.json b/deploy/az/cosmos/deploycosmos.json new file mode 100644 index 000000000..8c03983a2 --- /dev/null +++ b/deploy/az/cosmos/deploycosmos.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "name": { + "type": "String" + } + }, + "variables": { + "name": "[concat(parameters('name'), uniqueString(resourceGroup().id))]", + "location":"[resourceGroup().location]" + }, + "resources": [ + { + "type": "Microsoft.DocumentDb/databaseAccounts", + "kind": "MongoDB", + "name": "[variables('name')]", + "apiVersion": "2015-04-08", + "location": "[variables('location')]", + "properties": { + "databaseAccountOfferType": "Standard", + "locations": [ + { + "id": "[concat(variables('name'), '-', variables('location'))]", + "failoverPriority": 0, + "locationName": "[variables('location')]" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/deploy/az/cosmos/deploycosmos.parameters.json b/deploy/az/cosmos/deploycosmos.parameters.json new file mode 100644 index 000000000..725bb7cf9 --- /dev/null +++ b/deploy/az/cosmos/deploycosmos.parameters.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "name": { + "value": "eshop-nosql" + } + } +} \ No newline at end of file diff --git a/deploy/az/create-resources.cmd b/deploy/az/create-resources.cmd new file mode 100644 index 000000000..bd27efe3e --- /dev/null +++ b/deploy/az/create-resources.cmd @@ -0,0 +1,23 @@ +@echo off +if %1.==. GOTO error +if %2.==. GOTO error +if NOT %3.==-c. GOTO deployresources +if %4.==. GOTO error +echo Creating resource group %2 in '%4' +call az group create --name %2 --location %4 +:deployresources +echo Deploying ARM template '%1.json' in resource group %2 +call az group deployment create --resource-group %2 --parameters @%1.parameters.json --template-file %1.json +GOTO end +:error +echo. +echo Usage: +echo create-resources arm-file resource-group-name [-c location] +echo arm-file: Path to ARM template WITHOUT .json extension. An parameter file with same name plus '.parameters' MUST exist in same folde +echo resource-grop-name: Name of the resource group to use or create +echo -c: If appears means that resource group must be created. If -c is specified, must use enter location +echo. +echo Examples: +echo create-resources path_and_filename testgroup (Deploys path_and_filename.json with parameters specified in path_and_filename.parameters.json file). +echo create-resources path_and_filename newgroup -c westus (Deploys path_and_filename.json (with parameters specified in path_and_filename.parameters.json file) in a NEW resource group named newgroup in the westus location) +:end diff --git a/deploy/az/readme.md b/deploy/az/readme.md new file mode 100644 index 000000000..cee4581cb --- /dev/null +++ b/deploy/az/readme.md @@ -0,0 +1,20 @@ +# Deploying resources using create-resources script + +The `create-resources` script is a basic script to allow easy deployment of one ARM template in one resource group. You can deploy to an existing resource group or to create one. + +## Deploying to a existing resource group + +Just type `create-resources path-to-arm-template resourcegroup`. Called this way the script will: + +1. Search for `path-to-arm-template.json` and `path-to-arm-template.parameters.json` files +2. If they exist, will deploy them in the `resourcegroup` specified (that has to exist). + +## Deploying to a new resource group + +Just type `create-resources path-to-arm-template resourcegroup -c location`. Called this way the script will: + +1. Search for `path-to-arm-template.json` and `path-to-arm-template.parameters.json` files +2. If they exist, will create the `resourcegroup` specified in the `location` specified. +3. Finally will deploy `path-to-arm-template.json` and `path-to-arm-template.parameters.json` files in the `resourcegroup` + + diff --git a/deploy/az/redis/readme.md b/deploy/az/redis/readme.md new file mode 100644 index 000000000..093a9af14 --- /dev/null +++ b/deploy/az/redis/readme.md @@ -0,0 +1,31 @@ +# Deploying Redis Cache + +The ARM template `redisdeploy.json` and its parameter file (`redisdeploy.parameters.json`) are used to deploy following resources: + +1. One Redis Cache + +## Editing sbusdeploy.parameters.json file + +You can edit the `redisdeploy.parameters.parameters.json` file to set your values, but is not needed. The only parameter than can +be set is: + +1. `namespaceprefix` is a string that is used to create the Redis namespace. ARM script creates unique values by appending a unique string to this parameter value, so you can leave the default value. + +## Deploy the template + +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: + +``` +create-resources.cmd redis\redisdeploy newResourceGroup -c westus +``` + + + + + + + + + diff --git a/deploy/az/redis/redisdeploy.json b/deploy/az/redis/redisdeploy.json new file mode 100644 index 000000000..04b53a3b6 --- /dev/null +++ b/deploy/az/redis/redisdeploy.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namespaceprefix": { + "type": "string", + "metadata": { + "description": "Name of the Redis namespace" + } + } + }, + "variables": { + "location": "[resourceGroup().location]", + "namespaceprefix": "[concat(parameters('namespaceprefix'), uniqueString(resourceGroup().id))]", + "sbVersion": "2016-04-01" + }, + "resources": [ + { + "type": "Microsoft.Cache/Redis", + "name": "[variables('namespaceprefix')]", + "apiVersion": "[variables('sbVersion')]", + "location": "[variables('location')]", + "scale": null, + "properties": { + "redisVersion": "3.2.7", + "sku": { + "name": "Standard", + "family": "C", + "capacity": 1 + }, + "enableNonSslPort": true, + "redisConfiguration": { + "maxclients": "1000", + "maxmemory-reserved": "50", + "maxfragmentationmemory-reserved": "50", + "maxmemory-policy": "volatile-lru", + "maxmemory-delta": "50" + } + } + } + ] +} \ No newline at end of file diff --git a/deploy/az/redis/redisdeploy.parameters.json b/deploy/az/redis/redisdeploy.parameters.json new file mode 100644 index 000000000..42d2e470e --- /dev/null +++ b/deploy/az/redis/redisdeploy.parameters.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namespaceprefix": { + "value": "eshopredis" + } + } +} \ No newline at end of file diff --git a/deploy/az/servicebus/readme.md b/deploy/az/servicebus/readme.md new file mode 100644 index 000000000..3ed8e8a0e --- /dev/null +++ b/deploy/az/servicebus/readme.md @@ -0,0 +1,33 @@ +# Deploying Azure Service Bus + +The ARM template `sbusdeploy.json` and its parameter file (`sbusdeploy.parameters.json`) are used to deploy following resources: + +1. One Service Bus namespace +2. One Service Bus +3. Subscriptions used by application + +## Editing sbusdeploy.parameters.json file + +You can edit the `sbusdeploy.parameters.parameters.json` file to set your values, but is not needed. The only parameter than can +be set is: + +1. `namespaceprefix` is a string that is used to create the namespace. ARM script creates unique values by appending a unique string to this parameter value, so you can leave the default value. + +## Deploy the template + +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: + +``` +create-resources.cmd servicebus\sbusdeploy newResourceGroup -c westus +``` + + + + + + + + + diff --git a/deploy/az/servicebus/sbusdeploy.json b/deploy/az/servicebus/sbusdeploy.json new file mode 100644 index 000000000..50c1c6c54 --- /dev/null +++ b/deploy/az/servicebus/sbusdeploy.json @@ -0,0 +1,229 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namespaceprefix": { + "type": "string", + "metadata": { + "description": "Name of the Service Bus namespace" + } + } + }, + "variables": { + "serviceBusTopicName": "eshop_event_bus", + "BasketSubscriptionName": "Basket", + "CatalogSubscriptionName": "Catalog", + "OrderingSubscriptionName": "Ordering", + "LocationsSubscriptionName": "Locations", + "MarketingSubscriptionName": "Marketing", + "GracePeriodSubscriptionName": "GracePeriod", + "PaymentSubscriptionName": "Payment", + "location": "[resourceGroup().location]", + "sbVersion": "2015-08-01", + "defaultSASKeyName": "Root", + "namespace":"[concat(parameters('namespaceprefix'), uniqueString(resourceGroup().id))]", + "authRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/topics/authorizationRules', variables('namespace'), variables('serviceBusTopicName'), variables('defaultSASKeyName'))]" + }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('namespace')]", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "[variables('location')]", + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusTopicName')]", + "type": "Topics", + "dependsOn": [ + "[concat('Microsoft.ServiceBus/namespaces/', variables('namespace'))]" + ], + "properties": { + "path": "[variables('serviceBusTopicName')]", + "defaultMessageTimeToLive": "14.00:00:00", + "maxSizeInMegabytes": 1024, + "requiresDuplicateDetection": false, + "enableBatchedOperations": true, + "sizeInBytes": 0, + "filteringMessagesBeforePublishing": false, + "isAnonymousAccessible": false, + "status": "Active", + "supportOrdering": false, + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "enablePartitioning": true, + "isExpress": false, + "enableSubscriptionPartitioning": false, + "enableExpress": false + }, + "resources": [ + { + "type": "AuthorizationRules", + "name": "[variables('defaultSASKeyName')]", + "apiVersion": "[variables('sbVersion')]", + "properties": { + "rights": [ + "Manage", + "Send", + "Listen" + ] + }, + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ] + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('BasketSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('OrderingSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('CatalogSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('LocationsSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('MarketingSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('GracePeriodSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('PaymentSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + } + ] + } + ] + } + ], + "outputs": { + "NamespaceConnectionString": { + "type": "string", + "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]" + } + } +} \ No newline at end of file diff --git a/deploy/az/servicebus/sbusdeploy.parameters.json b/deploy/az/servicebus/sbusdeploy.parameters.json new file mode 100644 index 000000000..f14b5329d --- /dev/null +++ b/deploy/az/servicebus/sbusdeploy.parameters.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namespaceprefix": { + "value": "eshopsb" + } + } +} diff --git a/deploy/az/sql/readme.md b/deploy/az/sql/readme.md new file mode 100644 index 000000000..0359fb727 --- /dev/null +++ b/deploy/az/sql/readme.md @@ -0,0 +1,36 @@ +# Deploying SQL Server & SQL Databases + +The ARM template `sqldeploy.json` and its parameter file (`sqldeploy.parameters.json`) are used to deploy following resources: + +1. One SQL Server +2. Three SQL databases (for ordering, catalog and identity) services. +3. Firewall rules to **allow access from any IP to SQL Server**. This allows easy management, but is not desired in production environments. + +## Editing sqldeploy.parameters.json file + +You **must** edit the `sqldeploy.parameters.json` file to set login and password of the admin user. + +1. `sql_server` is a object parameter that contains the sql server name and the database names. You can leave default values if you want. +2. `admin` is a string with the admin logon. You MUST provide a valid value +3. `adminpwd` is a string with the admin password. You MUST provide a valid value + +ARM script ensures uniqueness of the SQL server created by appending one unique string in its name (defined in the `sql_server.name` parameter). + +## Deploy the template + +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: + +``` +create-resources.cmd sql\sqldeploy newResourceGroup -c westus +``` + + + + + + + + + + diff --git a/deploy/az/sql/sqldeploy.json b/deploy/az/sql/sqldeploy.json new file mode 100644 index 000000000..397c94ad6 --- /dev/null +++ b/deploy/az/sql/sqldeploy.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "sql_server": { + "type": "object" + }, + "admin": { + "type": "string" + }, + "adminpwd": { + "type": "string" + } + }, + "variables": { + "sql_server_name": "[concat(parameters('sql_server').name, '-', uniqueString(resourceGroup().id))]", + "admin": "[parameters('admin')]", + "adminpwd": "[parameters('adminpwd')]" + }, + "resources": [ + { + "type": "Microsoft.Sql/servers", + "name": "[variables('sql_server_name')]", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "administratorLogin": "[variables('admin')]", + "administratorLoginPassword": "[variables('adminpwd')]", + "version": "12.0" + }, + "resources": [ + { + "type": "databases", + "name": "[parameters('sql_server').dbs.ordering]", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "edition": "Standard", + "collation": "SQL_Latin1_General_CP1_CI_AS", + "maxSizeBytes": "1073741824", + "requestedServiceObjectiveName": "S1" + }, + "dependsOn": [ + "[concat('Microsoft.Sql/servers/', variables('sql_server_name'))]" + ] + }, + { + "type": "databases", + "name": "[parameters('sql_server').dbs.identity]", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "edition": "Standard", + "collation": "SQL_Latin1_General_CP1_CI_AS", + "maxSizeBytes": "1073741824", + "requestedServiceObjectiveName": "S1" + }, + "dependsOn": [ + "[concat('Microsoft.Sql/servers/', variables('sql_server_name'))]" + ] + }, + { + "type": "databases", + "name": "[parameters('sql_server').dbs.catalog]", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "edition": "Standard", + "collation": "SQL_Latin1_General_CP1_CI_AS", + "maxSizeBytes": "1073741824", + "requestedServiceObjectiveName": "S1" + }, + "dependsOn": [ + "[concat('Microsoft.Sql/servers/', variables('sql_server_name'))]" + ] + }, + { + "type": "databases", + "name": "[parameters('sql_server').dbs.marketing]", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "edition": "Standard", + "collation": "SQL_Latin1_General_CP1_CI_AS", + "maxSizeBytes": "1073741824", + "requestedServiceObjectiveName": "S1" + }, + "dependsOn": [ + "[concat('Microsoft.Sql/servers/', variables('sql_server_name'))]" + ] + }, + { + "type": "firewallrules", + "name": "AllowAllWindowsAzureIps", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + }, + "dependsOn": [ + "[concat('Microsoft.Sql/servers/', variables('sql_server_name'))]" + ] + }, + { + "type": "firewallrules", + "name": "AllConnectionsAllowed", + "apiVersion": "2014-04-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "255.255.255.255" + }, + "dependsOn": [ + "[concat('Microsoft.Sql/servers/', variables('sql_server_name'))]" + ] + } + ] + } + ], + "outputs": { + } +} diff --git a/deploy/az/sql/sqldeploy.parameters.json b/deploy/az/sql/sqldeploy.parameters.json new file mode 100644 index 000000000..982e78f4c --- /dev/null +++ b/deploy/az/sql/sqldeploy.parameters.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "sql_server": { + "value": { + "name": "eshopsql", + "dbs": { + "ordering": "orderingdb", + "identity": "identitydb", + "catalog": "catalogdb", + "marketing": "marketingdb" + } + } + }, + "admin": { + "value": null + }, + "adminpwd": { + "value": null + } + } +} \ No newline at end of file diff --git a/deploy/az/storage/catalog/deploystorage.json b/deploy/az/storage/catalog/deploystorage.json new file mode 100644 index 000000000..e3fced6b2 --- /dev/null +++ b/deploy/az/storage/catalog/deploystorage.json @@ -0,0 +1,91 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "catalogstorage": { + "type": "string" + }, + "profileName" : { + "type": "string" + } + }, + "variables": { + "catalogstorage": "[concat(parameters('catalogstorage'), uniqueString(resourceGroup().id))]", + "endpointName": "[concat('endpoint-', uniqueString(resourceGroup().id))]", + "profileName": "[parameters('profileName')]" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('catalogstorage')]", + "apiVersion": "2016-01-01", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "[variables('catalogstorage')]" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "name": "[variables('profileName')]", + "type": "Microsoft.Cdn/profiles", + "location": "[resourceGroup().location]", + "apiVersion": "2016-04-02", + "tags": { + "displayName": "[variables('profileName')]" + }, + "sku": { + "name": "Standard_Verizon" + }, + "resources": [ + { + "apiVersion": "2016-04-02", + "name": "[variables('endpointName')]", + "type": "endpoints", + "dependsOn": [ + "[variables('profileName')]", + "[variables('catalogstorage')]" + ], + "location": "[resourceGroup().location]", + "tags": { + "displayName": "[variables('endpointName')]" + }, + "properties": { + "originHostHeader": "[replace(replace(reference(resourceId('Microsoft.Storage/storageAccounts', variables('catalogstorage')),'2015-06-15' ).primaryEndpoints.blob,'https://',''),'/','')]", + "isHttpAllowed": true, + "isHttpsAllowed": true, + "queryStringCachingBehavior": "IgnoreQueryString", + "contentTypesToCompress": [ + "text/plain", + "text/html", + "text/css", + "application/x-javascript", + "text/javascript" + ], + "isCompressionEnabled": "True", + "origins": [ + { + "name": "origin1", + "properties": { + "hostName": "[replace(replace(reference(resourceId('Microsoft.Storage/storageAccounts', variables('catalogstorage')),'2015-06-15' ).primaryEndpoints.blob,'https://',''),'/','')]" + } + } + ] + } + } + ] + } + ], + "outputs": { + "hostName": { + "type": "string", + "value": "[reference(resourceId('Microsoft.cdn/profiles/endpoints', variables('profileName'), variables('endpointName'))).hostName]" + }, + "originHostHeader": { + "type": "string", + "value": "[reference(resourceId('Microsoft.cdn/profiles/endpoints', variables('profileName'), variables('endpointName'))).originHostHeader]" + } + } +} \ No newline at end of file diff --git a/deploy/az/storage/catalog/deploystorage.parameters.json b/deploy/az/storage/catalog/deploystorage.parameters.json new file mode 100644 index 000000000..2c5256a09 --- /dev/null +++ b/deploy/az/storage/catalog/deploystorage.parameters.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "catalogstorage": { + "value": "catalog" + }, + "profileName":{ + "value": "eshopcatalog" + } + } +} \ No newline at end of file diff --git a/deploy/az/storage/marketing/deploystorage.json b/deploy/az/storage/marketing/deploystorage.json new file mode 100644 index 000000000..cceb524d0 --- /dev/null +++ b/deploy/az/storage/marketing/deploystorage.json @@ -0,0 +1,91 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "marketingstorage": { + "type": "string" + }, + "profileName" : { + "type": "string" + } + }, + "variables": { + "marketingstorage": "[concat(parameters('marketingstorage'), uniqueString(resourceGroup().id))]", + "endpointName": "[concat('endpoint-', uniqueString(resourceGroup().id))]", + "profileName": "[parameters('profileName')]" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('marketingstorage')]", + "apiVersion": "2016-01-01", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "[variables('marketingstorage')]" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "name": "[variables('profileName')]", + "type": "Microsoft.Cdn/profiles", + "location": "[resourceGroup().location]", + "apiVersion": "2016-04-02", + "tags": { + "displayName": "[variables('profileName')]" + }, + "sku": { + "name": "Standard_Verizon" + }, + "resources": [ + { + "apiVersion": "2016-04-02", + "name": "[variables('endpointName')]", + "type": "endpoints", + "dependsOn": [ + "[variables('profileName')]", + "[variables('marketingstorage')]" + ], + "location": "[resourceGroup().location]", + "tags": { + "displayName": "[variables('endpointName')]" + }, + "properties": { + "originHostHeader": "[replace(replace(reference(resourceId('Microsoft.Storage/storageAccounts', variables('marketingstorage')),'2015-06-15' ).primaryEndpoints.blob,'https://',''),'/','')]", + "isHttpAllowed": true, + "isHttpsAllowed": true, + "queryStringCachingBehavior": "IgnoreQueryString", + "contentTypesToCompress": [ + "text/plain", + "text/html", + "text/css", + "application/x-javascript", + "text/javascript" + ], + "isCompressionEnabled": "True", + "origins": [ + { + "name": "origin1", + "properties": { + "hostName": "[replace(replace(reference(resourceId('Microsoft.Storage/storageAccounts', variables('marketingstorage')),'2015-06-15' ).primaryEndpoints.blob,'https://',''),'/','')]" + } + } + ] + } + } + ] + } + ], + "outputs": { + "hostName": { + "type": "string", + "value": "[reference(resourceId('Microsoft.cdn/profiles/endpoints', variables('profileName'), variables('endpointName'))).hostName]" + }, + "originHostHeader": { + "type": "string", + "value": "[reference(resourceId('Microsoft.cdn/profiles/endpoints', variables('profileName'), variables('endpointName'))).originHostHeader]" + } + } +} \ No newline at end of file diff --git a/deploy/az/storage/marketing/deploystorage.parameters.json b/deploy/az/storage/marketing/deploystorage.parameters.json new file mode 100644 index 000000000..1608fd34a --- /dev/null +++ b/deploy/az/storage/marketing/deploystorage.parameters.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "marketingstorage": { + "value": "marketing" + }, + "profileName":{ + "value": "eshopmarketing" + } + } +} \ No newline at end of file diff --git a/deploy/az/vms/docker-machine.md b/deploy/az/vms/docker-machine.md new file mode 100644 index 000000000..71cbbd4a7 --- /dev/null +++ b/deploy/az/vms/docker-machine.md @@ -0,0 +1,48 @@ +# Create a VM using docker-machine + +Ensure you are logged in the desired subscription Refer to [this article](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) for more details. + +1. Use `az account show` to find your subscription id. +2. Use `docker-machine create --driver azure --azure-subscription-id --azure-resource-group --azure-ssh-user ` + +After use `docker-machine create` you'll need to authenticate in Azure (even thought if you are logged using `az`, because this is not an Azure CLI 2.0 command). This command will fully create the VM with all the needed settings to run Docker. + +**Note** Refer to this article with all the [parameters that docker-machine accepts when creating Azure VMs](https://docs.docker.com/machine/drivers/azure/#options) for finding more parameters. + +## Connecting your local environment with docker host running on the VM + +Using docker-machine you control the remote VM from your local development environment (you don't need to use ssh to login to remote VM). + +Connecting your local environment to a remote host is using by setting some environment variables, but the easiest way is to use again the docker-machine command. Just type `docker-machine env machine_name` (where machine_name is the name you gave when you created the VM). That command **do not change anything**, so do'nt do really nothing, but **outputs the environment variables you have to set**. This is the output of the command (running on a windows workstation): + +``` +SET DOCKER_TLS_VERIFY=1 +SET DOCKER_HOST=tcp://104.42.236.237:2376 +SET DOCKER_CERT_PATH=C:\Users\etoma\.docker\machine\machines\ufohost +SET DOCKER_MACHINE_NAME=ufohost +SET COMPOSE_CONVERT_WINDOWS_PATHS=true +REM Run this command to configure your shell: +REM @FOR /f "tokens=*" %i IN ('docker-machine env ufohost') DO @%i +``` + +You have to set all these environment variables, or (as the command suggest) just copy and paste the last line in your terminal. + +Once you did this, your local development machine is connected to VM running Docker on Azure: all docker and docker-compose commands will run in the VM instead of your local Docker machine! + + + + + + + + + + + + + + + + + + diff --git a/deploy/az/vms/linux-vm/linuxvm.json b/deploy/az/vms/linux-vm/linuxvm.json new file mode 100644 index 000000000..5b4778ebe --- /dev/null +++ b/deploy/az/vms/linux-vm/linuxvm.json @@ -0,0 +1,199 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "newStorageAccountName": { + "type": "string", + "metadata": { + "description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed." + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "dnsNameForPublicIP": { + "type": "string", + "metadata": { + "description": "Unique DNS Name for the Public IP used to access the Virtual Machine." + } + }, + "ubuntuOSVersion": { + "type": "string", + "defaultValue": "14.04.4-LTS", + "metadata": { + "description": "The Ubuntu version for deploying the Docker containers. This will pick a fully patched image of this given Ubuntu version. Allowed values: 14.04.4-LTS, 15.10, 16.04.0-LTS" + }, + "allowedValues": [ + "14.04.4-LTS", + "15.10", + "16.04.0-LTS" + ] + }, + "VMName": { + "type": "string", + "metadata": { + "description": "Name of VM in Azure" + } + } + }, + "variables": { + "newStorageAccountName": "[take(concat(parameters('newStorageAccountName'), uniqueString(resourceGroup().id)), 23)]", + "dnsNameForPublicIP": "[concat(parameters('dnsNameForPublicIP'), uniqueString(resourceGroup().id))]", + "imagePublisher": "Canonical", + "imageOffer": "UbuntuServer", + "OSDiskName": "osdiskfordockersimple", + "nicName": "myVMNicD", + "extensionName": "DockerExtension", + "addressPrefix": "10.0.0.0/16", + "subnetName": "Subnet", + "subnetPrefix": "10.0.0.0/24", + "storageAccountType": "Standard_LRS", + "publicIPAddressName": "myPublicIPD", + "publicIPAddressType": "Dynamic", + "vmStorageAccountContainerName": "vhds", + "vmName": "[parameters('VMName')]", + "vmSize": "Standard_F1", + "virtualNetworkName": "MyVNETD", + "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('newStorageAccountName')]", + "apiVersion": "2015-05-01-preview", + "location": "[resourceGroup().location]", + "properties": { + "accountType": "[variables('storageAccountType')]" + } + }, + { + "apiVersion": "2015-05-01-preview", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "location": "[resourceGroup().location]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]", + "dnsSettings": { + "domainNameLabel": "[variables('dnsNameForPublicIP')]" + } + } + }, + { + "apiVersion": "2015-05-01-preview", + "type": "Microsoft.Network/virtualNetworks", + "name": "[variables('virtualNetworkName')]", + "location": "[resourceGroup().location]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[variables('addressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[variables('subnetName')]", + "properties": { + "addressPrefix": "[variables('subnetPrefix')]" + } + } + ] + } + }, + { + "apiVersion": "2015-05-01-preview", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetRef')]" + } + } + } + ] + } + }, + { + "apiVersion": "2015-05-01-preview", + "type": "Microsoft.Compute/virtualMachines", + "name": "[variables('vmName')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccountName'))]", + "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[variables('vmSize')]" + }, + "osProfile": { + "computerName": "[variables('vmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[variables('imagePublisher')]", + "offer": "[variables('imageOffer')]", + "sku": "[parameters('ubuntuOSVersion')]", + "version": "latest" + }, + "osDisk": { + "name": "osdisk1", + "vhd": { + "uri": "[concat('http://',variables('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" + } + ] + } + } + }, + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(variables('vmName'),'/', variables('extensionName'))]", + "apiVersion": "2015-05-01-preview", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]" + ], + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "DockerExtension", + "typeHandlerVersion": "1.0", + "autoUpgradeMinorVersion": true, + "settings": { } + } + } + ] +} + diff --git a/deploy/az/vms/linux-vm/linuxvm.parameters.json b/deploy/az/vms/linux-vm/linuxvm.parameters.json new file mode 100644 index 000000000..d34dfd1d9 --- /dev/null +++ b/deploy/az/vms/linux-vm/linuxvm.parameters.json @@ -0,0 +1,7 @@ +{ + "newStorageAccountName": { "value": "eshopsrvmvstorage" }, + "adminUsername": { "value": "eshop" }, + "adminPassword": { "value": "Pass@word" }, + "dnsNameForPublicIP": { "value": "eshop-srv" }, + "VMName": {"value": "MyDockerVM2"} +} diff --git a/deploy/az/vms/plain-vm.md b/deploy/az/vms/plain-vm.md new file mode 100644 index 000000000..4e06ed0d3 --- /dev/null +++ b/deploy/az/vms/plain-vm.md @@ -0,0 +1,77 @@ +# Deploy a VM to run the services + +Follow these instructions to deploy a Linux-based VM with the Docker Host installed, or a VM with Windows Server 2016 plus +windows containers and Docker Daemon. + +**Note**: Use this option, only if you want to provide an environment using images pulled from DockerHub (for example, to create a test environment). If you want to +be able to deploy images built by yourself (but not pushed to DockerHub) follow the [instructions about using docker-machine](./docker-machine.md). + +You can use this machine to install the microservices and having a "development" environment (useful to develop and test the client apps). + +Please note that this deployment is not a production deployment. In a production-based scenario, you should deploy all containers in ACS. + +## Create the VM + +Ensure you are logged in the desired subscription (use `az login` and `az account set` if needed. Refer to [this article](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) for more details. + +Go to `linux-vm` or `win-vm` folder (based on if you want a Linux or Windows VM). Then: + +1. Edit the file `linuxvm.parameters.json` or `windowsvm.parameters.json` (based on what VM do you want to create) with your desired values +2. Run the [create-resources script](../readme.md) to deploy the desired template (`linux-vm/linuxvm.json` or `win-vm/windowsvm.json`). + +I. e. if you are in Windows and want to deploy a linux based VM, in a new resourcegroup located in westus, go to `deploy\az` folder and type: + +``` +create-resources.cmd vms\linux-vm\linuxvm newResourceGroup -c westus +``` + +**Note:** To avoid errors, ARM template used generates unique names for: + +1. VM used storage +2. Public DNS + +Those public names are based on the parameters set in the parameters file. + +### The parameters file (linuxvm.parameters.json or winsowsvm.parameters.json) + +Both files are identical and contains the minimum set of parameters needed by the ARM template to deploy the VM. ARM template accepts some other parameters (set with default values). Look the template for more info. + +The parameters defined are: + +1. `newStorageAccountName`: Name of the storage created for the VM. To ensure uniqueness a unique suffix will be added to this value. +2. `adminUsername`: Admin login +3. `adminPassword`: Admin password +4. `dnsNameForPublicIP`: DNS of the VM. To ensure uniqueness a unique suffix will be added to this value. +5. `VMName`: Name of the VM inside Azure + +## Finding the IP and DNS of the VM + +To find the IP and FQDN of the VM you can type `az vm list --resource-group --output table --show-details` (where resourcegroup is the +name of the resourcegroup where you created the VM). This command will generate output like: + +``` +Name ResourceGroup PowerState PublicIps Fqdns Location +---------- --------------- ------------ ------------- ------------------------------------------------ ---------- +MyDockerVM MyResourceGroup VM running xx.xx.xxx.xxx eshop-srvxxxxxxxxxxxxx.westus.cloudapp.azure.com westus +``` + +You can use this information to connect your new VM. + +## Deploy services in the VM + +We are providing public images of the services in DockerHub (https://hub.docker.com/u/eshop/). To use these images, just create a folder in the VM and copy +following files to it (those files are in the root of the repo): + +1. `docker-compose.nobuild.yml` +2. `docker-compose.prod.yml` + +**Note:** The `docker-compose.nobuild.yml` is just a version of the `docker-compose.yml` without the `build` section. Is neede due [docker-compose bug](https://github.com/docker/compose/issues/2945). + +Then log into the VM and run the command `docker-compose -f docker-compose.nobuild.yml -f docker-compose.prod.yml up --no-build -d` to start all the microservices. + + + + + + + diff --git a/deploy/az/vms/readme.md b/deploy/az/vms/readme.md new file mode 100644 index 000000000..25085f75c --- /dev/null +++ b/deploy/az/vms/readme.md @@ -0,0 +1,10 @@ +## Create VM with Docker installed + +There are two options for creating VM machines with Docker installed: + +1. [Deploying a Linux VM to run single-server development environment using docker-machine (**Recommended for development environments**)](./docker-machine.md) +2. [Deploying a Linux VM or Windows Server 2016 to run a single-server development environment using ARM template (**Recommended for creating testing environments**)](./plain-vm.md) + +If you want to create a VM for deploying images you build locally, then use the first option. + +If you want to create a VM to run images deployed to DockerHub (to provide some test environment) then use the second option. \ No newline at end of file diff --git a/deploy/az/vms/win-vm/windowsvm.json b/deploy/az/vms/win-vm/windowsvm.json new file mode 100644 index 000000000..78bebdfef --- /dev/null +++ b/deploy/az/vms/win-vm/windowsvm.json @@ -0,0 +1,290 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + + "VMName": { + "type": "string", + "metadata": { + "description": "This name will also be used to prefix the network security group, storage, virtual network, network card, subnet and public IP address name." + } + }, + + "adminUsername": { + "type": "string", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + + "dnsNameForPublicIP": { + "type": "string", + "metadata": { + "description": "Unique DNS Name for the Public IP used to access the Virtual Machine." + } + }, + + "newStorageAccountName": { + "type": "string", + "metadata": { + "description": "Storage name for the Virtual Machine." + } + }, + "vmSize": { + "type": "string", + "defaultValue": "Standard_D1", + "metadata": { + "description": "VM Size" + } + } + }, + + "variables": { + "newStorageAccountName": "[take(concat(parameters('newStorageAccountName'), uniqueString(resourceGroup().id)), 23)]", + "dnsNameForPublicIP": "[concat(parameters('dnsNameForPublicIP'), uniqueString(resourceGroup().id))]", + "windowsOSVersion": "2016-Datacenter", + "imagePublisher": "MicrosoftWindowsServer", + "imageOffer": "WindowsServer", + "OSDiskName": "[concat(parameters('VMName'),'_osdisk')]", + "nicName": "[concat(parameters('VMName'),'_nic')]", + "addressPrefix": "10.0.0.0/16", + "subnetName": "[concat(parameters('VMName'),'_subnet')]", + "subnetPrefix": "10.0.0.0/24", + "networkSecurityGroupName": "[concat(parameters('VMName'),'_nsg')]", + "storageAccountType": "Standard_LRS", + "publicIPAddressName": "[concat(parameters('VMName'),'_pubip')]", + "publicIPAddressType": "Dynamic", + "vmStorageAccountContainerName": "vhds", + "apiVersion": "2015-05-01-preview", + "virtualNetworkName": "[concat(parameters('VMName'),'_vnet')]", + "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]" + }, + "resources": [ + { + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[variables('networkSecurityGroupName')]", + "apiVersion": "[variables('apiVersion')]", + "location": "[resourceGroup().location]", + "properties": { + "securityRules": [ + { + "name": "HTTP", + "properties": { + "description": "HTTP", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "80", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 100, + "direction": "Inbound" + } + }, + + { + "name": "RDP", + "properties": { + "description": "RDP", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "3389", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 200, + "direction": "Inbound" + } + }, + + { + "name": "Docker", + "properties": { + "description": "Docker", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "2375", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 300, + "direction": "Inbound" + } + } + + ] + } + }, + + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('newStorageAccountName')]", + "apiVersion": "[variables('apiVersion')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "StorageAccount" + }, + "properties": { + "accountType": "[variables('storageAccountType')]" + } + }, + + { + "apiVersion": "[variables('apiVersion')]", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "PublicIPAddress" + }, + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]", + "dnsSettings": { + "domainNameLabel": "[tolower(variables('dnsNameForPublicIP'))]" + } + } + }, + + { + "apiVersion": "[variables('apiVersion')]", + "type": "Microsoft.Network/virtualNetworks", + "name": "[variables('virtualNetworkName')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]" + ], + "tags": { + "displayName": "VirtualNetwork" + }, + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[variables('addressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[variables('subnetName')]", + "properties": { + "addressPrefix": "[variables('subnetPrefix')]", + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]" + } + } + } + ] + } + }, + + { + "apiVersion": "[variables('apiVersion')]", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "NetworkInterface" + }, + "dependsOn": [ + "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetRef')]" + } + } + } + ] + } + }, + + { + "apiVersion": "[variables('apiVersion')]", + "type": "Microsoft.Compute/virtualMachines", + "name": "[parameters('VMName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "VirtualMachine" + }, + "dependsOn": [ + "[concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccountName'))]", + "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "osProfile": { + "computername": "[parameters('VMName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[variables('imagePublisher')]", + "offer": "[variables('imageOffer')]", + "sku": "[variables('windowsOSVersion')]", + "version": "latest" + }, + "osDisk": { + "name": "osdisk", + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccountName')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" + } + ] + } + }, + "resources": [ + { + "name": "containerConfiguration", + "type": "extensions", + "location": "[resourceGroup().location]", + "apiVersion": "2015-06-15", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', parameters('VMName'))]" + ], + "tags": { + "displayName": "containerConfiguration" + }, + "properties": { + "publisher": "Microsoft.Compute", + "type": "CustomScriptExtension", + "typeHandlerVersion": "1.2", + "autoUpgradeMinorVersion": true, + "settings": { + "fileUris": [ + "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/windows-server-containers-preview/azure-containers.ps1" + ], + "commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File azure-containers.ps1 -adminuser ',parameters('adminUsername'))]" + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/deploy/az/vms/win-vm/windowsvm.parameters.json b/deploy/az/vms/win-vm/windowsvm.parameters.json new file mode 100644 index 000000000..7a2773a54 --- /dev/null +++ b/deploy/az/vms/win-vm/windowsvm.parameters.json @@ -0,0 +1,7 @@ +{ + "newStorageAccountName": { "value": "eshopsrvmvstoragewin" }, + "adminUsername": { "value": "eshop" }, + "adminPassword": { "value": "Pass@word" }, + "dnsNameForPublicIP": { "value": "eshop-srv-win" }, + "VMName": {"value": "eshop-srv-win"} +} diff --git a/deploy/readme.md b/deploy/readme.md new file mode 100644 index 000000000..7d760c6bd --- /dev/null +++ b/deploy/readme.md @@ -0,0 +1,27 @@ +# Deploying Resources On Azure + +## Pre-requisites +1. [Azure CLI 2.0 Installed](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +2. Azure subscription created + +Login into your azure subscription by typing `az login` (note that you maybe need to use `az account set` to set the subscription to use). Refer to [this article](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) for more details + +## Deploying using CLI + +## Deploying Virtual machines to host the services + +1. [Deploying a Linux VM to run single-server development environment using docker-machine (**Recommended for development environments**)](az/vms/docker-machine.md) +2. [Deploying a Linux VM or Windows Server 2016 to run a single-server development environment using ARM template (**Recommended for creating testing environments**)](az/vms/plain-vm.md) + +Using `docker-machine` is the recommended way to create a VM with docker installed. But it is limited to Linux based VMs. + +## Deploying Azure resources used by the services + +1. [Deploying SQL Server and databases](az/sql/readme.md) +2. [Deploying Azure Service Bus](az/servicebus/readme.md) +3. [Deploying Redis Cache](az/redis/readme.md) + + + + + diff --git a/docker-compose-external.yml b/docker-compose-external.yml index ff1641cdd..8d8d61add 100644 --- a/docker-compose-external.yml +++ b/docker-compose-external.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' services: sql.data: diff --git a/docker-compose-windows.override.yml b/docker-compose-windows.override.yml index 738549e7e..84dc5487d 100644 --- a/docker-compose-windows.override.yml +++ b/docker-compose-windows.override.yml @@ -12,9 +12,11 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=basket.data - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket.data} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False ports: - "5103:80" @@ -22,9 +24,13 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - - ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} + - UseCustomizationData=True + - AzureServiceBusEnabled=False ports: - "5101:80" @@ -33,8 +39,14 @@ services: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104 - - ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word - - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105. + - 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 + - ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word} + - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110. + - LocationApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5109 + - MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 + - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 + - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 + - UseCustomizationData=True ports: - "5105:80" @@ -42,9 +54,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - UseCustomizationData=True + - AzureServiceBusEnabled=False ports: - "5102:80" @@ -55,11 +70,14 @@ services: - CatalogUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 - OrderingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 + - BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 + - MarketingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 - 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 + - BasketUrlHC=http://basket.api/hc + - MarketingUrlHC=http://marketing.api/hc + - UseCustomizationData=True ports: - "5104:80" @@ -70,8 +88,9 @@ services: - CatalogUrl=http://catalog.api - OrderingUrl=http://ordering.api - BasketUrl=http://basket.api - - IdentityUrl=http://10.0.75.1:5105 #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. + - 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. + - UseCustomizationData=True #Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. ports: - "5100:80" @@ -90,10 +109,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=mongodb://nosql.data + - ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - Database=LocationsDb - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False ports: - "5109:80" @@ -101,10 +122,48 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word - - EventBusConnection=rabbitmq - - MongoConnectionString=mongodb://nosql.data + - ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word} + - MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - MongoDatabase=MarketingDb - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/campaigns/[0]/pic/} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} + - AzureServiceBusEnabled=False ports: - - "5110:80" \ No newline at end of file + - "5110:80" + + graceperiodmanager: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False + + 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 + - LocationsUrl=http://locations.api/hc + - MarketingUrl=http://marketing.api/hc + - mvc=http://webmvc/hc + - spa=http://webspa/hc + ports: + - "5107:80" + + payment.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False + ports: + - "5108:80" \ No newline at end of file diff --git a/docker-compose-windows.prod.yml b/docker-compose-windows.prod.yml index 4767bba70..57873ccfa 100644 --- a/docker-compose-windows.prod.yml +++ b/docker-compose-windows.prod.yml @@ -17,8 +17,10 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=basket.data - - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket.data} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5103:5103" @@ -26,8 +28,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - - ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG} #Local: You need to open your local dev-machine firewall at range 5100-5110. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} + - UseCustomizationData=True ports: - "5101:80" @@ -36,8 +42,14 @@ services: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104 - - ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word - - MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your host's firewall at range 5100-5105. + - XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback + - ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word} + - MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110. + - LocationApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5109 + - MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110 + - BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 + - OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 + - UseCustomizationData=True ports: - "5105:80" @@ -45,8 +57,11 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - UseCustomizationData=True ports: - "5102:80" @@ -56,12 +71,15 @@ services: - ASPNETCORE_URLS=http://0.0.0.0 - CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 - OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 - - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 + - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5110. + - BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 + - MarketingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110 - 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 + - BasketUrlHC=http://basket.api/hc + - MarketingUrlHC=http://marketing.api/hc + - UseCustomizationData=True ports: - "5104:80" @@ -73,6 +91,7 @@ services: - OrderingUrl=http://ordering.api - 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. - BasketUrl=http://basket.api + - MarketingUrl=http://marketing.api ports: - "5100:80" @@ -80,17 +99,69 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word - - EventBusConnection=rabbitmq - - MongoConnectionString=mongodb://nosql.data + - ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word} + - MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - MongoDatabase=MarketingDb - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} ports: - "5110:80" - + + graceperiodmanager: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + sql.data: environment: - SA_PASSWORD=Pass@word - ACCEPT_EULA=Y ports: - - "5433:1433" \ No newline at end of file + - "5433:1433" + + nosql.data: + ports: + - "27017:27017" + + webstatus: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - 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 + - LocationsUrl=http://locations.api/hc + - MarketingUrl=http://marketing.api/hc + - mvc=http://webmvc/hc + - spa=http://webspa/hc + + ports: + - "5107:80" + + payment.api: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:5108 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + ports: + - "5108:80" + + locations.api: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} + - Database=LocationsDb + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + ports: + - "5109:80" \ No newline at end of file diff --git a/docker-compose-windows.yml b/docker-compose-windows.yml index 5a7e3ff16..6296f5ca7 100644 --- a/docker-compose-windows.yml +++ b/docker-compose-windows.yml @@ -9,6 +9,7 @@ services: depends_on: - basket.data - identity.api + - rabbitmq catalog.api: image: eshop/catalog.api-win:${TAG:-latest} @@ -17,6 +18,7 @@ services: dockerfile: Dockerfile.nanowin depends_on: - sql.data + - rabbitmq identity.api: image: eshop/identity.api-win:${TAG:-latest} @@ -33,6 +35,7 @@ services: dockerfile: Dockerfile.nanowin depends_on: - sql.data + - rabbitmq webspa: image: eshop/webspa-win:${TAG:-latest} @@ -53,12 +56,19 @@ services: - ordering.api - identity.api - basket.api + - marketing.api + webstatus: + image: eshop/webstatus:${TAG:-latest} + build: + context: ./src/Web/WebStatus + dockerfile: Dockerfile.nanowin + locations.api: image: eshop/locations.api:${TAG:-latest} build: context: ./src/Services/Location/Locations.API - dockerfile: Dockerfile + dockerfile: Dockerfile.nanowin depends_on: - nosql.data - rabbitmq @@ -67,7 +77,7 @@ services: image: eshop/marketing.api:${TAG:-latest} build: context: ./src/Services/Marketing/Marketing.API - dockerfile: Dockerfile + dockerfile: Dockerfile.nanowin depends_on: - sql.data - nosql.data @@ -95,7 +105,24 @@ services: # dockerfile: Dockerfile.nanowin ports: - "5672:5672" - + + graceperiodmanager: + image: eshop/graceperiodmanager:${TAG:-latest} + build: + context: ./src/Services/GracePeriod/GracePeriodManager + dockerfile: Dockerfile.nanowin + depends_on: + - sql.data + - rabbitmq + + payment.api: + image: eshop/payment.api:${TAG:-latest} + build: + context: ./src/Services/Payment/Payment.API + dockerfile: Dockerfile.nanowin + depends_on: + - rabbitmq + networks: default: external: diff --git a/docker-compose.ci.build.yml b/docker-compose.ci.build.yml index f32f3b239..db2ef5390 100644 --- a/docker-compose.ci.build.yml +++ b/docker-compose.ci.build.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.1' services: ci-build: diff --git a/docker-compose.dcproj b/docker-compose.dcproj index f7f04c5b4..92590035d 100644 --- a/docker-compose.dcproj +++ b/docker-compose.dcproj @@ -5,6 +5,8 @@ True http://localhost:5100 webmvc + Linux + 2.0 @@ -14,7 +16,7 @@ docker-compose.yml - + docker-compose.yml diff --git a/docker-compose.nobuild.yml b/docker-compose.nobuild.yml index f74aa9c14..0905f9799 100644 --- a/docker-compose.nobuild.yml +++ b/docker-compose.nobuild.yml @@ -1,4 +1,4 @@ -version: '2' +version: '2.1' services: basket.api: diff --git a/docker-compose.override.yml b/docker-compose.override.yml index b840bda61..f3576eb87 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.1' # The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine. # The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: @@ -7,18 +7,16 @@ version: '3' # An external IP or DNS name has to be used (instead localhost and the 10.0.75.1 IP) when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance. services: - graceperiodmanager: - environment: - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - EventBusConnection=rabbitmq basket.api: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=basket.data - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket.data} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False ports: - "5103:80" @@ -26,9 +24,13 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - - ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} + - UseCustomizationData=True + - AzureServiceBusEnabled=False ports: - "5101:80" @@ -38,8 +40,13 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:80 - SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104 - 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 - - ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word - - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105. + - ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word} + - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110. + - LocationApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5109 + - MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 + - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 + - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 + - UseCustomizationData=True ports: - "5105:80" @@ -47,9 +54,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - UseCustomizationData=True + - AzureServiceBusEnabled=False ports: - "5102:80" @@ -57,14 +67,27 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word - - MongoConnectionString=mongodb://nosql.data + - ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word} + - MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - MongoDatabase=MarketingDb - - EventBusConnection=rabbitmq - - ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/campaigns/[0]/pic/} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} + - AzureServiceBusEnabled=False ports: - "5110:80" + + graceperiodmanager: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False webspa: environment: @@ -79,6 +102,8 @@ services: - 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 + - MarketingUrlHC=http://marketing.api/hc + - UseCustomizationData=True ports: - "5104:80" @@ -92,6 +117,7 @@ services: - 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_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. + - UseCustomizationData=True ports: - "5100:80" @@ -114,6 +140,8 @@ services: - OrderingUrl=http://ordering.api/hc - BasketUrl=http://basket.api/hc - IdentityUrl=http://identity.api/hc + - LocationsUrl=http://locations.api/hc + - MarketingUrl=http://marketing.api/hc - mvc=http://webmvc/hc - spa=http://webspa/hc ports: @@ -122,8 +150,9 @@ services: payment.api: environment: - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:5108 - - EventBusConnection=rabbitmq + - ASPNETCORE_URLS=http://0.0.0.0:80 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False ports: - "5108:80" @@ -131,9 +160,11 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=mongodb://nosql.data + - ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - Database=LocationsDb - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureServiceBusEnabled=False ports: - "5109:80" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 8b9762cf5..3b5ff6779 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.1' # The Production docker-compose file has to have the external/real IPs or DNS names for the services # The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: @@ -17,9 +17,10 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=basket.data - - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket.data} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} ports: - "5103:80" @@ -27,9 +28,12 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - - ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG} #Local: You need to open your local dev-machine firewall at range 5100-5110. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} + - UseCustomizationData=True ports: - "5101:80" @@ -38,9 +42,14 @@ services: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104 - - ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word - - MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your host's firewall at range 5100-5105. - XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback + - ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word} + - MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110. + - LocationApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5109 + - MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110 + - BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 + - OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 + - UseCustomizationData=True ports: - "5105:80" @@ -48,9 +57,11 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - identityUrl=http://identity.api #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. - - EventBusConnection=rabbitmq + - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - UseCustomizationData=True ports: - "5102:80" @@ -58,26 +69,41 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word - - MongoConnectionString=mongodb://nosql.data + - ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word} + - MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - MongoDatabase=MarketingDb - - EventBusConnection=rabbitmq - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING} + - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} + - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} ports: - "5110:80" + graceperiodmanager: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + webspa: environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://0.0.0.0:80 - CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 - OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 - - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5110. - BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 + - MarketingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110 - 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 + - MarketingUrlHC=http://marketing.api/hc + - UseCustomizationData=True ports: - "5104:80" @@ -89,6 +115,7 @@ services: - OrderingUrl=http://ordering.api - 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. - BasketUrl=http://basket.api + - MarketingUrl=http://marketing.api ports: - "5100:80" @@ -99,6 +126,10 @@ services: ports: - "5433:1433" + nosql.data: + ports: + - "27017:27017" + webstatus: environment: - ASPNETCORE_ENVIRONMENT=Production @@ -106,9 +137,31 @@ services: - CatalogUrl=http://catalog.api/hc - OrderingUrl=http://ordering.api/hc - BasketUrl=http://basket.api/hc - - IdentityUrl=http://identity.api/hc + - IdentityUrl=http://identity.api/hc + - LocationsUrl=http://locations.api/hc + - MarketingUrl=http://marketing.api/hc - mvc=http://webmvc/hc - spa=http://webspa/hc ports: - - "5107:80" \ No newline at end of file + - "5107:80" + + payment.api: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:5108 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + ports: + - "5108:80" + + locations.api: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} + - Database=LocationsDb + - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + ports: + - "5109:80" \ No newline at end of file diff --git a/docker-compose.vs.debug.yml b/docker-compose.vs.debug.yml index b0c792d32..9c4879f61 100644 --- a/docker-compose.vs.debug.yml +++ b/docker-compose.vs.debug.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.1' services: basket.api: diff --git a/docker-compose.vs.release.yml b/docker-compose.vs.release.yml index 6aac3f799..92be2557b 100644 --- a/docker-compose.vs.release.yml +++ b/docker-compose.vs.release.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.1' services: basket.api: diff --git a/docker-compose.yml b/docker-compose.yml index 66b8ba49e..3d60489b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,6 @@ -version: '3' +version: '2.1' services: - graceperiodmanager: - image: eshop/graceperiodmanager:${TAG:-latest} - build: - context: ./src/Services/GracePeriod/GracePeriodManager - dockerfile: Dockerfile - depends_on: - - sql.data - - rabbitmq basket.api: image: eshop/basket.api:${TAG:-latest} @@ -18,6 +10,7 @@ services: depends_on: - basket.data - identity.api + - rabbitmq catalog.api: image: eshop/catalog.api:${TAG:-latest} @@ -56,6 +49,15 @@ services: - identity.api - rabbitmq + graceperiodmanager: + image: eshop/graceperiodmanager:${TAG:-latest} + build: + context: ./src/Services/GracePeriod/GracePeriodManager + dockerfile: Dockerfile + depends_on: + - sql.data + - rabbitmq + webspa: image: eshop/webspa:${TAG:-latest} build: diff --git a/docs/Containerized Docker Application Lifecycle with Microsoft Platform and Tools (eBook).pdf b/docs/Containerized Docker Application Lifecycle with Microsoft Platform and Tools (eBook).pdf new file mode 100644 index 000000000..118c4509e Binary files /dev/null and b/docs/Containerized Docker Application Lifecycle with Microsoft Platform and Tools (eBook).pdf differ diff --git a/docs/Containerized-Docker-Application-Lifecycle-with-Microsoft-Platform-and-Tools-(eBook)_v1.1.pdf b/docs/Containerized-Docker-Application-Lifecycle-with-Microsoft-Platform-and-Tools-(eBook)_v1.1.pdf new file mode 100644 index 000000000..de441b906 Binary files /dev/null and b/docs/Containerized-Docker-Application-Lifecycle-with-Microsoft-Platform-and-Tools-(eBook)_v1.1.pdf differ diff --git a/eShopOnContainers-AzureFunctions.sln b/eShopOnContainers-AzureFunctions.sln new file mode 100644 index 000000000..7e14fc19d --- /dev/null +++ b/eShopOnContainers-AzureFunctions.sln @@ -0,0 +1,96 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26608.5 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{5B1011EC-CEE5-47AA-B336-99381D573679}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureFunctions", "AzureFunctions", "{106B787C-2CFF-4484-8C07-D14589859E94}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "marketing-functions", "src\Services\Marketing\Infrastructure\AzureFunctions\marketing-functions.csproj", "{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Ad-Hoc|Any CPU = Ad-Hoc|Any CPU + Ad-Hoc|ARM = Ad-Hoc|ARM + Ad-Hoc|iPhone = Ad-Hoc|iPhone + Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator + Ad-Hoc|x64 = Ad-Hoc|x64 + Ad-Hoc|x86 = Ad-Hoc|x86 + AppStore|Any CPU = AppStore|Any CPU + AppStore|ARM = AppStore|ARM + AppStore|iPhone = AppStore|iPhone + AppStore|iPhoneSimulator = AppStore|iPhoneSimulator + AppStore|x64 = AppStore|x64 + AppStore|x86 = AppStore|x86 + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|iPhone = Debug|iPhone + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|ARM.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhone.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x64.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x64.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x86.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x86.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|ARM.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhone.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x64.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x64.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x86.ActiveCfg = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x86.Build.0 = Debug|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|Any CPU.Build.0 = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|ARM.ActiveCfg = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|ARM.Build.0 = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhone.ActiveCfg = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhone.Build.0 = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x64.ActiveCfg = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x64.Build.0 = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x86.ActiveCfg = Release|Any CPU + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {106B787C-2CFF-4484-8C07-D14589859E94} = {5B1011EC-CEE5-47AA-B336-99381D573679} + {B363EF31-DD1A-46C8-ADDF-CD30A756E97B} = {106B787C-2CFF-4484-8C07-D14589859E94} + EndGlobalSection +EndGlobal diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index 0a36c0c57..9dd6308a4 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -1,12 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3AF739CD-81D8-428D-A08A-0A58372DEBF6}" ProjectSection(SolutionItems) = preProject + Local.testsettings = Local.testsettings NuGet.config = NuGet.config EndProjectSection EndProject @@ -42,8 +45,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\Services\U EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Identity.API", "src\Services\Identity\Identity.API\Identity.API.csproj", "{A579E108-5445-403D-A407-339AC4D1611B}" EndProject -Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSPA", "src\Web\WebSPA\WebSPA.csproj", "{F16E3C6A-1C94-4EAB-BE91-099618060B68}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests", "test\Services\IntegrationTests\IntegrationTests.csproj", "{5B810E3D-112E-4857-B197-F09D2FD41E27}" @@ -58,21 +59,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus", "src\BuildingBlo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBusRabbitMQ", "src\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj", "{8088F3FC-6787-45FA-A924-816EC81CBFAC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationEventLogEF", "src\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj", "{9EE28E45-1533-472B-8267-56C48855BA0E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationEventLogEF", "src\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj", "{9EE28E45-1533-472B-8267-56C48855BA0E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthChecks", "HealthChecks", "{A81ECBC2-6B00-4DCD-8388-469174033379}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj", "{942ED6E8-0050-495F-A0EA-01E97F63760C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebStatus", "src\Web\WebStatus\WebStatus.csproj", "{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebStatus", "src\Web\WebStatus\WebStatus.csproj", "{C0A7918D-B4F2-4E7F-8DE2-1E5279EF079F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Resilience", "Resilience", "{FBF43D93-F2E7-4FF8-B4AB-186895949B88}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resilience.Http", "src\BuildingBlocks\Resilience\Resilience.Http\Resilience.Http.csproj", "{D1C47FF1-91F1-4CAF-9ABB-AD642B821502}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Resilience.Http", "src\BuildingBlocks\Resilience\Resilience.Http\Resilience.Http.csproj", "{D1C47FF1-91F1-4CAF-9ABB-AD642B821502}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{022E145D-1593-47EE-9608-8E323D3C63F5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{1A01AF82-6FCB-464C-B39C-F127AEBD315D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{1A01AF82-6FCB-464C-B39C-F127AEBD315D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.HealthChecks", "src\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj", "{22A0F9C1-2D4A-4107-95B7-8459E6688BC5}" EndProject @@ -80,22 +81,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Health EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "src\BuildingBlocks\EventBus\EventBus.Tests\EventBus.Tests.csproj", "{4A980AC4-7205-46BF-8CCB-09E44D700FD4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GracePeriod", "GracePeriod", "{F38B4FF0-0B49-405A-B1B4-F7A5E3BC4C4E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GracePeriodManager", "src\Services\GracePeriod\GracePeriodManager\GracePeriodManager.csproj", "{F6E0F0DD-1400-43C3-B5E0-7CC325728C47}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GracePeriodManager", "src\Services\GracePeriod\GracePeriodManager\GracePeriodManager.csproj", "{F6E0F0DD-1400-43C3-B5E0-7CC325728C47}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Location", "Location", "{41139F64-4046-4F16-96B7-D941D96FA9C6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Locations.API", "src\Services\Location\Locations.API\Locations.API.csproj", "{E7581357-FC34-474C-B8F5-307EE3CE05EF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Locations.API", "src\Services\Location\Locations.API\Locations.API.csproj", "{E7581357-FC34-474C-B8F5-307EE3CE05EF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataProtection", "DataProtection", "{88B22DBB-AA8F-4290-A454-2C109352C345}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataProtection", "src\BuildingBlocks\DataProtection\DataProtection\DataProtection.csproj", "{23A33F9B-7672-426D-ACF9-FF8436ADC81A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataProtection", "src\BuildingBlocks\DataProtection\DataProtection\DataProtection.csproj", "{23A33F9B-7672-426D-ACF9-FF8436ADC81A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Marketing", "Marketing", "{A5260DE0-1FDD-467E-9CC1-A028AB081CEE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marketing.API", "src\Services\Marketing\Marketing.API\Marketing.API.csproj", "{DF395F85-B010-465D-857A-7EBCC512C0C2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBusServiceBus", "src\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj", "{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{768C887F-C229-4B94-ACD8-0C7F65686524}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTest", "test\Services\LoadTest\LoadTest.csproj", "{969E793C-C413-490E-9C9D-B2B46DA5AF32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -124,6 +129,54 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.Build.0 = Release|Any CPU {2110CBB0-3B38-4EE4-A743-DF6968D80D90}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {2110CBB0-3B38-4EE4-A743-DF6968D80D90}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU {2110CBB0-3B38-4EE4-A743-DF6968D80D90}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU @@ -398,54 +451,6 @@ Global {A579E108-5445-403D-A407-339AC4D1611B}.Release|x64.Build.0 = Release|Any CPU {A579E108-5445-403D-A407-339AC4D1611B}.Release|x86.ActiveCfg = Release|Any CPU {A579E108-5445-403D-A407-339AC4D1611B}.Release|x86.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.Build.0 = Release|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU @@ -1262,6 +1267,150 @@ Global {DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x64.Build.0 = Release|Any CPU {DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x86.ActiveCfg = Release|Any CPU {DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x86.Build.0 = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|ARM.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|iPhone.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|x64.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|x64.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|x86.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.AppStore|x86.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|ARM.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|ARM.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|iPhone.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|x64.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|x86.ActiveCfg = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Debug|x86.Build.0 = Debug|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|Any CPU.Build.0 = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|ARM.ActiveCfg = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|ARM.Build.0 = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|iPhone.ActiveCfg = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|iPhone.Build.0 = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x64.ActiveCfg = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x64.Build.0 = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.ActiveCfg = Release|Any CPU + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.Build.0 = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|ARM.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhone.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x64.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x64.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x86.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.AppStore|x86.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|ARM.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|ARM.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhone.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x64.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x64.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x86.ActiveCfg = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Debug|x86.Build.0 = Debug|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|Any CPU.Build.0 = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|ARM.ActiveCfg = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|ARM.Build.0 = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhone.ActiveCfg = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhone.Build.0 = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x64.ActiveCfg = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x64.Build.0 = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x86.ActiveCfg = Release|Any CPU + {768C887F-C229-4B94-ACD8-0C7F65686524}.Release|x86.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|ARM.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x64.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Ad-Hoc|x86.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|Any CPU.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|ARM.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|ARM.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhone.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x64.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x64.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x86.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.AppStore|x86.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|ARM.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|ARM.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhone.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x64.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x64.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x86.ActiveCfg = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Debug|x86.Build.0 = Debug|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|Any CPU.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|ARM.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|ARM.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhone.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhone.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x64.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x64.Build.0 = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.ActiveCfg = Release|Any CPU + {969E793C-C413-490E-9C9D-B2B46DA5AF32}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1300,13 +1449,15 @@ Global {22A0F9C1-2D4A-4107-95B7-8459E6688BC5} = {A81ECBC2-6B00-4DCD-8388-469174033379} {4BD76717-3102-4969-8C2C-BAAA3F0263B6} = {A81ECBC2-6B00-4DCD-8388-469174033379} {4A980AC4-7205-46BF-8CCB-09E44D700FD4} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F} - {F38B4FF0-0B49-405A-B1B4-F7A5E3BC4C4E} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47} = {F38B4FF0-0B49-405A-B1B4-F7A5E3BC4C4E} + {F6E0F0DD-1400-43C3-B5E0-7CC325728C47} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B} {41139F64-4046-4F16-96B7-D941D96FA9C6} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} {E7581357-FC34-474C-B8F5-307EE3CE05EF} = {41139F64-4046-4F16-96B7-D941D96FA9C6} {88B22DBB-AA8F-4290-A454-2C109352C345} = {DB0EFB20-B024-4E5E-A75C-52143C131D25} {23A33F9B-7672-426D-ACF9-FF8436ADC81A} = {88B22DBB-AA8F-4290-A454-2C109352C345} {A5260DE0-1FDD-467E-9CC1-A028AB081CEE} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} {DF395F85-B010-465D-857A-7EBCC512C0C2} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE} + {69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F} + {768C887F-C229-4B94-ACD8-0C7F65686524} = {A81ECBC2-6B00-4DCD-8388-469174033379} + {969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870} EndGlobalSection EndGlobal diff --git a/eShopOnContainers.sln b/eShopOnContainers.sln index 0650b6465..414ff7993 100644 --- a/eShopOnContainers.sln +++ b/eShopOnContainers.sln @@ -3,6 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" + ProjectSection(ProjectDependencies) = postProject + {A579E108-5445-403D-A407-339AC4D1611B} = {A579E108-5445-403D-A407-339AC4D1611B} + {9842DB3A-1391-48C7-A49C-2FABD0A18AC2} = {9842DB3A-1391-48C7-A49C-2FABD0A18AC2} + {23FB706A-2701-41E9-8BF9-28936001CA41} = {23FB706A-2701-41E9-8BF9-28936001CA41} + {F0333D8E-0B27-42B7-B2C6-78F3657624E2} = {F0333D8E-0B27-42B7-B2C6-78F3657624E2} + {42681D9D-750A-4DF7-BD9F-9292CFD5C253} = {42681D9D-750A-4DF7-BD9F-9292CFD5C253} + {2110CBB0-3B38-4EE4-A743-DF6968D80D90} = {2110CBB0-3B38-4EE4-A743-DF6968D80D90} + {231226CE-690B-4979-8870-9A79D80928E2} = {231226CE-690B-4979-8870-9A79D80928E2} + {2DA840CE-FCEA-4CF7-B1A1-ADD7775E7357} = {2DA840CE-FCEA-4CF7-B1A1-ADD7775E7357} + EndProjectSection +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{91CF7717-08AB-4E65-B10E-0B426F01E2E8}" @@ -28,6 +40,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A857AD10-40FF-4303-BEC2-FF1C58D5735E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{EF0337F2-ED00-4643-89FD-EE10863F1870}" + ProjectSection(SolutionItems) = preProject + test\Services\LoadTest\LoadTest.csproj = test\Services\LoadTest\LoadTest.csproj + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebMVC", "src\Web\WebMVC\WebMVC.csproj", "{F0333D8E-0B27-42B7-B2C6-78F3657624E2}" EndProject @@ -49,7 +64,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.UnitTests EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.TestRunner.Droid", "src\Mobile\eShopOnContainers\eShopOnContainers.TestRunner.Droid\eShopOnContainers.TestRunner.Droid.csproj", "{A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.TestRunner.Windows", "src\Mobile\eShopOnContainers\eShopOnContainers.TestRunner.Windows\eShopOnContainers.TestRunner.Windows.csproj", "{02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.TestRunner.Windows", "src\Mobile\eShopOnContainers\eShopOnContainers.TestRunner.Windows\eShopOnContainers.TestRunner.Windows.csproj", "{A7337243-33B8-463A-87AD-944B75EFD820}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.TestRunner.iOS", "src\Mobile\eShopOnContainers\eShopOnContainers.TestRunner.iOS\eShopOnContainers.TestRunner.iOS.csproj", "{B68C2B56-7581-46AE-B55D-D25DDFD3BFE3}" EndProject @@ -67,18 +82,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "test\Services\U EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Identity.API", "src\Services\Identity\Identity.API\Identity.API.csproj", "{A579E108-5445-403D-A407-339AC4D1611B}" EndProject -Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" - ProjectSection(ProjectDependencies) = postProject - {A579E108-5445-403D-A407-339AC4D1611B} = {A579E108-5445-403D-A407-339AC4D1611B} - {9842DB3A-1391-48C7-A49C-2FABD0A18AC2} = {9842DB3A-1391-48C7-A49C-2FABD0A18AC2} - {23FB706A-2701-41E9-8BF9-28936001CA41} = {23FB706A-2701-41E9-8BF9-28936001CA41} - {F0333D8E-0B27-42B7-B2C6-78F3657624E2} = {F0333D8E-0B27-42B7-B2C6-78F3657624E2} - {42681D9D-750A-4DF7-BD9F-9292CFD5C253} = {42681D9D-750A-4DF7-BD9F-9292CFD5C253} - {2110CBB0-3B38-4EE4-A743-DF6968D80D90} = {2110CBB0-3B38-4EE4-A743-DF6968D80D90} - {231226CE-690B-4979-8870-9A79D80928E2} = {231226CE-690B-4979-8870-9A79D80928E2} - {2DA840CE-FCEA-4CF7-B1A1-ADD7775E7357} = {2DA840CE-FCEA-4CF7-B1A1-ADD7775E7357} - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildingBlocks", "BuildingBlocks", "{1EF3AC0F-F27C-46DD-AC53-D762D2C11C45}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EventBus", "EventBus", "{B473B70F-0796-4862-B1AD-BB742D93B868}" @@ -105,6 +108,30 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebStatus", "src\Web\WebSta EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.SqlServer", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.SqlServer\Microsoft.Extensions.HealthChecks.SqlServer.csproj", "{6CCC4F1B-602D-4FAD-91A7-002CC86C7612}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataProtection", "DataProtection", "{CC0FD121-5E19-44B6-B23F-0FE3D1B821D3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataProtection", "src\BuildingBlocks\DataProtection\DataProtection\DataProtection.csproj", "{237CA273-8555-4944-B87D-5B65AB3A788C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Location", "Location", "{0CF40BE0-A463-4E4F-A29C-C7427D04DC4F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Locations.API", "src\Services\Location\Locations.API\Locations.API.csproj", "{B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Marketing", "Marketing", "{72704C77-5C90-4705-B2A4-7A6E3B02FF08}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marketing.API", "src\Services\Marketing\Marketing.API\Marketing.API.csproj", "{5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBusServiceBus", "src\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj", "{26906157-98E3-4DF8-80F6-866B9686887C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "src\BuildingBlocks\EventBus\EventBus.Tests\EventBus.Tests.csproj", "{8AE2AAA3-4507-4BEE-9250-4D16F87015B4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.HealthChecks.AzureStorage", "src\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.AzureStorage\Microsoft.Extensions.HealthChecks.AzureStorage.csproj", "{1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GracePeriodManager", "src\Services\GracePeriod\GracePeriodManager\GracePeriodManager.csproj", "{6C6A69FE-A484-4E75-AFEC-827EA354AF46}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Payment", "Payment", "{D5D3841D-F282-4E60-B9CB-267A1BF2D893}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Payment.API", "src\Services\Payment\Payment.API\Payment.API.csproj", "{2A795FEA-2EB7-45F5-9B30-35E0810CB238}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -133,6 +160,54 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.ActiveCfg = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.Build.0 = Debug|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.Build.0 = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.ActiveCfg = Release|Any CPU + {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.Build.0 = Release|Any CPU {2110CBB0-3B38-4EE4-A743-DF6968D80D90}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {2110CBB0-3B38-4EE4-A743-DF6968D80D90}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU {2110CBB0-3B38-4EE4-A743-DF6968D80D90}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU @@ -599,72 +674,72 @@ Global {A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1}.Release|x86.ActiveCfg = Release|Any CPU {A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1}.Release|x86.Build.0 = Release|Any CPU {A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1}.Release|x86.Deploy.0 = Release|Any CPU - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|Any CPU.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|Any CPU.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|Any CPU.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|ARM.Build.0 = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|ARM.Deploy.0 = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|iPhone.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|iPhone.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|iPhone.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|x64.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|x64.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|x64.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|x86.Build.0 = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Ad-Hoc|x86.Deploy.0 = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|Any CPU.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|Any CPU.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|Any CPU.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|ARM.ActiveCfg = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|ARM.Build.0 = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|ARM.Deploy.0 = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|iPhone.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|iPhone.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|iPhone.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|iPhoneSimulator.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|iPhoneSimulator.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|iPhoneSimulator.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|x64.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|x64.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|x64.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|x86.ActiveCfg = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|x86.Build.0 = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.AppStore|x86.Deploy.0 = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|Any CPU.ActiveCfg = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|Any CPU.Build.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|Any CPU.Deploy.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|ARM.ActiveCfg = Debug|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|ARM.Build.0 = Debug|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|ARM.Deploy.0 = Debug|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|iPhone.ActiveCfg = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|iPhone.Build.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|iPhone.Deploy.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|iPhoneSimulator.Build.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|iPhoneSimulator.Deploy.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|x64.ActiveCfg = Debug|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|x64.Build.0 = Debug|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|x64.Deploy.0 = Debug|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|x86.ActiveCfg = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|x86.Build.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Debug|x86.Deploy.0 = Debug|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|Any CPU.ActiveCfg = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|ARM.ActiveCfg = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|ARM.Build.0 = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|ARM.Deploy.0 = Release|ARM - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|iPhone.ActiveCfg = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|iPhoneSimulator.ActiveCfg = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|x64.ActiveCfg = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|x64.Build.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|x64.Deploy.0 = Release|x64 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|x86.ActiveCfg = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|x86.Build.0 = Release|x86 - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F}.Release|x86.Deploy.0 = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|Any CPU.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|Any CPU.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|Any CPU.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|ARM.ActiveCfg = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|ARM.Build.0 = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|ARM.Deploy.0 = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|iPhone.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|iPhone.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|iPhone.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|x64.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|x64.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|x64.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|x86.ActiveCfg = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|x86.Build.0 = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Ad-Hoc|x86.Deploy.0 = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|Any CPU.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|Any CPU.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|Any CPU.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|ARM.ActiveCfg = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|ARM.Build.0 = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|ARM.Deploy.0 = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|iPhone.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|iPhone.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|iPhone.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|iPhoneSimulator.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|iPhoneSimulator.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|iPhoneSimulator.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|x64.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|x64.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|x64.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|x86.ActiveCfg = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|x86.Build.0 = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.AppStore|x86.Deploy.0 = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|Any CPU.ActiveCfg = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|Any CPU.Build.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|Any CPU.Deploy.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|ARM.ActiveCfg = Debug|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|ARM.Build.0 = Debug|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|ARM.Deploy.0 = Debug|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|iPhone.ActiveCfg = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|iPhone.Build.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|iPhone.Deploy.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|iPhoneSimulator.Build.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|iPhoneSimulator.Deploy.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|x64.ActiveCfg = Debug|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|x64.Build.0 = Debug|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|x64.Deploy.0 = Debug|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|x86.ActiveCfg = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|x86.Build.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Debug|x86.Deploy.0 = Debug|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|Any CPU.ActiveCfg = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|ARM.ActiveCfg = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|ARM.Build.0 = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|ARM.Deploy.0 = Release|ARM + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|iPhone.ActiveCfg = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|iPhoneSimulator.ActiveCfg = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|x64.ActiveCfg = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|x64.Build.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|x64.Deploy.0 = Release|x64 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|x86.ActiveCfg = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|x86.Build.0 = Release|x86 + {A7337243-33B8-463A-87AD-944B75EFD820}.Release|x86.Deploy.0 = Release|x86 {B68C2B56-7581-46AE-B55D-D25DDFD3BFE3}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone {B68C2B56-7581-46AE-B55D-D25DDFD3BFE3}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone {B68C2B56-7581-46AE-B55D-D25DDFD3BFE3}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone @@ -986,54 +1061,6 @@ Global {A579E108-5445-403D-A407-339AC4D1611B}.Release|x64.Build.0 = Release|Any CPU {A579E108-5445-403D-A407-339AC4D1611B}.Release|x86.ActiveCfg = Release|Any CPU {A579E108-5445-403D-A407-339AC4D1611B}.Release|x86.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|ARM.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhone.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x64.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.AppStore|x86.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|ARM.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhone.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x64.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.ActiveCfg = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Debug|x86.Build.0 = Debug|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|Any CPU.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|ARM.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhone.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x64.Build.0 = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.ActiveCfg = Release|Any CPU - {FEA0C318-FFED-4D39-8781-265718CA43DD}.Release|x86.Build.0 = Release|Any CPU {3D6B7A87-162E-4479-B256-1291BEB503B6}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {3D6B7A87-162E-4479-B256-1291BEB503B6}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {3D6B7A87-162E-4479-B256-1291BEB503B6}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU @@ -1466,6 +1493,390 @@ Global {6CCC4F1B-602D-4FAD-91A7-002CC86C7612}.Release|x64.Build.0 = Release|Any CPU {6CCC4F1B-602D-4FAD-91A7-002CC86C7612}.Release|x86.ActiveCfg = Release|Any CPU {6CCC4F1B-602D-4FAD-91A7-002CC86C7612}.Release|x86.Build.0 = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|ARM.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|iPhone.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|x64.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|x64.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|x86.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.AppStore|x86.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|ARM.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|iPhone.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|x64.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|x64.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|x86.ActiveCfg = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Debug|x86.Build.0 = Debug|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|Any CPU.Build.0 = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|ARM.ActiveCfg = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|ARM.Build.0 = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|iPhone.ActiveCfg = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|iPhone.Build.0 = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|x64.ActiveCfg = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|x64.Build.0 = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|x86.ActiveCfg = Release|Any CPU + {237CA273-8555-4944-B87D-5B65AB3A788C}.Release|x86.Build.0 = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|ARM.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|iPhone.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|x64.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|x64.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|x86.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.AppStore|x86.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|ARM.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|iPhone.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|x64.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|x64.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|x86.ActiveCfg = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Debug|x86.Build.0 = Debug|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|Any CPU.Build.0 = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|ARM.ActiveCfg = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|ARM.Build.0 = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|iPhone.ActiveCfg = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|iPhone.Build.0 = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|x64.ActiveCfg = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|x64.Build.0 = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|x86.ActiveCfg = Release|Any CPU + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800}.Release|x86.Build.0 = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|ARM.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|iPhone.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|x64.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|x64.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|x86.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.AppStore|x86.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|ARM.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|ARM.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|iPhone.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|x64.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|x64.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|x86.ActiveCfg = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Debug|x86.Build.0 = Debug|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|Any CPU.Build.0 = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|ARM.ActiveCfg = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|ARM.Build.0 = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|iPhone.ActiveCfg = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|iPhone.Build.0 = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|x64.ActiveCfg = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|x64.Build.0 = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|x86.ActiveCfg = Release|Any CPU + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5}.Release|x86.Build.0 = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|ARM.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|iPhone.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|x64.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|x64.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|x86.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.AppStore|x86.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|ARM.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|iPhone.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|x64.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|x64.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|x86.ActiveCfg = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Debug|x86.Build.0 = Debug|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|Any CPU.Build.0 = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|ARM.ActiveCfg = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|ARM.Build.0 = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|iPhone.ActiveCfg = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|iPhone.Build.0 = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|x64.ActiveCfg = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|x64.Build.0 = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|x86.ActiveCfg = Release|Any CPU + {26906157-98E3-4DF8-80F6-866B9686887C}.Release|x86.Build.0 = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|ARM.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|iPhone.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|x64.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|x64.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|x86.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.AppStore|x86.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|ARM.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|ARM.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|iPhone.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|x64.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|x64.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|x86.ActiveCfg = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Debug|x86.Build.0 = Debug|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|Any CPU.Build.0 = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|ARM.ActiveCfg = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|ARM.Build.0 = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|iPhone.ActiveCfg = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|iPhone.Build.0 = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|x64.ActiveCfg = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|x64.Build.0 = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|x86.ActiveCfg = Release|Any CPU + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4}.Release|x86.Build.0 = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|ARM.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|iPhone.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|x64.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|x64.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|x86.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.AppStore|x86.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|ARM.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|ARM.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|iPhone.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|x64.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|x64.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|x86.ActiveCfg = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Debug|x86.Build.0 = Debug|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|Any CPU.Build.0 = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|ARM.ActiveCfg = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|ARM.Build.0 = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|iPhone.ActiveCfg = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|iPhone.Build.0 = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x64.ActiveCfg = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x64.Build.0 = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.ActiveCfg = Release|Any CPU + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD}.Release|x86.Build.0 = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|ARM.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhone.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x64.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x64.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x86.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.AppStore|x86.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|ARM.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhone.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x64.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x64.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x86.ActiveCfg = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Debug|x86.Build.0 = Debug|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|Any CPU.Build.0 = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|ARM.ActiveCfg = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|ARM.Build.0 = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhone.ActiveCfg = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhone.Build.0 = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x64.ActiveCfg = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x64.Build.0 = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x86.ActiveCfg = Release|Any CPU + {6C6A69FE-A484-4E75-AFEC-827EA354AF46}.Release|x86.Build.0 = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|ARM.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|iPhone.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|x64.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|x64.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|x86.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.AppStore|x86.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|ARM.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|ARM.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|iPhone.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|x64.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|x64.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|x86.ActiveCfg = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Debug|x86.Build.0 = Debug|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|Any CPU.Build.0 = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|ARM.ActiveCfg = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|ARM.Build.0 = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|iPhone.ActiveCfg = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|iPhone.Build.0 = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x64.ActiveCfg = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x64.Build.0 = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x86.ActiveCfg = Release|Any CPU + {2A795FEA-2EB7-45F5-9B30-35E0810CB238}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1492,7 +1903,7 @@ Global {B7B1D395-4E06-4036-BE86-C216756B9367} = {A857AD10-40FF-4303-BEC2-FF1C58D5735E} {F7B6A162-BC4D-4924-B16A-713F9B0344E7} = {B7B1D395-4E06-4036-BE86-C216756B9367} {A289A7F0-ACD8-42AE-87B6-AB1AFD310BF1} = {B7B1D395-4E06-4036-BE86-C216756B9367} - {02680C26-CA1D-4D9D-A7E3-D66AF5BE6F2F} = {B7B1D395-4E06-4036-BE86-C216756B9367} + {A7337243-33B8-463A-87AD-944B75EFD820} = {B7B1D395-4E06-4036-BE86-C216756B9367} {B68C2B56-7581-46AE-B55D-D25DDFD3BFE3} = {B7B1D395-4E06-4036-BE86-C216756B9367} {95F1F07C-4D92-4742-BD07-E5B805AAB651} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B} {02DF7FEE-C302-433D-A6CD-237A2569F236} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} @@ -1514,5 +1925,17 @@ Global {D92EB452-7A72-4B26-A8ED-0204CD376BC4} = {D13768ED-5AF1-4E09-96DD-FF6E7A2E5E06} {23FB706A-2701-41E9-8BF9-28936001CA41} = {E279BF0F-7F66-4F3A-A3AB-2CDA66C1CD04} {6CCC4F1B-602D-4FAD-91A7-002CC86C7612} = {96CE8CE7-BC97-4A53-899F-5EB63D7BBF7B} + {CC0FD121-5E19-44B6-B23F-0FE3D1B821D3} = {1EF3AC0F-F27C-46DD-AC53-D762D2C11C45} + {237CA273-8555-4944-B87D-5B65AB3A788C} = {CC0FD121-5E19-44B6-B23F-0FE3D1B821D3} + {0CF40BE0-A463-4E4F-A29C-C7427D04DC4F} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} + {B30E0E82-9EA4-49D6-BA0D-BA8E5FA48800} = {0CF40BE0-A463-4E4F-A29C-C7427D04DC4F} + {72704C77-5C90-4705-B2A4-7A6E3B02FF08} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} + {5E319B6A-9F04-4113-ABF9-AB8CD1F7A0B5} = {72704C77-5C90-4705-B2A4-7A6E3B02FF08} + {26906157-98E3-4DF8-80F6-866B9686887C} = {B473B70F-0796-4862-B1AD-BB742D93B868} + {8AE2AAA3-4507-4BEE-9250-4D16F87015B4} = {B473B70F-0796-4862-B1AD-BB742D93B868} + {1CFFC16D-0D4A-47B3-9316-2A04ABD4A7AD} = {96CE8CE7-BC97-4A53-899F-5EB63D7BBF7B} + {6C6A69FE-A484-4E75-AFEC-827EA354AF46} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B} + {D5D3841D-F282-4E60-B9CB-267A1BF2D893} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} + {2A795FEA-2EB7-45F5-9B30-35E0810CB238} = {D5D3841D-F282-4E60-B9CB-267A1BF2D893} EndGlobalSection EndGlobal diff --git a/img/eShopOnContainers_Architecture_Diagram - Old2.png b/img/eShopOnContainers_Architecture_Diagram - Old2.png new file mode 100644 index 000000000..ca9e986b5 Binary files /dev/null and b/img/eShopOnContainers_Architecture_Diagram - Old2.png differ diff --git a/img/eShopOnContainers_Architecture_Diagram.png b/img/eShopOnContainers_Architecture_Diagram.png index ca9e986b5..edf7d8a95 100644 Binary files a/img/eShopOnContainers_Architecture_Diagram.png and b/img/eShopOnContainers_Architecture_Diagram.png differ diff --git a/img/k8s/deploy_script_task.png b/img/k8s/deploy_script_task.png deleted file mode 100644 index 917625f3e..000000000 Binary files a/img/k8s/deploy_script_task.png and /dev/null differ diff --git a/README.CICD.k8s.md b/k8s/README.CICD.k8s.md similarity index 62% rename from README.CICD.k8s.md rename to k8s/README.CICD.k8s.md index 182880fc5..99611043d 100644 --- a/README.CICD.k8s.md +++ b/k8s/README.CICD.k8s.md @@ -5,44 +5,58 @@ For k8s CI/CD pipeline delivery a series of tasks must be created in VSTS to dep * A Kubernetes cluster. Follow Azure Container Service's [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough) to create one. * A private Docker registry. Follow Azure Container Registry's [guide](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal) to create one. * Optionally, previous steps can be skipped if you run gen-k8s-env.ps1 script to automatically create the azure environment needed for kubernetes deployment. Azure cli 2.0 must be previously installed [installation guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). For example: + >``` >./gen-k8s-env -resourceGroupName k8sGroup -location westeurope -registryName k8sregistry -orchestratorName k8s-cluster -dnsName k8s-dns >``` * An `Azure Blob storage`. It is needed for storing the kubernetes config file used by the hosted agent to access to Kubernetes cluster. Example: - + * Upload the `kubernetes config file` to the blob storage previously created. Execute the following command which will download the config file into the directory `c:\Users\\.kube\` and then, upload it to your blob storage: + >``` >https://eshopk8s.blob.core.windows.net/k8s-config/config >``` + ## Create the VSTS tasks 1. Create a `Download File` task to download the kubernetes binary `kubectl` to the hosted agent. For example: + >``` >https://storage.googleapis.com/kubernetes-release/release/v0.0.1.7.0-alpha.0/bin/windows/386/kubectl.exe >``` - + + 2. Create a Download File task to download the kubernetes config file to the hosted agent. For example: + >``` >https://eshopk8s.blob.core.windows.net/k8s-config/config >``` - + 3. Create a powershell task to execute the k8s deployment script. For example: * Deployment script path + >``` >$(System.DefaultWorkingDirectory)/All Microservices/docker-compose/deploy.ps1 >``` -* Deployment script path arguments. Where: - - userDockerHub: indicates if Docker Hub is used instead of ACR - - deployCI: indicates that it is a CI/CD deployment - - execPath: path where the k8s binary is stored - - kubeconfigPath: path where the k8s config file is stored +* Deployment script path arguments. Use value: + >``` ->-deployCI $true -useDockerHub $true -execPath '$(System.DefaultWorkingDirectory)/' -kubeconfigPath '$(System.DefaultWorkingDirectory)/' +>-deployCI $true -execPath '$(System.DefaultWorkingDirectory)/' -kubeconfigPath '$(System.DefaultWorkingDirectory)/' -deployInfrastructure $true -imageTag dev -configFile '$(System.DefaultWorkingDirectory)/$(Build.DefinitionName)/docker-compose/conf_local.yml' >``` - + +- deployCI: Must be set to `$true`. This avoids create images (always are pulled from registry) and compile bits. +- deployInfrastructure: Can be set to `$false` if don't want to deploy infrastructure containers (like Redis, rabbit, SQL,...). +- imageTag: Image tag to pull from k8s. +- configFile: Configuration file (refer to [README.k8s.md](./README.k8s.md) for more info). This file is part of the VSTS build output. +- execPath: path where the k8s binary is stored +- kubeconfigPath: path where the k8s config file is stored + + You can use additional parameters (i.e. pass registry and user/password to use custom registry instead of DockerHub. Plase, refer to [README.k8s.md](./README.k8s.md) for more info. + + diff --git a/k8s/README.k8s.md b/k8s/README.k8s.md new file mode 100644 index 000000000..507bc2c54 --- /dev/null +++ b/k8s/README.k8s.md @@ -0,0 +1,79 @@ +# eShopOnContainers on Kubernetes +The k8s directory contains Kubernetes configuration for the eShopOnContainers app and a PowerShell script to deploy it to a cluster. Each eShopOnContainers microservice has a deployment configuration in `deployments.yaml`, and is exposed to the cluster by a service in `services.yaml`. The microservices are exposed externally on individual routes (`/basket-api`, `/webmvc`, etc.) by an nginx reverse proxy specified in `frontend.yaml` and `nginx.conf`. + +## Prerequisites +* A Kubernetes cluster. Follow Azure Container Service's [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough) to create one. +* A private Docker registry. Follow Azure Container Registry's [guide](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal) to create one. +* Optionally, previous steps can be skipped if you run gen-k8s-env.ps1 script to automatically create the azure environment needed for kubernetes deployment. Azure cli 2.0 must be previously installed [installation guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). For example: + +>``` +>./gen-k8s-env -resourceGroupName k8sGroup -location westeurope -registryName k8sregistry -orchestratorName k8s-cluster -dnsName k8s-dns +>``` + +* A Docker development environment with `docker` and `docker-compose`. + * Visit [docker.com](https://docker.com) to download the tools and set up the environment. Docker's [installation guide](https://docs.docker.com/engine/getstarted/step_one/#step-3-verify-your-installation) covers verifying your Docker installation. +* The Kubernetes command line client, `kubectl`. + * This can be installed with the `az` tool as described in the Azure Container Service [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough). `az` is also helpful for getting the credentials `kubectl` needs to access your cluster. For other installation options, and information about configuring `kubectl` yourself, see the [Kubernetes documentation](https://kubernetes.io/docs/tasks/kubectl/install/). + +## Deploy the application with the deployment script +1. Open a PowerShell command line at the `k8s` directory of your local eShopOnContainers repository. +1. Ensure `docker`, `docker-compose`, and `kubectl` are on the path, and configured for your Docker machine and Kubernetes cluster. +1. Run `deploy.ps1` with your registry information. The Docker username and password are provided by Azure Container Registry, and can be retrieved from the Azure portal. Optionally, ACR credentials can be obtained by running the following command: + +>``` +>az acr credential show -n eshopregistry +>``` + +Once the user and password are retrieved, run the following script for deployment. For example: + +>``` +>./deploy.ps1 -registry myregistry.azurecr.io -dockerUser User -dockerPassword SecretPassword -configFile file_with_config.json +>``` + +The parameter `configFile` is important (and mandatory) because it contains the configuration used for the Pods in Kubernetes. This allow deploying Pods that use your own resources in Azure or any other cloud provider. A configuration file `local.json` is provided which configures Pods to use the infrastructure containers (that is sql server, rabbitmq, redis and mongodb must be deployed also in the k8s). + +The script will build the code and corresponding Docker images, push the later to your registry, and deploy the application to your cluster. You can watch the deployment unfold from the Kubernetes web interface: run `kubectl proxy` and open a browser to [http://localhost:8001/ui](http://localhost:8001/ui) + +### Pods configuration file + +When deploying to k8s the script needs the `configFile` with the location of a JSON configuration file. This file contains the configuration of the pods. The file is a JSON file. For reference another configuration file (cloud.json) is provided but without valid values. + +If you deploy the infrastructure containers use `local.json` as a value for `configFile` parameter. If you don't deploy the infrastructure containers use your own configuration file with the correct values. + +### Parameters of the deploy.ps1 script + +The script accepts following parameters: + ++ `registry`: Name of the Docker registry to use. If not passed DockerHub is assumed ++ `dockerUser`: Login to use for the Docker registry (if needed) ++ `dockerPassword`: Password to use for the Docker registry (if needed) ++ `execPath`: Location of `kubectl` (if not in the path). If passed must finish with the path character. ++ `kubeconfigPath`: Location of the `kubectl` configuration file. **This parameter is used only in the CI pipeline**, so you don't need to pass it when invoking the script using the CLI. ++ `configFile`: Location of the Yaml file with the `externalcfg` configmap to be deployed. This configmap is used to configure the Pod's environment **This parameter is mandatory** ++ `imageTag`: Tag of the images to deploy to k8s. If not passed the name of the current branch is used. ++ `externalDns`: External DNS name of the k8s. This is only needed if you have configured a DNS that points to your k8s external IP. If you don't have any DNS configured do not pass this parameter. ++ `deployCI`: If `true` means that script is running under the context of a VSTS Hosted Build Agent. **You should never use this parameter from CLI** ++ `buildBits`: means that the source code of eShopOnContainers will be built. If you have built your code (and have all projects published in `obj/Docker/publish`) do not pass this parameter. Default value is `false` ++ `buildImages`: If `true` (default value) Docker images are built and pushed in the Docker registry. If you set this parameter to `false`, Docker images won't be built nor pushed in the Docker registry (but k8s' deployments and services will be redeployed). ++ `deployInfrastructure`: If `true` infrastructure containers (rabbitmq, mongo, redis, sql) will be deployed in k8s. If `false` those containers (and its related deployments and services in k8s) won't be deployed. ++ `dockerOrg`: Name of the organization in the registry where the images are (or will be pushed). Default value is `eshop` (which has images provided by Microsoft) + +### Typical usages of the script: + +Build all projects, and deploy all them in k8s including infrastructure containers in a organization called `foo` in Docker Hub. Images will be tagged with my current git branch and containers will use the configuration set in `conf_local.yml` file: + +``` +./deploy.ps1 -buildBits $true -dockerOrg foo -dockerUser MY_USER -dockerPassword MY_PASSWORD -configFile conf_local.yml +``` + +Do not build any project and don't rebuild docker images. Create k8s deployments that will pull images from my private repository, in the `foo` organization, using the tag `latest`. Containers will use the configuration set in `conf_cloud` file. + +``` +./deploy.ps1 -buildImages $false -dockerOrg foo -registry MY_REGISTRY_FQDN -dockerUser MY_USER -dockerPassword MY_PASSWORD -configFile conf_cloud.yml -imageTag master +``` + +Deploy k8s using public images that Microsoft provides: + +``` +./deploy.ps1 -buildImages $false -configFile conf_local.yml -imageTag master +``` \ No newline at end of file diff --git a/k8s/conf-files.md b/k8s/conf-files.md new file mode 100644 index 000000000..3a74a86bd --- /dev/null +++ b/k8s/conf-files.md @@ -0,0 +1,17 @@ +# YAML files used to deploy to k8s + +This is just a brief enumeration of the configuration files used to create the k8s objects. Use as reference to find where specific object is. + +- `deployments.yaml` Contains the definition of all deployments of the eShopOnContainers. Do not contain any infrastructure deployment (so no SQL, Redis, ...). +- `services.yaml` Contains the definition of all services of the eShopOnContainers. Do not contain any infrastructure service (so no SQL, Redis, ...). +- `basket-data.yaml` Contains the definition of the Redis (used by basket.api) deployment and service +- `nosql-data.yaml` Contains the definition of the Mongodb (used by locations and marketing) deployment and service +- `sql-data.yaml` Contains the definition of the SQL server deployment and service +- `rabbitmq.yaml` Contains the definition of the RabbitMQ deployment and service +- `keystore-data.yaml` Contains the deployment and service definition of the Redis used to mantain coherence between all the ASP.NET Identity keystores. +- `conf_local.yaml` Contains the configuration map that configures all the Pods to use "local" containers (that is all containers in k8s) +- `conf_cloud.yaml` Contains the configuration map that configures all the Pods to use "cloud" resources (that is use Azure resources instead infrastructure containers). This file is provided with no valid values, just for example. +- `frontend.yaml` Contains the deployment and service definition of the NGINX frontend used as reverse-proxy + +- For more information what kubernetes deployments are, read [Kubernetes help](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) +- For more information what kubernetes services are, read [Kubernetes help](https://kubernetes.io/docs/concepts/services-networking/service/) diff --git a/k8s/conf_cloud.yml b/k8s/conf_cloud.yml new file mode 100644 index 000000000..ac8fd56fc --- /dev/null +++ b/k8s/conf_cloud.yml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: externalcfg + labels: + app: eshop +data: +# Basket.API entries + BasketBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) + BasketRedisConStr: REDIS CONNECTION STRING FOR BASKET +# Catalog.API entries + CatalogBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) + CatalogSqlDb: Catalog SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) +# Identity.API entries + IdentitySqlDb: Identity SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) +# Locations.API entries + LocationsBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) + LocationsNoSqlDb: Locations MongoDb ConnectionString + LocationsNoSqlDbName: Locations MongoDb database (LocationsDb) +# Marketing.API entries + MarketingBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) + MarketingNoSqlDb: Marketing MongoDb ConnectionString + MarketingNoSqlDbName: Marketing MongoDb database (MarketingDb) + MarketingSqlDb: Marketing SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) +# Ordering.API entries + OrderingBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) + OrderingSqlDb: Ordering SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) +# Payment.API entries + PaymentBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) +# GracePeriodManager entries + GracePeriodTime: "5" # Grace period duration (time when you can cancel order) in minutes + GracePeriodCheckUpdateTime: "60000" # Interval time to check new Order status (in milliseconds) + GracePeriodManagerBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) +# Global entries + UseAzureServiceBus: "TRUE" IF USE AZURE SB ("FALSE" FOR USING RABBITMQ) + keystore: REDIS CONNECTION STRING FOR KEYSTORE \ No newline at end of file diff --git a/k8s/conf_local.yml b/k8s/conf_local.yml new file mode 100644 index 000000000..1ac16bb28 --- /dev/null +++ b/k8s/conf_local.yml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: externalcfg + labels: + app: eshop +data: + BasketBus: rabbitmq + BasketRedisConStr: basket-data + CatalogBus: rabbitmq + CatalogSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word; + CatalogAzureStorageEnabled: "False" + IdentitySqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word; + LocationsBus: rabbitmq + LocationsNoSqlDb: mongodb://nosql-data + LocationsNoSqlDbName: LocationsDb + MarketingBus: rabbitmq + MarketingNoSqlDb: mongodb://nosql-data + MarketingNoSqlDbName: MarketingDb + MarketingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word; + OrderingBus: rabbitmq + OrderingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word; + PaymentBus: rabbitmq + GracePeriodTime: "1" + GracePeriodCheckUpdateTime: "60000" + GracePeriodManagerBus: rabbitmq + UseAzureServiceBus: "False" + keystore: keystore-data diff --git a/k8s/deploy.ps1 b/k8s/deploy.ps1 index 5b6c5732f..be9424b4f 100644 --- a/k8s/deploy.ps1 +++ b/k8s/deploy.ps1 @@ -8,8 +8,10 @@ Param( [parameter(Mandatory=$false)][string]$imageTag, [parameter(Mandatory=$false)][string]$externalDns, [parameter(Mandatory=$false)][bool]$deployCI=$false, - [parameter(Mandatory=$false)][bool]$buildImages=$false, - [parameter(Mandatory=$false)][bool]$deployInfrastructure=$true + [parameter(Mandatory=$false)][bool]$buildImages=$true, + [parameter(Mandatory=$false)][bool]$buildBits=$false, + [parameter(Mandatory=$false)][bool]$deployInfrastructure=$true, + [parameter(Mandatory=$false)][string]$dockerOrg="eshop" ) function ExecKube($cmd) { @@ -39,6 +41,7 @@ if(-not $deployCI) { } } else { + $buildBits = false; $buildImages = false; # Never build images through CI, as they previously built } @@ -48,40 +51,39 @@ if ([string]::IsNullOrEmpty($imageTag)) { } Write-Host "Docker image Tag: $imageTag" -ForegroundColor Yellow -# Read config to use -$config = Get-Content -Raw -Path $configFile | ConvertFrom-Json -if ($debugMode) { - Write-Host "[DEBUG]: Using following JSON config: " -ForegroundColor Yellow - $json = ConvertTo-Json $config -Depth 5 - Write-Host $json - if (-not $deployCI) { - Write-Host "[DEBUG]: Press a key " -ForegroundColor Yellow - [System.Console]::Read() - } -} - # building and publishing docker images if needed -if($buildImages) { +if($buildBits) { Write-Host "Building and publishing eShopOnContainers..." -ForegroundColor Yellow dotnet restore ../eShopOnContainers-ServicesAndWebApps.sln dotnet publish -c Release -o obj/Docker/publish ../eShopOnContainers-ServicesAndWebApps.sln - +} +if ($buildImages) { Write-Host "Building Docker images tagged with '$imageTag'" -ForegroundColor Yellow $env:TAG=$imageTag docker-compose -p .. -f ../docker-compose.yml build - Write-Host "Pushing images to $registry..." -ForegroundColor Yellow - $services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus") + Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow + $services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "graceperiodmanager") + foreach ($service in $services) { - docker tag eshop/${service}:$imageTag $registry/eshop/${service}:$imageTag - docker push $registry/eshop/${service}:$imageTag + $imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"} + docker tag eshop/${service}:$imageTag ${imageFqdn}:$imageTag + docker push ${imageFqdn}:$imageTag } } -# Use ACR instead of DockerHub as image repository -if(-not $useDockerHub) { - Write-Host "Logging in to $registry" -ForegroundColor Yellow - docker login -u $dockerUser -p $dockerPassword $registry +# if we have login/pwd add the secret to k8s +if (-not [string]::IsNullOrEmpty($dockerUser)) { + $registryFDQN = if (-not $useDockerHub) {$registry} else {"index.docker.io/v1/"} + + Write-Host "Logging in to $registryFDQN as user $dockerUser" -ForegroundColor Yellow + if ($useDockerHub) { + docker login -u $dockerUser -p $dockerPassword + } + else { + docker login -u $dockerUser -p $dockerPassword $registryFDQN + } + if (-not $LastExitCode -eq 0) { Write-Host "Login failed" -ForegroundColor Red exit @@ -89,7 +91,7 @@ if(-not $useDockerHub) { # create registry key secret ExecKube -cmd 'create secret docker-registry registry-key ` - --docker-server=$registry ` + --docker-server=$registryFDQN ` --docker-username=$dockerUser ` --docker-password=$dockerPassword ` --docker-email=not@used.com' @@ -132,68 +134,62 @@ Write-Host "Using $externalDns as the external DNS/IP of the k8s cluster" ExecKube -cmd 'create configmap urls ` --from-literal=BasketUrl=http://basket ` --from-literal=BasketHealthCheckUrl=http://basket/hc ` - --from-literal=CatalogUrl=http://$($frontendUrl)/catalog-api ` + --from-literal=CatalogUrl=http://$($externalDns)/catalog-api ` --from-literal=CatalogHealthCheckUrl=http://catalog/hc ` - --from-literal=IdentityUrl=http://$($frontendUrl)/identity ` + --from-literal=PicBaseUrl=http://$($externalDns)/catalog-api/api/v1/catalog/items/[0]/pic/ ` + --from-literal=Marketing_PicBaseUrl=http://$($externalDns)/marketing-api/api/v1/campaigns/[0]/pic/ ` + --from-literal=IdentityUrl=http://$($externalDns)/identity ` --from-literal=IdentityHealthCheckUrl=http://identity/hc ` --from-literal=OrderingUrl=http://ordering ` --from-literal=OrderingHealthCheckUrl=http://ordering/hc ` - --from-literal=MvcClientExternalUrl=http://$($frontendUrl)/webmvc ` + --from-literal=MvcClientExternalUrl=http://$($externalDns)/webmvc ` --from-literal=WebMvcHealthCheckUrl=http://webmvc/hc ` --from-literal=MvcClientOrderingUrl=http://ordering ` --from-literal=MvcClientCatalogUrl=http://catalog ` --from-literal=MvcClientBasketUrl=http://basket ` + --from-literal=MvcClientMarketingUrl=http://marketing ` + --from-literal=MarketingHealthCheckUrl=http://marketing/hc ` --from-literal=WebSpaHealthCheckUrl=http://webspa/hc ` + --from-literal=SpaClientMarketingExternalUrl=http://$($externalDns)/marketing-api ` --from-literal=SpaClientOrderingExternalUrl=http://$($externalDns)/ordering-api ` --from-literal=SpaClientCatalogExternalUrl=http://$($externalDns)/catalog-api ` --from-literal=SpaClientBasketExternalUrl=http://$($externalDns)/basket-api ` --from-literal=SpaClientIdentityExternalUrl=http://$($externalDns)/identity ` - --from-literal=SpaClientExternalUrl=http://$($externalDns)' - + --from-literal=LocationsHealthCheckUrl=http://locations/hc ` + --from-literal=SpaClientExternalUrl=http://$($externalDns) ` + --from-literal=LocationApiClient=http://$($externalDns)/locations-api ` + --from-literal=MarketingApiClient=http://$($externalDns)/marketing-api ` + --from-literal=BasketApiClient=http://$($externalDns)/basket-api ` + --from-literal=OrderingApiClient=http://$($externalDns)/ordering-api' + ExecKube -cmd 'label configmap urls app=eshop' -Write-Host "Applying external configuration from json" -ForegroundColor Yellow +Write-Host "Deploying configuration from $configFile" -ForegroundColor Yellow -ExecKube -cmd 'create configmap externalcfg ` - --from-literal=CatalogSqlDb=$($config.sql.catalog) ` - --from-literal=IdentitySqlDb=$($config.sql.identity) ` - --from-literal=OrderingSqlDb=$($config.sql.ordering) ` - --from-literal=MarketingSqlDb=$($config.sql.marketing) ` - --from-literal=LocationsNoSqlDb=$($config.nosql.locations.constr) ` - --from-literal=LocationsNoSqlDbName=$($config.nosql.locations.db) ` - --from-literal=MarketingNoSqlDb=$($config.nosql.marketing.constr) ` - --from-literal=MarketingNoSqlDbName=$($config.nosql.marketing.db) ` - --from-literal=BasketRedisConStr=$($config.redis.basket) ` - --from-literal=LocationsBus=$($config.servicebus.locations) ` - --from-literal=MarketingBus=$($config.servicebus.marketing) ` - --from-literal=BasketBus=$($config.servicebus.basket) ` - --from-literal=OrderingBus=$($config.servicebus.ordering) ` - --from-literal=CatalogBus=$($config.servicebus.catalog) ` - --from-literal=PaymentBus=$($config.servicebus.payment) ` - --from-literal=UseAzureServiceBus=$($config.servicebus.use_azure) ` - --from-literal=keystore=$($config.redis.keystore) ' -ExecKube -cmd 'label configmap externalcfg app=eshop' +ExecKube -cmd "create -f $configFile" Write-Host "Creating deployments..." -ForegroundColor Yellow ExecKube -cmd 'create -f deployments.yaml' # update deployments with the correct image (with tag and/or registry) -Write-Host "Update Image containers to use prefix '$registry' and tag '$imageTag'" -ForegroundColor Yellow $registryPath = "" if (-not [string]::IsNullOrEmpty($registry)) { $registryPath = "$registry/" } -ExecKube -cmd 'set image deployments/basket basket=${registryPath}eshop/basket.api:$imageTag' -ExecKube -cmd 'set image deployments/catalog catalog=${registryPath}eshop/catalog.api:$imageTag' -ExecKube -cmd 'set image deployments/identity identity=${registryPath}eshop/identity.api:$imageTag' -ExecKube -cmd 'set image deployments/ordering ordering=${registryPath}eshop/ordering.api:$imageTag' -ExecKube -cmd 'set image deployments/marketing marketing=${registryPath}eshop/marketing.api:$imageTag' -ExecKube -cmd 'set image deployments/locations locations=${registryPath}eshop/locations.api:$imageTag' -ExecKube -cmd 'set image deployments/payment payment=${registryPath}eshop/payment.api:$imageTag' -ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}eshop/webmvc:$imageTag' -ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}eshop/webstatus:$imageTag' -ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}eshop/webspa:$imageTag' +Write-Host "Update Image containers to use prefix '$registry$dockerOrg' and tag '$imageTag'" -ForegroundColor Yellow + +ExecKube -cmd 'set image deployments/basket basket=${registryPath}${dockerOrg}/basket.api:$imageTag' +ExecKube -cmd 'set image deployments/catalog catalog=${registryPath}${dockerOrg}/catalog.api:$imageTag' +ExecKube -cmd 'set image deployments/identity identity=${registryPath}${dockerOrg}/identity.api:$imageTag' +ExecKube -cmd 'set image deployments/ordering ordering=${registryPath}${dockerOrg}/ordering.api:$imageTag' +ExecKube -cmd 'set image deployments/marketing marketing=${registryPath}${dockerOrg}/marketing.api:$imageTag' +ExecKube -cmd 'set image deployments/locations locations=${registryPath}${dockerOrg}/locations.api:$imageTag' +ExecKube -cmd 'set image deployments/payment payment=${registryPath}${dockerOrg}/payment.api:$imageTag' +ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag' +ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag' +ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag' +ExecKube -cmd 'set image deployments/graceperiodmanager graceperiodmanager=${registryPath}${dockerOrg}/graceperiodmanager:$imageTag' Write-Host "Execute rollout..." -ForegroundColor Yellow ExecKube -cmd 'rollout resume deployments/basket' @@ -206,6 +202,7 @@ ExecKube -cmd 'rollout resume deployments/payment' ExecKube -cmd 'rollout resume deployments/webmvc' ExecKube -cmd 'rollout resume deployments/webstatus' ExecKube -cmd 'rollout resume deployments/webspa' +ExecKube -cmd 'rollout resume deployments/graceperiodmanager' -Write-Host "WebSPA is exposed at http://$frontendUrl, WebMVC at http://$frontendUrl/webmvc, WebStatus at http://$frontendUrl/webstatus" -ForegroundColor Yellow +Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow diff --git a/k8s/deployments.yaml b/k8s/deployments.yaml index 0a42f573d..9006c3642 100644 --- a/k8s/deployments.yaml +++ b/k8s/deployments.yaml @@ -66,11 +66,16 @@ spec: configMapKeyRef: name: externalcfg key: CatalogSqlDb - - name: ExternalCatalogBaseUrl + - name: PicBaseUrl valueFrom: configMapKeyRef: name: urls - key: CatalogUrl + key: PicBaseUrl + - name: AzureStorageEnabled + valueFrom: + configMapKeyRef: + name: externalcfg + key: CatalogAzureStorageEnabled - name: EventBusConnection valueFrom: configMapKeyRef: @@ -122,6 +127,26 @@ spec: configMapKeyRef: name: urls key: SpaClientExternalUrl + - name: LocationApiClient + valueFrom: + configMapKeyRef: + name: urls + key: LocationApiClient + - name: MarketingApiClient + valueFrom: + configMapKeyRef: + name: urls + key: MarketingApiClient + - name: BasketApiClient + valueFrom: + configMapKeyRef: + name: urls + key: BasketApiClient + - name: OrderingApiClient + valueFrom: + configMapKeyRef: + name: urls + key: OrderingApiClient ports: - containerPort: 80 imagePullSecrets: @@ -173,6 +198,53 @@ spec: --- apiVersion: extensions/v1beta1 kind: Deployment +metadata: + name: graceperiodmanager +spec: + paused: true + template: + metadata: + labels: + app: eshop + component: graceperiodmanager + spec: + containers: + - name: graceperiodmanager + image: eshop/graceperiodmanager + imagePullPolicy: Always + env: + - name: ConnectionString + valueFrom: + configMapKeyRef: + name: externalcfg + key: OrderingSqlDb + - name: EventBusConnection + valueFrom: + configMapKeyRef: + name: externalcfg + key: GracePeriodManagerBus + - name: GracePeriodTime + valueFrom: + configMapKeyRef: + name: externalcfg + key: GracePeriodTime + - name: CheckUpdateTime + valueFrom: + configMapKeyRef: + name: externalcfg + key: GracePeriodCheckUpdateTime + - name: AzureServiceBusEnabled + valueFrom: + configMapKeyRef: + name: externalcfg + key: UseAzureServiceBus + ports: + - containerPort: 80 + imagePullSecrets: + - name: registry-key +--- +apiVersion: extensions/v1beta1 +kind: Deployment metadata: name: locations spec: @@ -215,6 +287,11 @@ spec: configMapKeyRef: name: urls key: IdentityUrl + - name: IdentityUrlExternal + valueFrom: + configMapKeyRef: + name: urls + key: IdentityUrl ports: - containerPort: 80 imagePullSecrets: @@ -269,6 +346,16 @@ spec: configMapKeyRef: name: urls key: IdentityUrl + - name: IdentityUrlExternal + valueFrom: + configMapKeyRef: + name: urls + key: IdentityUrl + - name: PicBaseUrl + valueFrom: + configMapKeyRef: + name: urls + key: Marketing_PicBaseUrl ports: - containerPort: 80 imagePullSecrets: @@ -359,6 +446,11 @@ spec: configMapKeyRef: name: urls key: MvcClientOrderingUrl + - name: MarketingUrl + valueFrom: + configMapKeyRef: + name: urls + key: MvcClientMarketingUrl ports: - containerPort: 80 imagePullSecrets: @@ -403,6 +495,16 @@ spec: configMapKeyRef: name: urls key: OrderingHealthCheckUrl + - name: LocationsUrl + valueFrom: + configMapKeyRef: + name: urls + key: LocationsHealthCheckUrl + - name: MarketingUrl + valueFrom: + configMapKeyRef: + name: urls + key: MarketingHealthCheckUrl - name: mvc valueFrom: configMapKeyRef: @@ -469,6 +571,11 @@ spec: configMapKeyRef: name: urls key: SpaClientOrderingExternalUrl + - name: MarketingUrl + valueFrom: + configMapKeyRef: + name: urls + key: SpaClientMarketingExternalUrl - name: BasketUrlHC valueFrom: configMapKeyRef: @@ -489,6 +596,11 @@ spec: configMapKeyRef: name: urls key: OrderingHealthCheckUrl + - name: MarketingUrlHC + valueFrom: + configMapKeyRef: + name: urls + key: MarketingHealthCheckUrl ports: - containerPort: 80 imagePullSecrets: diff --git a/img/k8s/blob_creation.png b/k8s/img/blob_creation.png similarity index 100% rename from img/k8s/blob_creation.png rename to k8s/img/blob_creation.png diff --git a/k8s/img/deploy_script_task.png b/k8s/img/deploy_script_task.png new file mode 100644 index 000000000..96e50d3c5 Binary files /dev/null and b/k8s/img/deploy_script_task.png differ diff --git a/img/k8s/get_kubectlbin_task.png b/k8s/img/get_kubectlbin_task.png similarity index 100% rename from img/k8s/get_kubectlbin_task.png rename to k8s/img/get_kubectlbin_task.png diff --git a/img/k8s/get_kubectlconfig_task.png b/k8s/img/get_kubectlconfig_task.png similarity index 100% rename from img/k8s/get_kubectlconfig_task.png rename to k8s/img/get_kubectlconfig_task.png diff --git a/k8s/local.json b/k8s/local.json deleted file mode 100644 index 9f3fef102..000000000 --- a/k8s/local.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "sql": { - "catalog": "Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;", - "identity":"Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word;", - "ordering":"Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", - "marketing":"Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word;" - }, - "nosql": { - "locations": { - "constr": "mongodb://nosql-data", - "db": "LocationsDb" - }, - "marketing": { - "constr": "mongodb://nosql-data", - "db": "MarketingDb" - } - }, - "redis": { - "basket" : "basket-data", - "keystore": "keystore-data" - }, - "servicebus": { - "use_azure": false, - "ordering": "rabbitmq", - "marketing": "rabbitmq", - "locations": "rabbitmq", - "payment": "rabbitmq", - "basket": "rabbitmq", - "catalog": "rabbitmq" - } -} \ No newline at end of file diff --git a/k8s/readme.md b/k8s/readme.md new file mode 100644 index 000000000..680652e35 --- /dev/null +++ b/k8s/readme.md @@ -0,0 +1,12 @@ +# Kubernetes (k8s) deploy information + +This folder contains files needed to **create** a ACS with Kubernetes in Azure and to **deploy** eShopServices in a existing Kubernetes: + +- `gen-k8s-env.ps1` Script to create a ACS with Kubernetes in Azure +- `deploy.ps1` Script to deploy eShopOnContainers in a existing k8s + +Refer to file [README.k8s.md](./README.k8s.md) for detailed information + +Refer to file [README.CICD.k8s.md](./README.CICD.k8s.md) for information about how to set a VSTS build for deploying on k8s + +Refer to file [conf-files.md](./conf-files.md) for a brief descriptio of every YAML file in this folder \ No newline at end of file diff --git a/k8s/services.yaml b/k8s/services.yaml index 02b73448a..d88604e88 100644 --- a/k8s/services.yaml +++ b/k8s/services.yaml @@ -56,6 +56,20 @@ spec: --- apiVersion: v1 kind: Service +metadata: + labels: + app: eshop + component: graceperiodmanager + name: graceperiodmanager +spec: + ports: + - port: 80 + selector: + app: eshop + component: graceperiodmanager +--- +apiVersion: v1 +kind: Service metadata: labels: app: eshop diff --git a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj index 37aeb8d1f..fe7e35d98 100644 --- a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj +++ b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj @@ -10,6 +10,7 @@ + diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs new file mode 100644 index 000000000..db1b6b390 --- /dev/null +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs @@ -0,0 +1,45 @@ +using Microsoft.Azure.ServiceBus; +using Microsoft.Extensions.Logging; +using System; +using System.IO; + +namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus +{ + public class DefaultServiceBusPersisterConnection :IServiceBusPersisterConnection + { + private readonly ILogger _logger; + private readonly ServiceBusConnectionStringBuilder _serviceBusConnectionStringBuilder; + private ITopicClient _topicClient; + + bool _disposed; + + public DefaultServiceBusPersisterConnection(ServiceBusConnectionStringBuilder serviceBusConnectionStringBuilder, + ILogger logger) + { + _logger = logger ?? throw new ArgumentNullException(nameof(logger)); + + _serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ?? + throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder)); + _topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); + } + + public ServiceBusConnectionStringBuilder ServiceBusConnectionStringBuilder => _serviceBusConnectionStringBuilder; + + public ITopicClient CreateModel() + { + if(_topicClient.IsClosedOrClosing) + { + _topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default); + } + + return _topicClient; + } + + public void Dispose() + { + if (_disposed) return; + + _disposed = true; + } + } +} diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs new file mode 100644 index 000000000..50f588ac3 --- /dev/null +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs @@ -0,0 +1,182 @@ +namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus +{ + using System; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; + using Microsoft.Extensions.Logging; + using Microsoft.Azure.ServiceBus; + using Newtonsoft.Json; + using System.Text; + using System.Threading.Tasks; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; + using System.Reflection; + using Microsoft.Azure.ServiceBus.Filters; + using Autofac; + using Newtonsoft.Json.Linq; + + public class EventBusServiceBus : IEventBus + { + private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection; + private readonly ILogger _logger; + private readonly IEventBusSubscriptionsManager _subsManager; + private readonly SubscriptionClient _subscriptionClient; + private readonly ILifetimeScope _autofac; + private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus"; + private const string INTEGRATION_EVENT_SUFIX = "IntegrationEvent"; + + public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection, + ILogger logger, IEventBusSubscriptionsManager subsManager, string subscriptionClientName, + ILifetimeScope autofac) + { + _serviceBusPersisterConnection = serviceBusPersisterConnection; + _logger = logger; + _subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager(); + + _subscriptionClient = new SubscriptionClient(serviceBusPersisterConnection.ServiceBusConnectionStringBuilder, + subscriptionClientName); + _autofac = autofac; + + RemoveDefaultRule(); + RegisterSubscriptionClientMessageHandler(); + } + + public void Publish(IntegrationEvent @event) + { + var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFIX, ""); + var jsonMessage = JsonConvert.SerializeObject(@event); + var body = Encoding.UTF8.GetBytes(jsonMessage); + + var message = new Message + { + MessageId = new Guid().ToString(), + Body = Encoding.UTF8.GetBytes(jsonMessage), + Label = eventName, + }; + + var topicClient = _serviceBusPersisterConnection.CreateModel(); + + topicClient.SendAsync(message) + .GetAwaiter() + .GetResult(); + } + + public void SubscribeDynamic(string eventName) + where TH : IDynamicIntegrationEventHandler + { + _subsManager.AddDynamicSubscription(eventName); + } + + public void Subscribe() + where T : IntegrationEvent + where TH : IIntegrationEventHandler + { + var eventName = typeof(T).Name.Replace(INTEGRATION_EVENT_SUFIX, ""); + + var containsKey = _subsManager.HasSubscriptionsForEvent(); + if (!containsKey) + { + try + { + _subscriptionClient.AddRuleAsync(new RuleDescription + { + Filter = new CorrelationFilter { Label = eventName }, + Name = eventName + }).GetAwaiter().GetResult(); + } + catch(ServiceBusException) + { + _logger.LogInformation($"The messaging entity {eventName} already exists."); + } + } + + _subsManager.AddSubscription(); + } + + public void Unsubscribe() + where T : IntegrationEvent + where TH : IIntegrationEventHandler + { + var eventName = typeof(T).Name.Replace(INTEGRATION_EVENT_SUFIX, ""); + + try + { + _subscriptionClient + .RemoveRuleAsync(eventName) + .GetAwaiter() + .GetResult(); + } + catch (MessagingEntityNotFoundException) + { + _logger.LogInformation($"The messaging entity {eventName} Could not be found."); + } + + _subsManager.RemoveSubscription(); + } + + public void UnsubscribeDynamic(string eventName) + where TH : IDynamicIntegrationEventHandler + { + _subsManager.RemoveDynamicSubscription(eventName); + } + + public void Dispose() + { + _subsManager.Clear(); + } + + private void RegisterSubscriptionClientMessageHandler() + { + _subscriptionClient.RegisterMessageHandler( + async (message, token) => + { + var eventName = message.Label; + var messageData = Encoding.UTF8.GetString(message.Body); + await ProcessEvent(eventName, messageData); + }, + new MessageHandlerOptions() { MaxConcurrentCalls = 10, AutoComplete = true }); + } + + private async Task ProcessEvent(string eventName, string message) + { + if (_subsManager.HasSubscriptionsForEvent(eventName)) + { + using (var scope = _autofac.BeginLifetimeScope(AUTOFAC_SCOPE_NAME)) + { + var subscriptions = _subsManager.GetHandlersForEvent(eventName); + foreach (var subscription in subscriptions) + { + if (subscription.IsDynamic) + { + var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler; + dynamic eventData = JObject.Parse(message); + await handler.Handle(eventData); + } + else + { + var eventType = _subsManager.GetEventTypeByName(eventName); + var integrationEvent = JsonConvert.DeserializeObject(message, eventType); + var handler = scope.ResolveOptional(subscription.HandlerType); + var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType); + await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent }); + } + } + } + } + } + + private void RemoveDefaultRule() + { + try + { + _subscriptionClient + .RemoveRuleAsync(SubscriptionClient.DefaultRule) + .GetAwaiter() + .GetResult(); + } + catch (MessagingEntityNotFoundException) + { + _logger.LogInformation($"The messaging entity {SubscriptionClient.DefaultRule} Could not be found."); + } + } + } +} diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj new file mode 100644 index 000000000..5be30800e --- /dev/null +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj @@ -0,0 +1,17 @@ + + + + netcoreapp1.1 + Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus + + + + + + + + + + + + \ No newline at end of file diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs new file mode 100644 index 000000000..283031247 --- /dev/null +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs @@ -0,0 +1,12 @@ +namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus +{ + using System; + using Microsoft.Azure.ServiceBus; + + public interface IServiceBusPersisterConnection : IDisposable + { + ServiceBusConnectionStringBuilder ServiceBusConnectionStringBuilder { get; } + + ITopicClient CreateModel(); + } +} \ No newline at end of file diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/AzureHealthCheckBuilderExtensions.cs b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/AzureHealthCheckBuilderExtensions.cs new file mode 100644 index 000000000..4c917f223 --- /dev/null +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/AzureHealthCheckBuilderExtensions.cs @@ -0,0 +1,175 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.WindowsAzure.Storage; +using Microsoft.WindowsAzure.Storage.Auth; + +namespace Microsoft.Extensions.HealthChecks +{ + // REVIEW: Do we want these to continue to use default parameters? + // REVIEW: What are the appropriate guards for these functions? + + public static class AzureHealthCheckBuilderExtensions + { + public static HealthCheckBuilder AddAzureBlobStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string containerName = null, TimeSpan? cacheDuration = null) + { + var credentials = new StorageCredentials(accountName, accountKey); + var storageAccount = new CloudStorageAccount(credentials, true); + return AddAzureBlobStorageCheck(builder, storageAccount, containerName, cacheDuration); + } + + public static HealthCheckBuilder AddAzureBlobStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string containerName = null, TimeSpan? cacheDuration = null) + { + builder.AddCheck($"AzureBlobStorageCheck {storageAccount.BlobStorageUri} {containerName}", async () => + { + bool result; + try + { + var blobClient = storageAccount.CreateCloudBlobClient(); + + var properties = await blobClient.GetServicePropertiesAsync().ConfigureAwait(false); + + if (!String.IsNullOrWhiteSpace(containerName)) + { + var container = blobClient.GetContainerReference(containerName); + + result = await container.ExistsAsync(); + } + + result = true; + } + catch (Exception) + { + result = false; + } + + return result + ? HealthCheckResult.Healthy($"AzureBlobStorage {storageAccount.BlobStorageUri} is available") + : HealthCheckResult.Unhealthy($"AzureBlobStorage {storageAccount.BlobStorageUri} is unavailable"); + }, cacheDuration ?? builder.DefaultCacheDuration); + + return builder; + } + + public static HealthCheckBuilder AddAzureTableStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string tableName = null, TimeSpan? cacheDuration = null) + { + var credentials = new StorageCredentials(accountName, accountKey); + var storageAccount = new CloudStorageAccount(credentials, true); + return AddAzureTableStorageCheck(builder, storageAccount, tableName, cacheDuration); + } + + public static HealthCheckBuilder AddAzureTableStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string tableName = null, TimeSpan? cacheDuration = null) + { + builder.AddCheck($"AzureTableStorageCheck {storageAccount.TableStorageUri} {tableName}", async () => + { + bool result; + try + { + var tableClient = storageAccount.CreateCloudTableClient(); + + var properties = await tableClient.GetServicePropertiesAsync().ConfigureAwait(false); + + if (String.IsNullOrWhiteSpace(tableName)) + { + var table = tableClient.GetTableReference(tableName); + + result = await table.ExistsAsync(); + } + result = true; + } + catch (Exception) + { + result = false; + } + + return result + ? HealthCheckResult.Healthy($"AzureTableStorage {storageAccount.BlobStorageUri} is available") + : HealthCheckResult.Unhealthy($"AzureTableStorage {storageAccount.BlobStorageUri} is unavailable"); + + }, cacheDuration ?? builder.DefaultCacheDuration); + + return builder; + } + + public static HealthCheckBuilder AddAzureFileStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string shareName = null, TimeSpan? cacheDuration = null) + { + var credentials = new StorageCredentials(accountName, accountKey); + var storageAccount = new CloudStorageAccount(credentials, true); + return AddAzureFileStorageCheck(builder, storageAccount, shareName, cacheDuration); + } + + public static HealthCheckBuilder AddAzureFileStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string shareName = null, TimeSpan? cacheDuration = null) + { + builder.AddCheck($"AzureFileStorageCheck {storageAccount.FileStorageUri} {shareName}", async () => + { + bool result; + try + { + var fileClient = storageAccount.CreateCloudFileClient(); + + var properties = await fileClient.GetServicePropertiesAsync().ConfigureAwait(false); + + if (!String.IsNullOrWhiteSpace(shareName)) + { + var share = fileClient.GetShareReference(shareName); + + result = await share.ExistsAsync(); + } + + result = true; + } + catch (Exception) + { + result = false; + } + + return result + ? HealthCheckResult.Healthy($"AzureFileStorage {storageAccount.BlobStorageUri} is available") + : HealthCheckResult.Unhealthy($"AzureFileStorage {storageAccount.BlobStorageUri} is unavailable"); + }, cacheDuration ?? builder.DefaultCacheDuration); + + return builder; + } + + public static HealthCheckBuilder AddAzureQueueStorageCheck(this HealthCheckBuilder builder, string accountName, string accountKey, string queueName = null, TimeSpan? cacheDuration = null) + { + var credentials = new StorageCredentials(accountName, accountKey); + var storageAccount = new CloudStorageAccount(credentials, true); + return AddAzureQueueStorageCheck(builder, storageAccount, queueName, cacheDuration); + } + + public static HealthCheckBuilder AddAzureQueueStorageCheck(HealthCheckBuilder builder, CloudStorageAccount storageAccount, string queueName = null, TimeSpan? cacheDuration = null) + { + builder.AddCheck($"AzureQueueStorageCheck {storageAccount.QueueStorageUri} {queueName}", async () => + { + bool result; + try + { + var queueClient = storageAccount.CreateCloudQueueClient(); + + var properties = await queueClient.GetServicePropertiesAsync().ConfigureAwait(false); + + if (String.IsNullOrWhiteSpace(queueName)) + { + var queue = queueClient.GetQueueReference(queueName); + + result = await queue.ExistsAsync(); + } + result = true; + } + catch (Exception) + { + result = false; + } + + return result + ? HealthCheckResult.Healthy($"AzureFileStorage {storageAccount.BlobStorageUri} is available") + : HealthCheckResult.Unhealthy($"AzureFileStorage {storageAccount.BlobStorageUri} is unavailable"); + + }, cacheDuration ?? builder.DefaultCacheDuration); + + return builder; + } + } +} diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj new file mode 100644 index 000000000..24d5ce92b --- /dev/null +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj @@ -0,0 +1,27 @@ + + + + netstandard1.3 + $(PackageTargetFallback);net46 + false + false + false + + + + + + + + + + + + + + + + + + + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Properties/AssemblyInfo.cs b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ef88235f5 --- /dev/null +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HealthChecks.Azure")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0c4158b7-7153-4d2e-abfa-4ce07d44f75f")] diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs b/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs index 0798f85e3..d32660005 100644 --- a/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs +++ b/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs @@ -81,6 +81,14 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http var response = await _client.SendAsync(requestMessage); + // raise exception if HttpResponseCode 500 + // needed for circuit breaker to track fails + + if (response.StatusCode == HttpStatusCode.InternalServerError) + { + throw new HttpRequestException(); + } + return await response.Content.ReadAsStringAsync(); }); } diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs b/src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs index 3d5217064..423fc42bb 100644 --- a/src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs +++ b/src/BuildingBlocks/Resilience/Resilience.Http/StandardHttpClient.cs @@ -43,7 +43,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http // a new StringContent must be created for each retry // as it is disposed after each call - var requestMessage = new HttpRequestMessage(HttpMethod.Post, uri); + var requestMessage = new HttpRequestMessage(method, uri); requestMessage.Content = new StringContent(JsonConvert.SerializeObject(item), System.Text.Encoding.UTF8, "application/json"); diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml index 150b01c90..9aabf918c 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml @@ -110,6 +110,8 @@ + + - - + + - + - + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + Style="{StaticResource CampaignAvailabilityBannerStyle}" + Grid.Row="2"> @@ -120,6 +146,18 @@ Text="{Binding Campaign.To, StringFormat='until {0:MMMM dd, yyyy}'}" Style="{StaticResource CampaignAvailabilityDescriptionStyle}"/> + + + + + + Title="Campaigns"> diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml index 67adbef4a..14834ca5b 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml @@ -60,6 +60,8 @@ TargetType="{x:Type Button}"> + @@ -114,10 +116,9 @@ Grid.Row="0" IsVisible="{Binding IsSubmittedOrder}"> + + @@ -288,11 +290,6 @@ Designer - - - ..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.6\Profile\Profile44\System.ComponentModel.Annotations.dll - - MSBuild:UpdateDesignTimeXaml diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json index dcca8ed8f..5038874fa 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json @@ -10,6 +10,7 @@ "Newtonsoft.Json": "9.0.1", "SlideOverKit": "2.1.4", "Splat": "1.6.2", + "System.ComponentModel.Annotations": "4.3.0", "Xam.Plugin.Geolocator": "3.0.4", "Xam.Plugins.Settings": "2.6.0.12-beta", "Xamarin.FFImageLoading": "2.2.9", diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs new file mode 100644 index 000000000..770fedc82 --- /dev/null +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs @@ -0,0 +1,63 @@ +using System; + +using Android.App; +using Android.OS; +using Android.Runtime; +using Plugin.CurrentActivity; + +namespace eShopOnContainers.TestRunner.Droid +{ + //You can specify additional application information in this attribute + [Application] + public class MainApplication : Application, Application.IActivityLifecycleCallbacks + { + public MainApplication(IntPtr handle, JniHandleOwnership transer) + :base(handle, transer) + { + } + + public override void OnCreate() + { + base.OnCreate(); + RegisterActivityLifecycleCallbacks(this); + //A great place to initialize Xamarin.Insights and Dependency Services! + } + + public override void OnTerminate() + { + base.OnTerminate(); + UnregisterActivityLifecycleCallbacks(this); + } + + public void OnActivityCreated(Activity activity, Bundle savedInstanceState) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivityDestroyed(Activity activity) + { + } + + public void OnActivityPaused(Activity activity) + { + } + + public void OnActivityResumed(Activity activity) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivitySaveInstanceState(Activity activity, Bundle outState) + { + } + + public void OnActivityStarted(Activity activity) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivityStopped(Activity activity) + { + } + } +} \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs index b33abfa07..12d1b3f5c 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs @@ -1,15 +1,15 @@ #pragma warning disable 1591 -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ -[assembly: Android.Runtime.ResourceDesignerAttribute("eShopOnContainers.TestRunner.Droid.Resource", IsApplication=true)] +[assembly: global::Android.Runtime.ResourceDesignerAttribute("eShopOnContainers.TestRunner.Droid.Resource", IsApplication=true)] namespace eShopOnContainers.TestRunner.Droid { @@ -26,7 +26,6 @@ namespace eShopOnContainers.TestRunner.Droid public static void UpdateIdValues() { - global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.actionBarSize; global::AndroidHUD.Resource.Attribute.ahBarColor = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.ahBarColor; global::AndroidHUD.Resource.Attribute.ahBarLength = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.ahBarLength; global::AndroidHUD.Resource.Attribute.ahBarWidth = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.ahBarWidth; @@ -64,8 +63,9 @@ namespace eShopOnContainers.TestRunner.Droid global::AndroidHUD.Resource.Styleable.ProgressWheel_ahText = global::eShopOnContainers.TestRunner.Droid.Resource.Styleable.ProgressWheel_ahText; global::AndroidHUD.Resource.Styleable.ProgressWheel_ahTextColor = global::eShopOnContainers.TestRunner.Droid.Resource.Styleable.ProgressWheel_ahTextColor; global::AndroidHUD.Resource.Styleable.ProgressWheel_ahTextSize = global::eShopOnContainers.TestRunner.Droid.Resource.Styleable.ProgressWheel_ahTextSize; - global::Splat.Resource.String.library_name = global::eShopOnContainers.TestRunner.Droid.Resource.String.library_name; global::ModernHttpClient.Resource.String.library_name = global::eShopOnContainers.TestRunner.Droid.Resource.String.library_name; + global::Splat.Resource.String.library_name = global::eShopOnContainers.TestRunner.Droid.Resource.String.library_name; + global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.actionBarSize; } public partial class Animation @@ -4295,8 +4295,7 @@ namespace eShopOnContainers.TestRunner.Droid public partial class Styleable { - public static int[] ActionBar = new int[] - { + public static int[] ActionBar = new int[] { 2130772007, 2130772009, 2130772010, @@ -4406,15 +4405,13 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 5 public const int ActionBar_titleTextStyle = 5; - public static int[] ActionBarLayout = new int[] - { + public static int[] ActionBarLayout = new int[] { 16842931}; // aapt resource value: 0 public const int ActionBarLayout_android_layout_gravity = 0; - public static int[] ActionMenuItemView = new int[] - { + public static int[] ActionMenuItemView = new int[] { 16843071}; // aapt resource value: 0 @@ -4422,8 +4419,7 @@ namespace eShopOnContainers.TestRunner.Droid public static int[] ActionMenuView; - public static int[] ActionMode = new int[] - { + public static int[] ActionMode = new int[] { 2130772007, 2130772013, 2130772014, @@ -4449,8 +4445,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int ActionMode_titleTextStyle = 1; - public static int[] ActivityChooserView = new int[] - { + public static int[] ActivityChooserView = new int[] { 2130772035, 2130772036}; @@ -4460,8 +4455,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 0 public const int ActivityChooserView_initialActivityCount = 0; - public static int[] AlertDialog = new int[] - { + public static int[] AlertDialog = new int[] { 16842994, 2130772037, 2130772038, @@ -4487,8 +4481,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int AlertDialog_singleChoiceItemLayout = 4; - public static int[] AppBarLayout = new int[] - { + public static int[] AppBarLayout = new int[] { 16842964, 2130772032, 2130772215}; @@ -4502,8 +4495,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int AppBarLayout_expanded = 2; - public static int[] AppBarLayout_LayoutParams = new int[] - { + public static int[] AppBarLayout_LayoutParams = new int[] { 2130772216, 2130772217}; @@ -4513,8 +4505,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int AppBarLayout_LayoutParams_layout_scrollInterpolator = 1; - public static int[] AppCompatImageView = new int[] - { + public static int[] AppCompatImageView = new int[] { 16843033, 2130772042}; @@ -4524,8 +4515,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int AppCompatImageView_srcCompat = 1; - public static int[] AppCompatTextView = new int[] - { + public static int[] AppCompatTextView = new int[] { 16842804, 2130772043}; @@ -4535,8 +4525,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int AppCompatTextView_textAllCaps = 1; - public static int[] AppCompatTheme = new int[] - { + public static int[] AppCompatTheme = new int[] { 16842839, 16842926, 2130772044, @@ -4986,8 +4975,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 3 public const int AppCompatTheme_windowNoTitle = 3; - public static int[] BottomSheetBehavior_Params = new int[] - { + public static int[] BottomSheetBehavior_Params = new int[] { 2130772218, 2130772219}; @@ -4997,15 +4985,13 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 0 public const int BottomSheetBehavior_Params_behavior_peekHeight = 0; - public static int[] ButtonBarLayout = new int[] - { + public static int[] ButtonBarLayout = new int[] { 2130772154}; // aapt resource value: 0 public const int ButtonBarLayout_allowStacking = 0; - public static int[] CardView = new int[] - { + public static int[] CardView = new int[] { 16843071, 16843072, 2130771995, @@ -5059,8 +5045,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 11 public const int CardView_contentPaddingTop = 11; - public static int[] CollapsingAppBarLayout_LayoutParams = new int[] - { + public static int[] CollapsingAppBarLayout_LayoutParams = new int[] { 2130772220, 2130772221}; @@ -5070,8 +5055,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int CollapsingAppBarLayout_LayoutParams_layout_collapseParallaxMultiplier = 1; - public static int[] CollapsingToolbarLayout = new int[] - { + public static int[] CollapsingToolbarLayout = new int[] { 2130772009, 2130772222, 2130772223, @@ -5129,8 +5113,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 10 public const int CollapsingToolbarLayout_toolbarId = 10; - public static int[] CompoundButton = new int[] - { + public static int[] CompoundButton = new int[] { 16843015, 2130772155, 2130772156}; @@ -5144,8 +5127,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int CompoundButton_buttonTintMode = 2; - public static int[] CoordinatorLayout = new int[] - { + public static int[] CoordinatorLayout = new int[] { 2130772235, 2130772236}; @@ -5155,8 +5137,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int CoordinatorLayout_statusBarBackground = 1; - public static int[] CoordinatorLayout_LayoutParams = new int[] - { + public static int[] CoordinatorLayout_LayoutParams = new int[] { 16842931, 2130772237, 2130772238, @@ -5178,8 +5159,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 3 public const int CoordinatorLayout_LayoutParams_layout_keyline = 3; - public static int[] DesignTheme = new int[] - { + public static int[] DesignTheme = new int[] { 2130772241, 2130772242, 2130772243}; @@ -5193,8 +5173,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int DesignTheme_textColorError = 2; - public static int[] DrawerArrowToggle = new int[] - { + public static int[] DrawerArrowToggle = new int[] { 2130772157, 2130772158, 2130772159, @@ -5228,8 +5207,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int DrawerArrowToggle_thickness = 7; - public static int[] FloatingActionButton = new int[] - { + public static int[] FloatingActionButton = new int[] { 2130772032, 2130772213, 2130772214, @@ -5263,8 +5241,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int FloatingActionButton_useCompatPadding = 7; - public static int[] ForegroundLinearLayout = new int[] - { + public static int[] ForegroundLinearLayout = new int[] { 16843017, 16843264, 2130772249}; @@ -5278,8 +5255,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int ForegroundLinearLayout_foregroundInsidePadding = 2; - public static int[] LinearLayoutCompat = new int[] - { + public static int[] LinearLayoutCompat = new int[] { 16842927, 16842948, 16843046, @@ -5317,8 +5293,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int LinearLayoutCompat_showDividers = 7; - public static int[] LinearLayoutCompat_Layout = new int[] - { + public static int[] LinearLayoutCompat_Layout = new int[] { 16842931, 16842996, 16842997, @@ -5336,8 +5311,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int LinearLayoutCompat_Layout_android_layout_width = 1; - public static int[] ListPopupWindow = new int[] - { + public static int[] ListPopupWindow = new int[] { 16843436, 16843437}; @@ -5347,8 +5321,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int ListPopupWindow_android_dropDownVerticalOffset = 1; - public static int[] MediaRouteButton = new int[] - { + public static int[] MediaRouteButton = new int[] { 16843071, 16843072, 2130771994}; @@ -5362,8 +5335,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int MediaRouteButton_externalRouteEnabledDrawable = 2; - public static int[] MenuGroup = new int[] - { + public static int[] MenuGroup = new int[] { 16842766, 16842960, 16843156, @@ -5389,8 +5361,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int MenuGroup_android_visible = 2; - public static int[] MenuItem = new int[] - { + public static int[] MenuItem = new int[] { 16842754, 16842766, 16842960, @@ -5460,8 +5431,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 13 public const int MenuItem_showAsAction = 13; - public static int[] MenuView = new int[] - { + public static int[] MenuView = new int[] { 16842926, 16843052, 16843053, @@ -5495,8 +5465,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int MenuView_preserveIconSpacing = 7; - public static int[] NavigationView = new int[] - { + public static int[] NavigationView = new int[] { 16842964, 16842973, 16843039, @@ -5538,8 +5507,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int NavigationView_menu = 4; - public static int[] PopupWindow = new int[] - { + public static int[] PopupWindow = new int[] { 16843126, 2130772173}; @@ -5549,15 +5517,13 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int PopupWindow_overlapAnchor = 1; - public static int[] PopupWindowBackgroundState = new int[] - { + public static int[] PopupWindowBackgroundState = new int[] { 2130772174}; // aapt resource value: 0 public const int PopupWindowBackgroundState_state_above_anchor = 0; - public static int[] ProgressWheel = new int[] - { + public static int[] ProgressWheel = new int[] { 2130772284, 2130772285, 2130772286, @@ -5607,8 +5573,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int ProgressWheel_ahTextSize = 2; - public static int[] RecyclerView = new int[] - { + public static int[] RecyclerView = new int[] { 16842948, 2130771968, 2130771969, @@ -5630,22 +5595,19 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int RecyclerView_stackFromEnd = 4; - public static int[] ScrimInsetsFrameLayout = new int[] - { + public static int[] ScrimInsetsFrameLayout = new int[] { 2130772256}; // aapt resource value: 0 public const int ScrimInsetsFrameLayout_insetForeground = 0; - public static int[] ScrollingViewBehavior_Params = new int[] - { + public static int[] ScrollingViewBehavior_Params = new int[] { 2130772257}; // aapt resource value: 0 public const int ScrollingViewBehavior_Params_behavior_overlapTop = 0; - public static int[] SearchView = new int[] - { + public static int[] SearchView = new int[] { 16842970, 16843039, 16843296, @@ -5715,8 +5677,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 12 public const int SearchView_voiceIcon = 12; - public static int[] SnackbarLayout = new int[] - { + public static int[] SnackbarLayout = new int[] { 16843039, 2130772032, 2130772258}; @@ -5730,8 +5691,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int SnackbarLayout_maxActionInlineWidth = 2; - public static int[] Spinner = new int[] - { + public static int[] Spinner = new int[] { 16842930, 16843126, 16843131, @@ -5753,8 +5713,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int Spinner_popupTheme = 4; - public static int[] SwitchCompat = new int[] - { + public static int[] SwitchCompat = new int[] { 16843044, 16843045, 16843074, @@ -5796,8 +5755,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 3 public const int SwitchCompat_track = 3; - public static int[] TabItem = new int[] - { + public static int[] TabItem = new int[] { 16842754, 16842994, 16843087}; @@ -5811,8 +5769,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int TabItem_android_text = 2; - public static int[] TabLayout = new int[] - { + public static int[] TabLayout = new int[] { 2130772259, 2130772260, 2130772261, @@ -5878,8 +5835,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 9 public const int TabLayout_tabTextColor = 9; - public static int[] TextAppearance = new int[] - { + public static int[] TextAppearance = new int[] { 16842901, 16842902, 16842903, @@ -5917,8 +5873,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 8 public const int TextAppearance_textAllCaps = 8; - public static int[] TextInputLayout = new int[] - { + public static int[] TextInputLayout = new int[] { 16842906, 16843088, 2130772275, @@ -5964,8 +5919,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int TextInputLayout_hintTextAppearance = 2; - public static int[] Toolbar = new int[] - { + public static int[] Toolbar = new int[] { 16842927, 16843072, 2130772009, @@ -6067,8 +6021,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 23 public const int Toolbar_titleTextColor = 23; - public static int[] View = new int[] - { + public static int[] View = new int[] { 16842752, 16842970, 2130772210, @@ -6090,8 +6043,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int View_theme = 4; - public static int[] ViewBackgroundHelper = new int[] - { + public static int[] ViewBackgroundHelper = new int[] { 16842964, 2130772213, 2130772214}; @@ -6105,8 +6057,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int ViewBackgroundHelper_backgroundTintMode = 2; - public static int[] ViewStubCompat = new int[] - { + public static int[] ViewStubCompat = new int[] { 16842960, 16842994, 16842995}; diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj index f1867bb67..527ff23f4 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj @@ -51,6 +51,21 @@ + + ..\..\..\..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll + + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.dll + + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.Abstractions.dll + + + ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.dll + + + ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.Abstractions.dll + @@ -194,12 +209,15 @@ + - + + Designer + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config index 8262c106d..c2eacca73 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config @@ -13,6 +13,8 @@ + + @@ -58,6 +60,7 @@ + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj old mode 100755 new mode 100644 index e0b9e0f24..65a346694 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj @@ -22,16 +22,14 @@ 4 false x86_64 - SdkOnly + None True - 10.2 + False False False False False - False - False True Default HttpClientHandler @@ -60,8 +58,8 @@ Entitlements.plist iPhone Developer true - 10.2 - SdkOnly + + None none @@ -214,6 +212,12 @@ ..\..\..\..\packages\Xamarin.Forms.Theme.Light.1.0.0.43-pre1\lib\Xamarin.iOS10\Xamarin.Forms.Theme.Light.dll + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.Abstractions.dll + + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.dll + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/packages.config b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/packages.config old mode 100755 new mode 100644 index a593d9c75..18d4175f8 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/packages.config +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/packages.config @@ -58,6 +58,7 @@ + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/project.json b/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/project.json old mode 100755 new mode 100644 diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/PluginsHelp/GeolocatorReadme.txt b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/PluginsHelp/GeolocatorReadme.txt deleted file mode 100644 index 8a88b0862..000000000 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/PluginsHelp/GeolocatorReadme.txt +++ /dev/null @@ -1,24 +0,0 @@ -Connectivity Readme -Find the most up to date information at: https://github.com/jamesmontemagno/Xamarin.Plugins - -**IMPORTANT** -Android: -You must request ACCESS_COARSE_LOCATION & ACCESS_FINE_LOCATION permission - -iOS: -In iOS 8 you now have to call either RequestWhenInUseAuthorization or RequestAlwaysAuthorization on the location manager. Additionally you need to add either the concisely named NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription to your Info.plist. -See: http://motzcod.es/post/97662738237/scanning-for-ibeacons-in-ios-8 - -Windows Phone: -You must set the ID_CAP_LOCATION permission. - -Getting Started: - -var locator = CrossGeolocator.Current; -locator.DesiredAccuracy = 50; - -var position = await locator.GetPositionAsync (timeoutMilliseconds: 10000); - -Console.WriteLine ("Position Status: {0}", position.Timestamp); -Console.WriteLine ("Position Latitude: {0}", position.Latitude); -Console.WriteLine ("Position Longitude: {0}", position.Longitude); \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj old mode 100755 new mode 100644 index ea52a9426..7faa02a05 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj @@ -25,16 +25,14 @@ 4 false i386, x86_64 - SdkOnly + None True - 10.2 + False False False False False - False - False True Default HttpClientHandler @@ -63,6 +61,7 @@ iPhone Developer true Entitlements.plist + None none @@ -155,12 +154,6 @@ ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Platform.dll - - ..\..\..\..\packages\Xam.Plugin.Geolocator.1.0.3\lib\Xamarin.iOS10\Geolocator.Plugin.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.1.0.3\lib\Xamarin.iOS10\Geolocator.Plugin.Abstractions.dll - ..\..\..\..\packages\IdentityModel.1.3.1\lib\portable-net45+wp80+win8+wpa81\IdentityModel.Portable.dll True @@ -240,6 +233,12 @@ ..\..\..\..\packages\Xamarin.Forms.Pages.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Pages.dll + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.Abstractions.dll + + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.dll + @@ -432,9 +431,6 @@ - - - diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config old mode 100755 new mode 100644 index 5240be164..d13c2c74b --- a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config @@ -58,7 +58,7 @@ - + diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 5287dcc96..a6b95198a 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -19,6 +19,7 @@ + @@ -38,6 +39,7 @@ + diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 1d00f5f00..9219cfad3 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -13,7 +13,7 @@ using Basket.API.Model; namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers { - [Route("/")] + [Route("api/v1/[controller]")] [Authorize] public class BasketController : Controller { diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddlewareAppBuilderExtensions.cs b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs similarity index 93% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddlewareAppBuilderExtensions.cs rename to src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs index 15bf596cc..935bb79a8 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddlewareAppBuilderExtensions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public static class FailingMiddlewareAppBuilderExtensions { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs new file mode 100644 index 000000000..f27a3c209 --- /dev/null +++ b/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Basket.API.Infrastructure.Filters +{ + public class AuthorizeCheckOperationFilter : IOperationFilter + { + public void Apply(Operation operation, OperationFilterContext context) + { + // Check for authorize attribute + var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType().Any() || + context.ApiDescription.ActionAttributes().OfType().Any(); + + if (hasAuthorize) + { + operation.Responses.Add("401", new Response { Description = "Unauthorized" }); + operation.Responses.Add("403", new Response { Description = "Forbidden" }); + + operation.Security = new List>>(); + operation.Security.Add(new Dictionary> + { + { "oauth2", new [] { "basketapi" } } + }); + } + } + } +} \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddleware.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs similarity index 88% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddleware.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs index 2c82547e2..05acd0d2c 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddleware.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public class FailingMiddleware { @@ -26,8 +26,7 @@ namespace Ordering.API.Infrastructure.Middlewares return; } - - if (_mustFail) + if (MustFail(context)) { context.Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; context.Response.ContentType = "text/plain"; @@ -42,7 +41,7 @@ namespace Ordering.API.Infrastructure.Middlewares private async Task ProcessConfigRequest(HttpContext context) { var enable = context.Request.Query.Keys.Any(k => k == "enable"); - var disable = context.Request.Query.Keys.Any(k => k == "disable"); + var disable = context.Request.Query.Keys.Any(k => k == "disable"); if (enable && disable) { @@ -74,5 +73,11 @@ namespace Ordering.API.Infrastructure.Middlewares await context.Response.WriteAsync(message); } + private bool MustFail(HttpContext context) + { + return _mustFail && + (_options.EndpointPaths.Any(x => x == context.Request.Path.Value) + || _options.EndpointPaths.Count == 0); + } } } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingOptions.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs similarity index 60% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingOptions.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs index a93a2b49b..b31207e00 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingOptions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public class FailingOptions { public string ConfigPath = "/Failing"; + public List EndpointPaths { get; set; } = new List(); } } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingStartupFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingStartupFilter.cs similarity index 57% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingStartupFilter.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingStartupFilter.cs index 028239f2d..7d3b2ce18 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingStartupFilter.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingStartupFilter.cs @@ -1,23 +1,22 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public class FailingStartupFilter : IStartupFilter { - public FailingStartupFilter() + private readonly Action _options; + public FailingStartupFilter(Action optionsAction) { + _options = optionsAction; } public Action Configure(Action next) { return app => { - app.UseFailingMiddleware(); + app.UseFailingMiddleware(_options); next(app); }; } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs similarity index 66% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs index 1c4979fae..99be1b182 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs @@ -1,23 +1,18 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; -using Ordering.API.Infrastructure.Middlewares; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Hosting +namespace Basket.API.Infrastructure.Middlewares { public static class WebHostBuildertExtensions { - public static IWebHostBuilder UseFailing(this IWebHostBuilder builder, string path) + public static IWebHostBuilder UseFailing(this IWebHostBuilder builder, Action options) { builder.ConfigureServices(services => { - services.AddSingleton(new FailingStartupFilter()); + services.AddSingleton(new FailingStartupFilter(options)); }); return builder; } - } } diff --git a/src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs b/src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs index 4ca90f383..e896c0773 100644 --- a/src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs +++ b/src/Services/Basket/Basket.API/Model/RedisBasketRepository.cs @@ -4,7 +4,6 @@ using Newtonsoft.Json; using StackExchange.Redis; using System.Collections.Generic; using System.Linq; -using System.Net; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Basket.API.Model @@ -16,12 +15,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model private ConnectionMultiplexer _redis; - public RedisBasketRepository(IOptionsSnapshot options, ILoggerFactory loggerFactory) { _settings = options.Value; _logger = loggerFactory.CreateLogger(); - } public async Task DeleteBasketAsync(string id) @@ -93,21 +90,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model } private async Task ConnectToRedisAsync() - { - // TODO: Need to make this more robust. ConnectionMultiplexer.ConnectAsync doesn't like domain names or IPv6 addresses. - if (IPAddress.TryParse(_settings.ConnectionString, out var ip)) - { - _redis = await ConnectionMultiplexer.ConnectAsync(ip.ToString()); - _logger.LogInformation($"Connecting to database at {_settings.ConnectionString}"); - } - else - { - // workaround for https://github.com/StackExchange/StackExchange.Redis/issues/410 - var ips = await Dns.GetHostAddressesAsync(_settings.ConnectionString); - _logger.LogInformation($"Connecting to database {_settings.ConnectionString} at IP {ips.First().ToString()}"); - _redis = await ConnectionMultiplexer.ConnectAsync(ips.First().ToString()); - } + { + var configuration = ConfigurationOptions.Parse(_settings.ConnectionString, true); + configuration.ResolveDns = true; + + _logger.LogInformation($"Connecting to database {configuration.SslHost}."); + _redis = await ConnectionMultiplexer.ConnectAsync(configuration); } - } } diff --git a/src/Services/Basket/Basket.API/Program.cs b/src/Services/Basket/Basket.API/Program.cs index 74ab84c18..7753ef537 100644 --- a/src/Services/Basket/Basket.API/Program.cs +++ b/src/Services/Basket/Basket.API/Program.cs @@ -1,5 +1,7 @@ -using Microsoft.AspNetCore.Builder; +using Basket.API.Infrastructure.Middlewares; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using System.Collections.Generic; using System.IO; namespace Microsoft.eShopOnContainers.Services.Basket.API @@ -10,6 +12,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API { var host = new WebHostBuilder() .UseKestrel() + .UseFailing(options => + { + options.ConfigPath = "/Failing"; + }) .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 83b259d5b..a473a29fc 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -26,6 +26,11 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; +using Microsoft.Azure.ServiceBus; +using Swashbuckle.AspNetCore.Swagger; +using System.Collections.Generic; + namespace Microsoft.eShopOnContainers.Services.Basket.API { public class Startup @@ -44,19 +49,20 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) - { - - services.AddHealthChecks(checks => - { - checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok"))); - }); - + { // Add framework services. services.AddMvc(options => { options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); + services.AddHealthChecks(checks => + { + checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok")), + TimeSpan.Zero //No cache for this HealthCheck, better just for demos + ); + }); + services.Configure(Configuration); //By connecting here we are making sure that our service @@ -68,23 +74,42 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddSingleton(sp => { var settings = sp.GetRequiredService>().Value; - var ips = Dns.GetHostAddressesAsync(settings.ConnectionString).Result; + ConfigurationOptions configuration = ConfigurationOptions.Parse(settings.ConnectionString, true); + configuration.ResolveDns = true; - return ConnectionMultiplexer.Connect(ips.First().ToString()); + return ConnectionMultiplexer.Connect(configuration); }); - services.AddSingleton(sp => + if (Configuration.GetValue("AzureServiceBusEnabled")) { - var settings = sp.GetRequiredService>().Value; - var logger = sp.GetRequiredService>(); - var factory = new ConnectionFactory() + services.AddSingleton(sp => { - HostName = settings.EventBusConnection - }; + var logger = sp.GetRequiredService>(); + + var serviceBusConnectionString = Configuration["EventBusConnection"]; + var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); + + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => + { + var logger = sp.GetRequiredService>(); + + var factory = new ConnectionFactory() + { + HostName = Configuration["EventBusConnection"] + }; + + return new DefaultRabbitMQPersistentConnection(factory, logger); + }); + } + + RegisterEventBus(services); - return new DefaultRabbitMQPersistentConnection(factory, logger); - }); services.AddSwaggerGen(options => { @@ -96,6 +121,20 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API Description = "The Basket Service HTTP API", TermsOfService = "Terms Of Service" }); + + options.AddSecurityDefinition("oauth2", new OAuth2Scheme + { + Type = "oauth2", + Flow = "implicit", + AuthorizationUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/authorize", + TokenUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/token", + Scopes = new Dictionary() + { + { "basket", "Basket API" } + } + }); + + options.OperationFilter(); }); services.AddCors(options => @@ -109,7 +148,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddSingleton(); services.AddTransient(); services.AddTransient(); - RegisterServiceBus(services); + services.AddOptions(); var container = new ContainerBuilder(); @@ -117,9 +156,27 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API return new AutofacServiceProvider(container.Build()); } - private void RegisterServiceBus(IServiceCollection services) + private void RegisterEventBus(IServiceCollection services) { - services.AddSingleton(); + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; + + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + } + else + { + services.AddSingleton(); + } + services.AddSingleton(); services.AddTransient(); @@ -145,6 +202,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API .UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + c.ConfigureOAuth2("basketswaggerui", "", "", "Basket Swagger UI"); }); ConfigureEventBus(app); diff --git a/src/Services/Basket/Basket.API/appsettings.json b/src/Services/Basket/Basket.API/appsettings.json index 31f76d0d0..f062f76d7 100644 --- a/src/Services/Basket/Basket.API/appsettings.json +++ b/src/Services/Basket/Basket.API/appsettings.json @@ -8,5 +8,7 @@ } }, "IdentityUrl": "http://localhost:5105", - "ConnectionString": "127.0.0.1" -} + "ConnectionString": "127.0.0.1", + "AzureServiceBusEnabled": false, + "SubscriptionClientName": "Basket" +} \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 8f30f7ca3..a3c79119a 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -21,6 +21,11 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest @@ -50,6 +55,7 @@ + @@ -58,8 +64,10 @@ + + @@ -72,6 +80,9 @@ PreserveNewest + + PreserveNewest + diff --git a/src/Services/Catalog/Catalog.API/CatalogSettings.cs b/src/Services/Catalog/Catalog.API/CatalogSettings.cs index af6e0ab13..a8c47991e 100644 --- a/src/Services/Catalog/Catalog.API/CatalogSettings.cs +++ b/src/Services/Catalog/Catalog.API/CatalogSettings.cs @@ -2,8 +2,11 @@ { public class CatalogSettings { - public string ExternalCatalogBaseUrl {get;set;} + public string PicBaseUrl { get;set;} public string EventBusConnection { get; set; } + + public bool UseCustomizationData { get; set; } + public bool AzureStorageEnabled { get; set; } } } diff --git a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs index 374d8ec7c..fe52b9128 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs @@ -200,7 +200,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers CatalogTypeId = product.CatalogTypeId, Description = product.Description, Name = product.Name, - PictureUri = product.PictureUri, + PictureFileName = product.PictureFileName, Price = product.Price }; _catalogContext.CatalogItems.Add(item); @@ -231,11 +231,13 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers private List ChangeUriPlaceholder(List items) { - var baseUri = _settings.ExternalCatalogBaseUrl; + var baseUri = _settings.PicBaseUrl; - items.ForEach(x => + items.ForEach(catalogItem => { - x.PictureUri = x.PictureUri.Replace("http://externalcatalogbaseurltobereplaced", baseUri); + catalogItem.PictureUri = _settings.AzureStorageEnabled + ? baseUri + catalogItem.PictureFileName + : baseUri.Replace("[0]", catalogItem.Id.ToString()); }); return items; diff --git a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs index 8d8aaf9f2..7043ce9f7 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs @@ -1,30 +1,92 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; using System.IO; +using System.Threading.Tasks; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers { - [Route("api/v1/[controller]")] public class PicController : Controller { private readonly IHostingEnvironment _env; - public PicController(IHostingEnvironment env) + private readonly CatalogContext _catalogContext; + + public PicController(IHostingEnvironment env, + CatalogContext catalogContext) { _env = env; + _catalogContext = catalogContext; } - [HttpGet("{id}")] + [HttpGet] + [Route("api/v1/catalog/items/{catalogItemId:int}/pic")] // GET: // - public IActionResult GetImage(int id) + public async Task GetImage(int catalogItemId) { - var webRoot = _env.WebRootPath; - var path = Path.Combine(webRoot, id + ".png"); + if (catalogItemId <= 0) + { + return BadRequest(); + } - var buffer = System.IO.File.ReadAllBytes(path); - - return File(buffer, "image/png"); + var item = await _catalogContext.CatalogItems + .SingleOrDefaultAsync(ci => ci.Id == catalogItemId); + + if (item != null) + { + var webRoot = _env.WebRootPath; + var path = Path.Combine(webRoot, item.PictureFileName); + + string imageFileExtension = Path.GetExtension(item.PictureFileName); + string mimetype = GetImageMimeTypeFromImageFileExtension(imageFileExtension); + + var buffer = System.IO.File.ReadAllBytes(path); + + return File(buffer, mimetype); + } + + return NotFound(); + } + + private string GetImageMimeTypeFromImageFileExtension(string extension) + { + string mimetype; + + switch (extension) + { + case ".png": + mimetype = "image/png"; + break; + case ".gif": + mimetype = "image/gif"; + break; + case ".jpg": + case ".jpeg": + mimetype = "image/jpeg"; + break; + case ".bmp": + mimetype = "image/bmp"; + break; + case ".tiff": + mimetype = "image/tiff"; + break; + case ".wmf": + mimetype = "image/wmf"; + break; + case ".jp2": + mimetype = "image/jp2"; + break; + case ".svg": + mimetype = "image/svg+xml"; + break; + default: + mimetype = "application/octet-stream"; + break; + } + + return mimetype; } } } diff --git a/src/Services/Catalog/Catalog.API/Extensions/LinqSelectExtensions.cs b/src/Services/Catalog/Catalog.API/Extensions/LinqSelectExtensions.cs new file mode 100644 index 000000000..1e5fbf789 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Extensions/LinqSelectExtensions.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Catalog.API.Extensions +{ + public static class LinqSelectExtensions + { + public static IEnumerable> SelectTry(this IEnumerable enumerable, Func selector) + { + foreach (TSource element in enumerable) + { + SelectTryResult returnedValue; + try + { + returnedValue = new SelectTryResult(element, selector(element), null); + } + catch (Exception ex) + { + returnedValue = new SelectTryResult(element, default(TResult), ex); + } + yield return returnedValue; + } + } + + public static IEnumerable OnCaughtException(this IEnumerable> enumerable, Func exceptionHandler) + { + return enumerable.Select(x => x.CaughtException == null ? x.Result : exceptionHandler(x.CaughtException)); + } + + public static IEnumerable OnCaughtException(this IEnumerable> enumerable, Func exceptionHandler) + { + return enumerable.Select(x => x.CaughtException == null ? x.Result : exceptionHandler(x.Source, x.CaughtException)); + } + + public class SelectTryResult + { + internal SelectTryResult(TSource source, TResult result, Exception exception) + { + Source = source; + Result = result; + CaughtException = exception; + } + + public TSource Source { get; private set; } + public TResult Result { get; private set; } + public Exception CaughtException { get; private set; } + } + } +} diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs index cd26632e0..f58541b62 100644 --- a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs +++ b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs @@ -36,9 +36,11 @@ builder.Property(ci => ci.Price) .IsRequired(true); - builder.Property(ci => ci.PictureUri) + builder.Property(ci => ci.PictureFileName) .IsRequired(false); + builder.Ignore(ci => ci.PictureUri); + builder.HasOne(ci => ci.CatalogBrand) .WithMany() .HasForeignKey(ci => ci.CatalogBrandId); diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs index 669768abd..6f71bd6cf 100644 --- a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs +++ b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs @@ -2,47 +2,115 @@ { using EntityFrameworkCore; using Extensions.Logging; + using global::Catalog.API.Extensions; using Microsoft.AspNetCore.Builder; + using Microsoft.AspNetCore.Hosting; + using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Options; using Model; using System; using System.Collections.Generic; + using System.Globalization; + using System.IO; + using System.IO.Compression; using System.Linq; + using System.Text.RegularExpressions; using System.Threading.Tasks; public class CatalogContextSeed { - public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0) + public static async Task SeedAsync(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory, int? retry = 0) { + var log = loggerFactory.CreateLogger("catalog seed"); + var context = (CatalogContext)applicationBuilder .ApplicationServices.GetService(typeof(CatalogContext)); context.Database.Migrate(); + var settings = (CatalogSettings)applicationBuilder + .ApplicationServices.GetRequiredService>().Value; + + var useCustomizationData = settings.UseCustomizationData; + var contentRootPath = env.ContentRootPath; + var picturePath = env.WebRootPath; + if (!context.CatalogBrands.Any()) { - context.CatalogBrands.AddRange( - GetPreconfiguredCatalogBrands()); + context.CatalogBrands.AddRange(useCustomizationData + ? GetCatalogBrandsFromFile(contentRootPath, log) + : GetPreconfiguredCatalogBrands() + ); await context.SaveChangesAsync(); } if (!context.CatalogTypes.Any()) { - context.CatalogTypes.AddRange( - GetPreconfiguredCatalogTypes()); + context.CatalogTypes.AddRange(useCustomizationData + ? GetCatalogTypesFromFile(contentRootPath, log) + : GetPreconfiguredCatalogTypes() + ); await context.SaveChangesAsync(); } if (!context.CatalogItems.Any()) { - context.CatalogItems.AddRange( - GetPreconfiguredItems()); + context.CatalogItems.AddRange(useCustomizationData + ? GetCatalogItemsFromFile(contentRootPath, context, log) + : GetPreconfiguredItems() + ); await context.SaveChangesAsync(); + + GetCatalogItemPictures(contentRootPath, picturePath); } } + static IEnumerable GetCatalogBrandsFromFile(string contentRootPath, ILogger log) + { + string csvFileCatalogBrands = Path.Combine(contentRootPath, "Setup", "CatalogBrands.csv"); + + if (!File.Exists(csvFileCatalogBrands)) + { + return GetPreconfiguredCatalogBrands(); + } + + string[] csvheaders; + try + { + string[] requiredHeaders = { "catalogbrand" }; + csvheaders = GetHeaders( csvFileCatalogBrands, requiredHeaders ); + } + catch (Exception ex) + { + log.LogError(ex.Message); + return GetPreconfiguredCatalogBrands(); + } + + return File.ReadAllLines(csvFileCatalogBrands) + .Skip(1) // skip header row + .SelectTry(x => CreateCatalogBrand(x)) + .OnCaughtException(ex => { log.LogError(ex.Message); return null; }) + .Where(x => x != null); + } + + static CatalogBrand CreateCatalogBrand(string brand) + { + brand = brand.Trim('"').Trim(); + + if (String.IsNullOrEmpty(brand)) + { + throw new Exception("catalog Brand Name is empty"); + } + + return new CatalogBrand + { + Brand = brand, + }; + } + static IEnumerable GetPreconfiguredCatalogBrands() { return new List() @@ -50,11 +118,54 @@ new CatalogBrand() { Brand = "Azure"}, new CatalogBrand() { Brand = ".NET" }, new CatalogBrand() { Brand = "Visual Studio" }, - new CatalogBrand() { Brand = "SQL Server" }, + new CatalogBrand() { Brand = "SQL Server" }, new CatalogBrand() { Brand = "Other" } }; } + static IEnumerable GetCatalogTypesFromFile(string contentRootPath, ILogger log) + { + string csvFileCatalogTypes = Path.Combine(contentRootPath, "Setup", "CatalogTypes.csv"); + + if (!File.Exists(csvFileCatalogTypes)) + { + return GetPreconfiguredCatalogTypes(); + } + + string[] csvheaders; + try + { + string[] requiredHeaders = { "catalogtype" }; + csvheaders = GetHeaders( csvFileCatalogTypes, requiredHeaders ); + } + catch (Exception ex) + { + log.LogError(ex.Message); + return GetPreconfiguredCatalogTypes(); + } + + return File.ReadAllLines(csvFileCatalogTypes) + .Skip(1) // skip header row + .SelectTry(x => CreateCatalogType(x)) + .OnCaughtException(ex => { log.LogError(ex.Message); return null; }) + .Where(x => x != null); + } + + static CatalogType CreateCatalogType(string type) + { + type = type.Trim('"').Trim(); + + if (String.IsNullOrEmpty(type)) + { + throw new Exception("catalog Type Name is empty"); + } + + return new CatalogType + { + Type = type, + }; + } + static IEnumerable GetPreconfiguredCatalogTypes() { return new List() @@ -66,23 +177,204 @@ }; } + static IEnumerable GetCatalogItemsFromFile(string contentRootPath, CatalogContext context, ILogger log) + { + string csvFileCatalogItems = Path.Combine(contentRootPath, "Setup", "CatalogItems.csv"); + + if (!File.Exists(csvFileCatalogItems)) + { + return GetPreconfiguredItems(); + } + + string[] csvheaders; + try + { + string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureFileName" }; + string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" }; + csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders ); + } + catch (Exception ex) + { + log.LogError(ex.Message); + return GetPreconfiguredItems(); + } + + var catalogTypeIdLookup = context.CatalogTypes.ToDictionary(ct => ct.Type, ct => ct.Id); + var catalogBrandIdLookup = context.CatalogBrands.ToDictionary(ct => ct.Brand, ct => ct.Id); + + return File.ReadAllLines(csvFileCatalogItems) + .Skip(1) // skip header row + .Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") ) + .SelectTry(column => CreateCatalogItem(column, csvheaders, catalogTypeIdLookup, catalogBrandIdLookup)) + .OnCaughtException(ex => { log.LogError(ex.Message); return null; }) + .Where(x => x != null); + } + + static CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictionary catalogTypeIdLookup, Dictionary catalogBrandIdLookup) + { + if (column.Count() != headers.Count()) + { + throw new Exception($"column count '{column.Count()}' not the same as headers count'{headers.Count()}'"); + } + + string catalogTypeName = column[Array.IndexOf(headers, "catalogtypename")].Trim('"').Trim(); + if (!catalogTypeIdLookup.ContainsKey(catalogTypeName)) + { + throw new Exception($"type={catalogTypeName} does not exist in catalogTypes"); + } + + string catalogBrandName = column[Array.IndexOf(headers, "catalogbrandname")].Trim('"').Trim(); + if (!catalogBrandIdLookup.ContainsKey(catalogBrandName)) + { + throw new Exception($"type={catalogTypeName} does not exist in catalogTypes"); + } + + string priceString = column[Array.IndexOf(headers, "price")].Trim('"').Trim(); + if (!Decimal.TryParse(priceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out Decimal price)) + { + throw new Exception($"price={priceString}is not a valid decimal number"); + } + + var catalogItem = new CatalogItem() + { + CatalogTypeId = catalogTypeIdLookup[catalogTypeName], + CatalogBrandId = catalogBrandIdLookup[catalogBrandName], + Description = column[Array.IndexOf(headers, "description")].Trim('"').Trim(), + Name = column[Array.IndexOf(headers, "name")].Trim('"').Trim(), + Price = price, + PictureUri = column[Array.IndexOf(headers, "pictureuri")].Trim('"').Trim(), + }; + + int availableStockIndex = Array.IndexOf(headers, "availablestock"); + if (availableStockIndex != -1) + { + string availableStockString = column[availableStockIndex].Trim('"').Trim(); + if (!String.IsNullOrEmpty(availableStockString)) + { + if ( int.TryParse(availableStockString, out int availableStock)) + { + catalogItem.AvailableStock = availableStock; + } + else + { + throw new Exception($"availableStock={availableStockString} is not a valid integer"); + } + } + } + + int restockThresholdIndex = Array.IndexOf(headers, "restockthreshold"); + if (restockThresholdIndex != -1) + { + string restockThresholdString = column[restockThresholdIndex].Trim('"').Trim(); + if (!String.IsNullOrEmpty(restockThresholdString)) + { + if (int.TryParse(restockThresholdString, out int restockThreshold)) + { + catalogItem.RestockThreshold = restockThreshold; + } + else + { + throw new Exception($"restockThreshold={restockThreshold} is not a valid integer"); + } + } + } + + int maxStockThresholdIndex = Array.IndexOf(headers, "maxstockthreshold"); + if (maxStockThresholdIndex != -1) + { + string maxStockThresholdString = column[maxStockThresholdIndex].Trim('"').Trim(); + if (!String.IsNullOrEmpty(maxStockThresholdString)) + { + if (int.TryParse(maxStockThresholdString, out int maxStockThreshold)) + { + catalogItem.MaxStockThreshold = maxStockThreshold; + } + else + { + throw new Exception($"maxStockThreshold={maxStockThreshold} is not a valid integer"); + } + } + } + + int onReorderIndex = Array.IndexOf(headers, "onreorder"); + if (onReorderIndex != -1) + { + string onReorderString = column[onReorderIndex].Trim('"').Trim(); + if (!String.IsNullOrEmpty(onReorderString)) + { + if (bool.TryParse(onReorderString, out bool onReorder)) + { + catalogItem.OnReorder = onReorder; + } + else + { + throw new Exception($"onReorder={onReorderString} is not a valid boolean"); + } + } + } + + return catalogItem; + } + static IEnumerable GetPreconfiguredItems() { return new List() { - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/1", AvailableStock = 100}, - new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/2", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/3", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/4", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/5", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/6", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/7", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/8", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup White Mug", Name = "Cup White Mug", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/9", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/10", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup Sheet", Name = "Cup Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/11", AvailableStock = 100 }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/12", AvailableStock = 100 } + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 2, AvailableStock = 100, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureFileName = "1.png" }, + new CatalogItem { CatalogTypeId = 1, CatalogBrandId = 2, AvailableStock = 100, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureFileName = "2.png" }, + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, AvailableStock = 100, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureFileName = "3.png" }, + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 2, AvailableStock = 100, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureFileName = "4.png" }, + new CatalogItem { CatalogTypeId = 3, CatalogBrandId = 5, AvailableStock = 100, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureFileName = "5.png" }, + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 2, AvailableStock = 100, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureFileName = "6.png" }, + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, AvailableStock = 100, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureFileName = "7.png" }, + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, AvailableStock = 100, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureFileName = "8.png" }, + new CatalogItem { CatalogTypeId = 1, CatalogBrandId = 5, AvailableStock = 100, Description = "Cup White Mug", Name = "Cup White Mug", Price = 12, PictureFileName = "9.png" }, + new CatalogItem { CatalogTypeId = 3, CatalogBrandId = 2, AvailableStock = 100, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureFileName = "10.png" }, + new CatalogItem { CatalogTypeId = 3, CatalogBrandId = 2, AvailableStock = 100, Description = "Cup Sheet", Name = "Cup Sheet", Price = 8.5M, PictureFileName = "11.png" }, + new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, AvailableStock = 100, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureFileName = "12.png" }, }; } + + static string[] GetHeaders(string csvfile, string[] requiredHeaders, string[] optionalHeaders = null) + { + string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(','); + + if (csvheaders.Count() < requiredHeaders.Count()) + { + throw new Exception($"requiredHeader count '{ requiredHeaders.Count()}' is bigger then csv header count '{csvheaders.Count()}' "); + } + + if (optionalHeaders != null) + { + if (csvheaders.Count() > (requiredHeaders.Count() + optionalHeaders.Count())) + { + throw new Exception($"csv header count '{csvheaders.Count()}' is larger then required '{requiredHeaders.Count()}' and optional '{optionalHeaders.Count()}' headers count"); + } + } + + foreach (var requiredHeader in requiredHeaders) + { + if (!csvheaders.Contains(requiredHeader)) + { + throw new Exception($"does not contain required header '{requiredHeader}'"); + } + } + + return csvheaders; + } + + static void GetCatalogItemPictures(string contentRootPath, string picturePath) + { + DirectoryInfo directory = new DirectoryInfo(picturePath); + foreach (FileInfo file in directory.GetFiles()) + { + file.Delete(); + } + + string zipFileCatalogItemPictures = Path.Combine(contentRootPath, "Setup", "CatalogItems.zip"); + ZipFile.ExtractToDirectory(zipFileCatalogItemPictures, picturePath); + } } + + } diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.Designer.cs b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.Designer.cs new file mode 100644 index 000000000..23c0e5344 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.Designer.cs @@ -0,0 +1,99 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; + +namespace Catalog.API.Infrastructure.Migrations +{ + [DbContext(typeof(CatalogContext))] + [Migration("20170530133114_AddPictureFile")] + partial class AddPictureFile + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "1.1.1") + .HasAnnotation("SqlServer:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Brand") + .IsRequired() + .HasMaxLength(100); + + b.HasKey("Id"); + + b.ToTable("CatalogBrand"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("CatalogBrandId"); + + b.Property("CatalogTypeId"); + + b.Property("Description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50); + + b.Property("PictureFileName"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.HasIndex("CatalogBrandId"); + + b.HasIndex("CatalogTypeId"); + + b.ToTable("Catalog"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Type") + .IsRequired() + .HasMaxLength(100); + + b.HasKey("Id"); + + b.ToTable("CatalogType"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogItem", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogBrand", "CatalogBrand") + .WithMany() + .HasForeignKey("CatalogBrandId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Microsoft.eShopOnContainers.Services.Catalog.API.Model.CatalogType", "CatalogType") + .WithMany() + .HasForeignKey("CatalogTypeId") + .OnDelete(DeleteBehavior.Cascade); + }); + } + } +} diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs new file mode 100644 index 000000000..fc7f4dc8d --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/20170530133114_AddPictureFileName.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Catalog.API.Infrastructure.Migrations +{ + public partial class AddPictureFile : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "PictureUri", + table: "Catalog", + newName: "PictureFileName"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "PictureFileName", + table: "Catalog", + newName: "PictureUri"); + } + } +} diff --git a/src/Services/Catalog/Catalog.API/Model/CatalogItem.cs b/src/Services/Catalog/Catalog.API/Model/CatalogItem.cs index f3c04f595..459c60098 100644 --- a/src/Services/Catalog/Catalog.API/Model/CatalogItem.cs +++ b/src/Services/Catalog/Catalog.API/Model/CatalogItem.cs @@ -13,6 +13,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model public decimal Price { get; set; } + public string PictureFileName { get; set; } + public string PictureUri { get; set; } public int CatalogTypeId { get; set; } diff --git a/src/Services/Catalog/Catalog.API/Setup/CatalogBrands.csv b/src/Services/Catalog/Catalog.API/Setup/CatalogBrands.csv new file mode 100644 index 000000000..95c9ee64c --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Setup/CatalogBrands.csv @@ -0,0 +1,8 @@ +CatalogBrand +Azure +.NET +Visual Studio +SQL Server +Other +CatalogBrandTestOne +CatalogBrandTestTwo \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Setup/CatalogItems.csv b/src/Services/Catalog/Catalog.API/Setup/CatalogItems.csv new file mode 100644 index 000000000..0257216d4 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Setup/CatalogItems.csv @@ -0,0 +1,14 @@ +CatalogTypeName,CatalogBrandName,Description,Name,Price,PictureFileName,availablestock,onreorder +T-Shirt,.NET,".NET Bot Black Hoodie, and more",.NET Bot Black Hoodie,19.5,1.png,100,false +Mug,.NET,.NET Black & White Mug,.NET Black & White Mug,8.50,2.png,89,true +T-Shirt,Other,Prism White T-Shirt,Prism White T-Shirt,12,3.png,56,false +T-Shirt,.NET,.NET Foundation T-shirt,.NET Foundation T-shirt,12,4.png,120,false +Sheet,Other,Roslyn Red Sheet,Roslyn Red Sheet,8.5,5.png,55,false +T-Shirt,.NET,.NET Blue Hoodie,.NET Blue Hoodie,12,6.png,17,false +T-Shirt,Other,Roslyn Red T-Shirt,Roslyn Red T-Shirt",12,7.png,8,false +T-Shirt,Other,Kudu Purple Hoodie,Kudu Purple Hoodie,8.5,8.png,34,false +Mug,Other,Cup White Mug,Cup White Mug,12,9.png,76,false +Sheet,.NET,.NET Foundation Sheet,.NET Foundation Sheet,12,10.png,11,false +Sheet,.NET,Cup Sheet,Cup Sheet,8.5,11.png,3,false +T-Shirt,Other,Prism White TShirt,Prism White TShirt,12,12.png,0,false +Mug, Other, De los Palotes, pepito, 12, 12.png, 0, false \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Setup/CatalogTypes.csv b/src/Services/Catalog/Catalog.API/Setup/CatalogTypes.csv new file mode 100644 index 000000000..ae636c265 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Setup/CatalogTypes.csv @@ -0,0 +1,7 @@ +CatalogType +Mug +T-Shirt +Sheet +USB Memory Stick +CatalogTypeTestOne +CatalogTypeTestTwo \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Setup/Catalogitems.zip b/src/Services/Catalog/Catalog.API/Setup/Catalogitems.zip new file mode 100644 index 000000000..6d3edfb3c Binary files /dev/null and b/src/Services/Catalog/Catalog.API/Setup/Catalogitems.zip differ diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index c5784b6a4..e32b27e53 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -6,11 +6,13 @@ using global::Catalog.API.IntegrationEvents; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; + using Microsoft.Azure.ServiceBus; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services; using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; @@ -21,6 +23,8 @@ using Microsoft.Extensions.HealthChecks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; + using Microsoft.WindowsAzure.Storage; + using Microsoft.WindowsAzure.Storage.Auth; using Polly; using RabbitMQ.Client; using System; @@ -62,6 +66,13 @@ minutes = minutesParsed; } checks.AddSqlCheck("CatalogDb", Configuration["ConnectionString"], TimeSpan.FromMinutes(minutes)); + + var accountName = Configuration.GetValue("AzureStorageAccountName"); + var accountKey = Configuration.GetValue("AzureStorageAccountKey"); + if (!string.IsNullOrEmpty(accountName) && !string.IsNullOrEmpty(accountKey)) + { + checks.AddAzureBlobStorageCheck(accountName, accountKey); + } }); services.AddMvc(options => @@ -114,23 +125,39 @@ services.AddTransient(); - services.AddSingleton(sp => + if (Configuration.GetValue("AzureServiceBusEnabled")) { - var settings = sp.GetRequiredService>().Value; - var logger = sp.GetRequiredService>(); - var factory = new ConnectionFactory() + services.AddSingleton(sp => { - HostName = settings.EventBusConnection - }; + var settings = sp.GetRequiredService>().Value; + var logger = sp.GetRequiredService>(); - return new DefaultRabbitMQPersistentConnection(factory, logger); - }); + var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection); - RegisterServiceBus(services); + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => + { + var settings = sp.GetRequiredService>().Value; + var logger = sp.GetRequiredService>(); + var factory = new ConnectionFactory() + { + HostName = settings.EventBusConnection + }; + + return new DefaultRabbitMQPersistentConnection(factory, logger); + }); + } + + RegisterEventBus(services); var container = new ContainerBuilder(); container.Populate(services); return new AutofacServiceProvider(container.Build()); + } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) @@ -153,7 +180,7 @@ var context = (CatalogContext)app .ApplicationServices.GetService(typeof(CatalogContext)); - WaitForSqlAvailabilityAsync(context, loggerFactory, app).Wait(); + WaitForSqlAvailabilityAsync(context, loggerFactory, app, env).Wait(); ConfigureEventBus(app); @@ -165,13 +192,13 @@ integrationEventLogContext.Database.Migrate(); } - private async Task WaitForSqlAvailabilityAsync(CatalogContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0) + private async Task WaitForSqlAvailabilityAsync(CatalogContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, IHostingEnvironment env, int retries = 0) { var logger = loggerFactory.CreateLogger(nameof(Startup)); - var policy = CreatePolicy(retries, logger, nameof (WaitForSqlAvailabilityAsync)); + var policy = CreatePolicy(retries, logger, nameof(WaitForSqlAvailabilityAsync)); await policy.ExecuteAsync(async () => { - await CatalogContextSeed.SeedAsync(app, loggerFactory); + await CatalogContextSeed.SeedAsync(app, env, loggerFactory); }); } @@ -189,25 +216,37 @@ ); } - private void RegisterServiceBus(IServiceCollection services) + private void RegisterEventBus(IServiceCollection services) { + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; + + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + + } + else + { + services.AddSingleton(); + } + services.AddSingleton(); - services.AddSingleton(); - - services.AddTransient, - OrderStatusChangedToAwaitingValidationIntegrationEventHandler>(); - services.AddTransient, - OrderStatusChangedToPaidIntegrationEventHandler>(); + services.AddTransient(); + services.AddTransient(); } - - private void ConfigureEventBus(IApplicationBuilder app) + protected virtual void ConfigureEventBus(IApplicationBuilder app) { var eventBus = app.ApplicationServices.GetRequiredService(); - - eventBus.Subscribe>(); - eventBus.Subscribe>(); + eventBus.Subscribe(); + eventBus.Subscribe(); } } } diff --git a/src/Services/Catalog/Catalog.API/settings.json b/src/Services/Catalog/Catalog.API/settings.json index e67fec713..dafeca845 100644 --- a/src/Services/Catalog/Catalog.API/settings.json +++ b/src/Services/Catalog/Catalog.API/settings.json @@ -1,6 +1,7 @@ { "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word", - "ExternalCatalogBaseUrl": "http://localhost:5101", + "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", + "UseCustomizationData": false, "Logging": { "IncludeScopes": false, "LogLevel": { @@ -8,5 +9,8 @@ "System": "Information", "Microsoft": "Information" } - } + }, + "AzureServiceBusEnabled": false, + "AzureStorageEnabled": false, + "SubscriptionClientName": "Catalog" } diff --git a/src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin b/src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin new file mode 100644 index 000000000..9c664f4e4 --- /dev/null +++ b/src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin @@ -0,0 +1,8 @@ +FROM microsoft/dotnet:1.1-runtime-nanoserver +SHELL ["powershell"] +ARG source +WORKDIR /app +RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord +EXPOSE 80 +COPY ${source:-obj/Docker/publish} . +ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj index d057a6b54..0fa866642 100644 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj @@ -22,6 +22,7 @@ + diff --git a/src/Services/GracePeriod/GracePeriodManager/Program.cs b/src/Services/GracePeriod/GracePeriodManager/Program.cs index eecdd80ea..88fb1547e 100644 --- a/src/Services/GracePeriod/GracePeriodManager/Program.cs +++ b/src/Services/GracePeriod/GracePeriodManager/Program.cs @@ -14,6 +14,8 @@ using Microsoft.Extensions.Options; using RabbitMQ.Client; using Services; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; + using Microsoft.Azure.ServiceBus; public class Program { @@ -58,20 +60,36 @@ services.AddLogging() .AddOptions() .Configure(Configuration) - .AddSingleton() - .AddSingleton(sp => + .AddSingleton(); + + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var logger = sp.GetRequiredService>(); + + var serviceBusConnectionString = Configuration["EventBusConnection"]; + var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); + + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => { - var settings = sp.GetRequiredService>().Value; var logger = sp.GetRequiredService>(); + var factory = new ConnectionFactory() { - HostName = settings.EventBusConnection + HostName = Configuration["EventBusConnection"] }; return new DefaultRabbitMQPersistentConnection(factory, logger); }); + } - RegisterEventBus(services); + RegisterEventBus(services); var container = new ContainerBuilder(); container.Populate(services); @@ -87,7 +105,25 @@ private static void RegisterEventBus(IServiceCollection services) { - services.AddSingleton(); + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; + + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + } + else + { + services.AddSingleton(); + } + services.AddSingleton(); } } diff --git a/src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs b/src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs index 24207ea2b..973fda158 100644 --- a/src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs +++ b/src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs @@ -41,7 +41,6 @@ { try { - _logger.LogInformation("Grace Period Manager Client is trying to connect to database server"); conn.Open(); orderIds = conn.Query( @"SELECT Id FROM [Microsoft.eShopOnContainers.Services.OrderingDb].[ordering].[orders] diff --git a/src/Services/GracePeriod/GracePeriodManager/appsettings.json b/src/Services/GracePeriod/GracePeriodManager/appsettings.json index 273437a8e..76703a77e 100644 --- a/src/Services/GracePeriod/GracePeriodManager/appsettings.json +++ b/src/Services/GracePeriod/GracePeriodManager/appsettings.json @@ -9,5 +9,7 @@ }, "ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", "GracePeriodTime": "1", - "CheckUpdateTime": "30000" + "CheckUpdateTime": "30000", + "AzureServiceBusEnabled": false, + "SubscriptionClientName": "GracePeriod" } diff --git a/src/Services/Identity/Identity.API/AppSettings.cs b/src/Services/Identity/Identity.API/AppSettings.cs index bc81ecf36..78d848d41 100644 --- a/src/Services/Identity/Identity.API/AppSettings.cs +++ b/src/Services/Identity/Identity.API/AppSettings.cs @@ -8,5 +8,6 @@ namespace eShopOnContainers.Identity public class AppSettings { public string MvcClient { get; set; } + public bool UseCustomizationData { get; set; } } } diff --git a/src/Services/Identity/Identity.API/Configuration/Config.cs b/src/Services/Identity/Identity.API/Configuration/Config.cs index 4aa12d4ce..412220673 100644 --- a/src/Services/Identity/Identity.API/Configuration/Config.cs +++ b/src/Services/Identity/Identity.API/Configuration/Config.cs @@ -114,6 +114,98 @@ namespace Identity.API.Configuration "locations", "marketing" }, + }, + new Client + { + ClientId = "mvctest", + ClientName = "MVC Client Test", + ClientSecrets = new List + { + new Secret("secret".Sha256()) + }, + ClientUri = $"{clientsUrl["Mvc"]}", // public uri of the client + AllowedGrantTypes = GrantTypes.Hybrid, + AllowAccessTokensViaBrowser = true, + RequireConsent = false, + AllowOfflineAccess = true, + RedirectUris = new List + { + $"{clientsUrl["Mvc"]}/signin-oidc" + }, + PostLogoutRedirectUris = new List + { + $"{clientsUrl["Mvc"]}/signout-callback-oidc" + }, + AllowedScopes = new List + { + IdentityServerConstants.StandardScopes.OpenId, + IdentityServerConstants.StandardScopes.Profile, + IdentityServerConstants.StandardScopes.OfflineAccess, + "orders", + "basket", + "locations", + "marketing" + }, + }, + new Client + { + ClientId = "locationsswaggerui", + ClientName = "Locations Swagger UI", + AllowedGrantTypes = GrantTypes.Implicit, + AllowAccessTokensViaBrowser = true, + + RedirectUris = { $"{clientsUrl["LocationsApi"]}/swagger/o2c.html" }, + PostLogoutRedirectUris = { $"{clientsUrl["LocationsApi"]}/swagger/" }, + + AllowedScopes = + { + "locations" + } + }, + new Client + { + ClientId = "marketingswaggerui", + ClientName = "Marketing Swagger UI", + AllowedGrantTypes = GrantTypes.Implicit, + AllowAccessTokensViaBrowser = true, + + RedirectUris = { $"{clientsUrl["MarketingApi"]}/swagger/o2c.html" }, + PostLogoutRedirectUris = { $"{clientsUrl["MarketingApi"]}/swagger/" }, + + AllowedScopes = + { + "marketing" + } + }, + new Client + { + ClientId = "basketswaggerui", + ClientName = "Basket Swagger UI", + AllowedGrantTypes = GrantTypes.Implicit, + AllowAccessTokensViaBrowser = true, + + RedirectUris = { $"{clientsUrl["BasketApi"]}/swagger/o2c.html" }, + PostLogoutRedirectUris = { $"{clientsUrl["BasketApi"]}/swagger/" }, + + AllowedScopes = + { + "basket" + } + }, + new Client + { + ClientId = "orderingswaggerui", + ClientName = "Ordering Swagger UI", + AllowedGrantTypes = GrantTypes.Implicit, + AllowAccessTokensViaBrowser = true, + + RedirectUris = { $"{clientsUrl["OrderingApi"]}/swagger/o2c.html" }, + PostLogoutRedirectUris = { $"{clientsUrl["OrderingApi"]}/swagger/" }, + + AllowedScopes = + { + "orders" + } } }; } diff --git a/src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs b/src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs index cf8ae612f..0f81bcf66 100644 --- a/src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs +++ b/src/Services/Identity/Identity.API/Data/ApplicationContextSeed.cs @@ -3,13 +3,21 @@ using AspNetCore.Identity; using EntityFrameworkCore; using Extensions.Logging; + using global::eShopOnContainers.Identity; using global::Identity.API.Data; using global::Identity.API.Models; + using Identity.API.Extensions; using Microsoft.AspNetCore.Builder; + using Microsoft.AspNetCore.Hosting; + using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Options; using System; using System.Collections.Generic; + using System.IO; + using System.IO.Compression; using System.Linq; using System.Security.Cryptography; + using System.Text.RegularExpressions; using System.Threading.Tasks; public class ApplicationContextSeed @@ -21,23 +29,38 @@ _passwordHasher = passwordHasher; } - public async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0) + public async Task SeedAsync(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory, int? retry = 0) { int retryForAvaiability = retry.Value; try { + var log = loggerFactory.CreateLogger("application seed"); + var context = (ApplicationDbContext)applicationBuilder .ApplicationServices.GetService(typeof(ApplicationDbContext)); context.Database.Migrate(); + var settings = (AppSettings)applicationBuilder + .ApplicationServices.GetRequiredService>().Value; + + var useCustomizationData = settings.UseCustomizationData; + var contentRootPath = env.ContentRootPath; + var webroot = env.WebRootPath; + if (!context.Users.Any()) { - context.Users.AddRange( - GetDefaultUser()); + context.Users.AddRange(useCustomizationData + ? GetUsersFromFile(contentRootPath, log) + : GetDefaultUser()); await context.SaveChangesAsync(); } + + if (useCustomizationData) + { + GetPreconfiguredImages(contentRootPath, webroot, log); + } } catch (Exception ex) { @@ -46,14 +69,93 @@ retryForAvaiability++; var log = loggerFactory.CreateLogger("catalog seed"); log.LogError(ex.Message); - await SeedAsync(applicationBuilder, loggerFactory, retryForAvaiability); + await SeedAsync(applicationBuilder, env, loggerFactory, retryForAvaiability); } } } - private ApplicationUser GetDefaultUser() + private IEnumerable GetUsersFromFile(string contentRootPath, ILogger log) { - var user = + string csvFileUsers = Path.Combine(contentRootPath, "Setup", "Users.csv"); + + if (!File.Exists(csvFileUsers)) + { + return GetDefaultUser(); + } + + string[] csvheaders; + try + { + string[] requiredHeaders = { + "cardholdername", "cardnumber", "cardtype", "city", "country", + "email", "expiration", "lastname", "name", "phonenumber", + "username", "zipcode", "state", "street", "securitynumber", + "normalizedemail", "normalizedusername", "password" + }; + csvheaders = GetHeaders(requiredHeaders, csvFileUsers); + } + catch (Exception ex) + { + log.LogError(ex.Message); + return GetDefaultUser(); + } + + List users = File.ReadAllLines(csvFileUsers) + .Skip(1) // skip header column + .Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)") ) + .SelectTry(column => CreateApplicationUser(column, csvheaders)) + .OnCaughtException(ex => { log.LogError(ex.Message); return null; }) + .Where(x => x != null) + .ToList(); + + return users; + } + + private ApplicationUser CreateApplicationUser(string[] column, string[] headers) + { + if (column.Count() != headers.Count()) + { + throw new Exception($"column count '{column.Count()}' not the same as headers count'{headers.Count()}'"); + } + + string cardtypeString = column[Array.IndexOf(headers, "cardtype")].Trim('"').Trim(); + if (!int.TryParse(cardtypeString, out int cardtype)) + { + throw new Exception($"cardtype='{cardtypeString}' is not a number"); + } + + var user = new ApplicationUser + { + CardHolderName = column[Array.IndexOf(headers, "cardholdername")].Trim('"').Trim(), + CardNumber = column[Array.IndexOf(headers, "cardnumber")].Trim('"').Trim(), + CardType = cardtype, + City = column[Array.IndexOf(headers, "city")].Trim('"').Trim(), + Country = column[Array.IndexOf(headers, "country")].Trim('"').Trim(), + Email = column[Array.IndexOf(headers, "email")].Trim('"').Trim(), + Expiration = column[Array.IndexOf(headers, "expiration")].Trim('"').Trim(), + Id = Guid.NewGuid().ToString(), + LastName = column[Array.IndexOf(headers, "lastname")].Trim('"').Trim(), + Name = column[Array.IndexOf(headers, "name")].Trim('"').Trim(), + PhoneNumber = column[Array.IndexOf(headers, "phonenumber")].Trim('"').Trim(), + UserName = column[Array.IndexOf(headers, "username")].Trim('"').Trim(), + ZipCode = column[Array.IndexOf(headers, "zipcode")].Trim('"').Trim(), + State = column[Array.IndexOf(headers, "state")].Trim('"').Trim(), + Street = column[Array.IndexOf(headers, "street")].Trim('"').Trim(), + SecurityNumber = column[Array.IndexOf(headers, "securitynumber")].Trim('"').Trim(), + NormalizedEmail = column[Array.IndexOf(headers, "normalizedemail")].Trim('"').Trim(), + NormalizedUserName = column[Array.IndexOf(headers, "normalizedusername")].Trim('"').Trim(), + SecurityStamp = Guid.NewGuid().ToString("D"), + PasswordHash = column[Array.IndexOf(headers, "password")].Trim('"').Trim(), // Note: This is the password + }; + + user.PasswordHash = _passwordHasher.HashPassword(user, user.PasswordHash); + + return user; + } + + private IEnumerable GetDefaultUser() + { + var user = new ApplicationUser() { CardHolderName = "DemoUser", @@ -63,23 +165,86 @@ Country = "U.S.", Email = "demouser@microsoft.com", Expiration = "12/20", - Id = Guid.NewGuid().ToString(), - LastName = "DemoLastName", - Name = "DemoUser", - PhoneNumber = "1234567890", - UserName = "demouser@microsoft.com", - ZipCode = "98052", - State = "WA", - Street = "15703 NE 61st Ct", - SecurityNumber = "535", - NormalizedEmail = "DEMOUSER@MICROSOFT.COM", - NormalizedUserName = "DEMOUSER@MICROSOFT.COM", - SecurityStamp = Guid.NewGuid().ToString("D") + Id = Guid.NewGuid().ToString(), + LastName = "DemoLastName", + Name = "DemoUser", + PhoneNumber = "1234567890", + UserName = "demouser@microsoft.com", + ZipCode = "98052", + State = "WA", + Street = "15703 NE 61st Ct", + SecurityNumber = "535", + NormalizedEmail = "DEMOUSER@MICROSOFT.COM", + NormalizedUserName = "DEMOUSER@MICROSOFT.COM", + SecurityStamp = Guid.NewGuid().ToString("D"), }; user.PasswordHash = _passwordHasher.HashPassword(user, "Pass@word1"); - return user; + return new List() + { + user + }; + } + + static string[] GetHeaders(string[] requiredHeaders, string csvfile) + { + string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(','); + + if (csvheaders.Count() != requiredHeaders.Count()) + { + throw new Exception($"requiredHeader count '{ requiredHeaders.Count()}' is different then read header '{csvheaders.Count()}'"); + } + + foreach (var requiredHeader in requiredHeaders) + { + if (!csvheaders.Contains(requiredHeader)) + { + throw new Exception($"does not contain required header '{requiredHeader}'"); + } + } + + return csvheaders; + } + + static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogger log) + { + try + { + string imagesZipFile = Path.Combine(contentRootPath, "Setup", "images.zip"); + if (!File.Exists(imagesZipFile)) + { + log.LogError($" zip file '{imagesZipFile}' does not exists."); + return; + } + + string imagePath = Path.Combine(webroot, "images"); + string[] imageFiles = Directory.GetFiles(imagePath).Select(file => Path.GetFileName(file)).ToArray(); + + using (ZipArchive zip = ZipFile.Open(imagesZipFile, ZipArchiveMode.Read)) + { + foreach (ZipArchiveEntry entry in zip.Entries) + { + if (imageFiles.Contains(entry.Name)) + { + string destinationFilename = Path.Combine(imagePath, entry.Name); + if (File.Exists(destinationFilename)) + { + File.Delete(destinationFilename); + } + entry.ExtractToFile(destinationFilename); + } + else + { + log.LogWarning($"Skip file '{entry.Name}' in zipfile '{imagesZipFile}'"); + } + } + } + } + catch (Exception ex) + { + log.LogError($"Exception in method GetPreconfiguredImages WebMVC. Exception Message={ex.Message}"); + } } } } diff --git a/src/Services/Identity/Identity.API/Extensions/LinqSelectExtensions.cs b/src/Services/Identity/Identity.API/Extensions/LinqSelectExtensions.cs new file mode 100644 index 000000000..e3ff0a3c0 --- /dev/null +++ b/src/Services/Identity/Identity.API/Extensions/LinqSelectExtensions.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Identity.API.Extensions +{ + public static class LinqSelectExtensions + { + public static IEnumerable> SelectTry(this IEnumerable enumerable, Func selector) + { + foreach (TSource element in enumerable) + { + SelectTryResult returnedValue; + try + { + returnedValue = new SelectTryResult(element, selector(element), null); + } + catch (Exception ex) + { + returnedValue = new SelectTryResult(element, default(TResult), ex); + } + yield return returnedValue; + } + } + + public static IEnumerable OnCaughtException(this IEnumerable> enumerable, Func exceptionHandler) + { + return enumerable.Select(x => x.CaughtException == null ? x.Result : exceptionHandler(x.CaughtException)); + } + + public static IEnumerable OnCaughtException(this IEnumerable> enumerable, Func exceptionHandler) + { + return enumerable.Select(x => x.CaughtException == null ? x.Result : exceptionHandler(x.Source, x.CaughtException)); + } + + public class SelectTryResult + { + internal SelectTryResult(TSource source, TResult result, Exception exception) + { + Source = source; + Result = result; + CaughtException = exception; + } + + public TSource Source { get; private set; } + public TResult Result { get; private set; } + public Exception CaughtException { get; private set; } + } + } +} diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index d31664a2b..1fd2a7fa8 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -8,7 +8,13 @@ $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\..\docker-compose.dcproj - + + + + PreserveNewest + + + @@ -70,6 +76,9 @@ Always + + PreserveNewest + diff --git a/src/Services/Identity/Identity.API/Setup/Users.csv b/src/Services/Identity/Identity.API/Setup/Users.csv new file mode 100644 index 000000000..3e5081078 --- /dev/null +++ b/src/Services/Identity/Identity.API/Setup/Users.csv @@ -0,0 +1,2 @@ +CardHolderName,CardNumber,CardType,City,Country,Email,Expiration,LastName,Name,PhoneNumber,UserName,ZipCode,State,Street,SecurityNumber,NormalizedEmail,NormalizedUserName,Password +DemoUser,4012888888881881,1,Redmond,U.S.,demouser@microsoft.com,12/20,DemoLastName,DemoUser,1234567890,demouser@microsoft.com,98052,WA,15703 NE 61st Ct,535,DEMOUSER@MICROSOFT.COM,DEMOUSER@MICROSOFT.COM,Pass@word1 \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Setup/images.zip b/src/Services/Identity/Identity.API/Setup/images.zip new file mode 100644 index 000000000..1b901d3af Binary files /dev/null and b/src/Services/Identity/Identity.API/Setup/images.zip differ diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index 584aefb35..0ba915cf3 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -153,7 +153,7 @@ namespace eShopOnContainers.Identity //Seed Data var hasher = new PasswordHasher(); - new ApplicationContextSeed(hasher).SeedAsync(app, loggerFactory).Wait(); + new ApplicationContextSeed(hasher).SeedAsync(app, env, loggerFactory).Wait(); } private async Task InitializeGrantStoreAndConfiguration(IApplicationBuilder app) @@ -163,6 +163,10 @@ namespace eShopOnContainers.Identity clientUrls.Add("Mvc", Configuration.GetValue("MvcClient")); clientUrls.Add("Spa", Configuration.GetValue("SpaClient")); clientUrls.Add("Xamarin", Configuration.GetValue("XamarinCallback")); + clientUrls.Add("LocationsApi", Configuration.GetValue("LocationApiClient")); + clientUrls.Add("MarketingApi", Configuration.GetValue("MarketingApiClient")); + clientUrls.Add("BasketApi", Configuration.GetValue("BasketApiClient")); + clientUrls.Add("OrderingApi", Configuration.GetValue("OrderingApiClient")); using (var serviceScope = app.ApplicationServices.GetService().CreateScope()) { diff --git a/src/Services/Identity/Identity.API/Views/Shared/_Layout.cshtml b/src/Services/Identity/Identity.API/Views/Shared/_Layout.cshtml index 9d0a5ce8a..163d2606a 100644 --- a/src/Services/Identity/Identity.API/Views/Shared/_Layout.cshtml +++ b/src/Services/Identity/Identity.API/Views/Shared/_Layout.cshtml @@ -40,10 +40,7 @@

-
-
-
- +
diff --git a/src/Services/Identity/Identity.API/appsettings.json b/src/Services/Identity/Identity.API/appsettings.json index 557bac0c3..09142603a 100644 --- a/src/Services/Identity/Identity.API/appsettings.json +++ b/src/Services/Identity/Identity.API/appsettings.json @@ -6,6 +6,7 @@ "MvcClient": "http://localhost:5100", "SpaClient": "http://localhost:5104", "XamarinCallback": "http://localhost:5105/xamarincallback", + "UseCustomizationData": false, "Logging": { "IncludeScopes": false, "LogLevel": { diff --git a/src/Services/Identity/Identity.API/wwwroot/css/site.css b/src/Services/Identity/Identity.API/wwwroot/css/site.css index c8dcea80a..c29d2090d 100644 --- a/src/Services/Identity/Identity.API/wwwroot/css/site.css +++ b/src/Services/Identity/Identity.API/wwwroot/css/site.css @@ -476,11 +476,7 @@ footer { } footer .text { - text-align: right; - width: 100%; - height: 100%; - color: #83D01B; - margin-top: 10px; + margin-top: 55px; } .text { diff --git a/src/Services/Identity/Identity.API/wwwroot/css/site.min.css b/src/Services/Identity/Identity.API/wwwroot/css/site.min.css index f11b8614b..228970b59 100644 --- a/src/Services/Identity/Identity.API/wwwroot/css/site.min.css +++ b/src/Services/Identity/Identity.API/wwwroot/css/site.min.css @@ -1 +1 @@ -body{margin-top:65px}.navbar-header{position:relative;top:-4px}.navbar-brand>.icon-banner{position:relative;top:-2px;display:inline}.icon{position:relative;top:-10px}.page-consent .client-logo{float:left}.page-consent .client-logo img{width:80px;height:80px}.page-consent .consent-buttons{margin-top:25px}.page-consent .consent-form .consent-scopecheck{display:inline-block;margin-right:5px}.page-consent .consent-form .consent-description{margin-left:25px}.page-consent .consent-form .consent-description label{font-weight:normal}.page-consent .consent-form .consent-remember{padding-left:16px}@font-face{font-family:Montserrat;font-weight:400;src:url("../fonts/Montserrat-Regular.eot?") format("eot"),url("../fonts/Montserrat-Regular.woff") format("woff"),url("../fonts/Montserrat-Regular.ttf") format("truetype"),url("../fonts/Montserrat-Regular.svg#Montserrat") format("svg")}@font-face{font-family:Montserrat;font-weight:700;src:url("../fonts/Montserrat-Bold.eot?") format("eot"),url("../fonts/Montserrat-Bold.woff") format("woff"),url("../fonts/Montserrat-Bold.ttf") format("truetype"),url("../fonts/Montserrat-Bold.svg#Montserrat") format("svg")}body{font-family:Montserrat,sans-serif;min-width:480px}.mt-15{margin-top:15px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.select-filter{background-color:transparent;padding:10px;margin:10px;margin-right:20px;color:#fff;padding-top:20px;padding-bottom:3px;min-width:140px;border-color:#37c7ca;max-height:43px;-webkit-appearance:none}.select-filter option{background-color:#00a69c}select::-ms-expand{display:none}.select-filter-wrapper{z-index:0;display:inline-block;margin-left:-10px}.select-filter-wrapper::before{content:attr(data-name);opacity:.5;z-index:1;text-transform:uppercase;position:absolute;font-size:10px;margin-top:15px;margin-left:21px;color:#fff}.select-filter-arrow{position:absolute;margin-left:130px;margin-top:40px}.btn-brand-small-filter{margin-top:10px;position:absolute;margin-left:15px}.carousel-caption p{font-size:20px;line-height:1.4}.layout-cart-image{height:36px;margin-top:5px}.layout-cart-badge{position:absolute;margin-top:2px;margin-left:14px;background-color:#83d01b;padding:1px;color:#fff;border-radius:50%;width:18px;height:18px;font-size:12px;cursor:pointer}.btn-bracketed:hover:before{display:inline-block;content:"[";padding-right:.5em;color:#7fff00}.btn-bracketed:hover:after{display:inline-block;content:"]";padding-left:.5em;color:#7fff00}.btn-brand{background-color:#83d01b;color:#fff;padding:10px 20px 10px 20px;border-radius:0;border:none;width:255px;display:inline-block;text-align:center;text-transform:uppercase;height:45px;font-size:16px;font-weight:normal}.btn-brand::before{content:'['}.btn-brand::after{content:']'}.btn-brand:hover:before{padding-right:5px}.btn-brand:hover:after{padding-left:5px}.btn-brand-big{width:360px;margin-top:20px}.btn-brand-small{width:45px}.btn-brand-small::before{content:''}.btn-brand-small::after{content:''}.btn-brand-small:hover:before{content:'';padding:0}.btn-brand-small:hover:after{content:'';padding:0}.btn-brand-dark{background-color:#00a69c}.btn-brand:hover{color:#fff;background-color:#83d01b;text-decoration:none}.btn-brand-dark:hover{background-color:#00a69c}.btn-cart{float:right;margin-top:40px;margin-bottom:40px}.btn-catalog-apply{padding:0}.form-label{text-transform:uppercase;font-weight:normal!important;text-align:left;margin-bottom:10px !important;color:#404040}.form-input{border-radius:0;padding:10px;height:45px}.form-input-small{max-width:100px!important}.form-select{border-radius:0;padding:10px;height:45px;width:150px}.carousel-inner .item img[src$=".svg"]{width:100%}.navbar-inverse{background-color:#fff;border-color:#fff}.btn-login{border:1px solid #00a69c;height:36px!important;margin-right:10px;margin-top:10px;background-color:#fff;color:#00a69c;text-transform:uppercase;max-width:140px;width:140px;padding-top:8px!important}.btn-login{font-weight:normal!important}.btn-login::before{content:'['}.btn-login::after{content:']'}.btn-login:hover:before{content:'[ '}.btn-login:hover:after{content:' ]'}.navbar-inverse li a{height:30px;padding:5px 20px;color:#00a69c !important}.navbar-brand{margin-top:20px;background-image:url(../images/brand.PNG);width:201px;height:44px;margin-left:0 !important}.nav>li>a{color:#fff}.nav>li>a:hover,.nav>li>a:focus{background-color:#00a69c;font-weight:bolder}.container-fluid{padding-left:0;padding-right:0}.home-banner{width:100%;margin-right:0;margin-left:0;background-image:url(../images/main_banner.png);background-size:cover;height:258px;background-position:center}.home-banner-text{margin-top:70px}.home-catalog-container{min-height:400px;margin-bottom:20px}.home-catalog-filter-container{background-color:#00a69c;height:63px;line-height:76px}.home-catalog-filter-container li a{padding-top:5px !important}.home-catalog-filter-brands::before{content:'BRAND';color:#fff;font-size:x-small;opacity:.5;margin:10px 0 0 15px}.home-catalog-filter-types::before{content:'TYPES';color:#fff;font-size:x-small;opacity:.5;margin:10px 0 0 15px}.home-catalog-item{margin-top:10px;margin-bottom:10px}.home-catalog-item-image{width:100%;object-fit:cover;text-align:center}.home-catalog-item-image-addCart{background-color:#83d01b;color:#fff;display:inline-block;height:43px;padding:10px 20px 10px 20px;font-weight:bold;text-align:center;margin-top:10px;margin-left:60px;margin-right:60px;font-size:16px;font-weight:normal}.home-catalog-item-image-addCart:hover{color:#fff;text-decoration:none}.home-catalog-item-image:hover:after{cursor:pointer}.home-catalog-item-title{text-align:center;text-transform:uppercase;font-weight:300;font-size:16px;margin-top:20px}.home-catalog-item-price{text-align:center;font-weight:900;font-size:28px}.home-catalog-item-price::before{content:'$'}.home-catalog-noResults{text-align:center;margin-top:100px}.container .nav .navbar-nav .col-sm-6 ::before{content:'BRAND'}.validation-summary-errors li{list-style:none}footer{background-color:#000;height:150px;vertical-align:middle}footer .brand{margin-top:25px;background-image:url(../images/brand_dark.PNG);max-width:231px;height:52px;margin-left:0 !important}footer .text{text-align:right;width:100%;height:100%;color:#83d01b;margin-top:10px}.text{color:#83d01b}.text:hover{color:#83d01b}form .col-md-4{text-align:right}.brand-header-block{background-color:#00a69c;height:63px}.brand-header-block li{list-style:none;display:inline;opacity:.5;margin-top:25px;margin-left:10px;cursor:pointer;color:#fff}.brand-header-block li a{color:#fff}.brand-header-block li a:hover{text-decoration:none}.brand-header-block .active{opacity:1}.brand-header-block .active::before{content:'[ ';color:#adff2f}.brand-header-block .active::after{content:' ]';color:#adff2f}.brand-header-back{float:left!important;margin-top:20px!important;text-transform:uppercase}.account-login-container{min-height:70vh;text-align:center;padding-top:40px}.account-register-container{min-height:70vh;text-align:center !important;align-content:center}.cart-index-container{min-height:70vh;padding-top:40px;margin-bottom:30px;min-width:992px}.register-container{min-height:70vh;padding-top:40px;margin-bottom:30px;padding-left:30px}.order-create-container{min-height:70vh;padding-top:40px;margin-bottom:30px;padding-left:30px;min-width:995px}.cart-product-column{max-width:120px;text-transform:uppercase;vertical-align:middle!important}.order-create-container .cart-product-column{max-width:130px}.cart-product-column-name{width:220px}.cart-subtotal-label{font-size:12px;color:#404040;margin-top:10px}.cart-subtotal-value{font-size:20px;color:#00a69c}.cart-total-label{font-size:14px;color:#404040;margin-top:10px}.cart-total-value{font-size:28px;color:#00a69c;text-align:left}.cart-product-image{max-width:210px}.cart-section-total{margin-bottom:5px;margin-left:175px;text-align:left}.cart-product-column input{width:70px;text-align:center}.cart-refresh-button{margin-top:0;background-image:url('../images/refresh.svg');color:#fff;font-size:8px;width:40px;height:40px;background-color:transparent;border:none;margin-top:25px;margin-left:15px}.cart-refresh-button:hover{background-color:transparent}.cart-totals{border-bottom:none!important}.input-validation-error{border:1px solid #fb0d0d}.text-danger{color:#fb0d0d;font-size:12px}.cart{border:none !important}.form-horizontal h4{margin-top:30px}.form-horizontal .form-group{margin-right:0!important}.form-control:focus{border-color:#83d01b}.form-input-center{margin:auto}.order-index-container{min-height:70vh;padding-top:40px;margin-bottom:30px}.order-index-container .table tbody tr{border-bottom:none}.order-index-container .table tbody tr td{border-top:none;padding-top:10px;padding-bottom:10px}.order-index-container .table tbody tr:nth-child(even){background-color:#f5f5f5}.order-create-section-title{margin-left:-15px;text-transform:uppercase}.order-create-section-items{margin-left:-45px;width:102%}.order-detail-button a{color:#83d01b}.order-detail-container{min-height:70vh;padding-top:40px;margin-bottom:30px}.order-detail-container .table tbody tr:first-child td{border-top:none}.order-detail-container .table tr{border-bottom:none}.order-detail-section{margin-top:50px}.order-detail-container .table{margin-left:-7px}.order-section-total{margin-bottom:5px;margin-left:40px;text-align:left}.fr{float:right!important}.down-arrow{background-image:url('../images/arrow-down.png');height:7px;width:10px;display:inline-block;margin-left:20px}.logout-icon{background-image:url('../images/logout.PNG');display:inline-block;height:19px;width:19px;margin-left:15px}.myorders-icon{background-image:url('../images/my_orders.PNG');display:inline-block;height:20px;width:20px;margin-left:15px}.login-user{position:absolute!important;top:30px;right:65px;cursor:pointer}.login-user-dropdown{position:relative;display:inline-block}.login-user-dropdown-content{display:none;position:absolute;background-color:#fff;min-width:160px;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);right:0}.login-user-dropdown-content a{color:#000;padding:12px 16px;text-decoration:none;display:block;text-align:right;text-transform:uppercase}.login-user:hover .login-user-dropdown-content{display:block}.down-arrow:hover>.login-user-dropdown-content{display:block}.login-user-dropdown-content a:hover{color:#83d01b}.es-header{min-height:80px!important}.es-pager-bottom{margin-top:40px}.es-pager-top{margin-bottom:20px;margin-top:20px}.es-pager-top ul{list-style:none}.es-pager-bottom ul{list-style:none}.page-item{cursor:pointer}.next{position:absolute;right:15px;top:0}.previous{position:absolute;left:0;top:0}.is-disabled{cursor:not-allowed;opacity:.5;pointer-events:none}.table tr{border-bottom:1px solid #ddd}.table th{text-transform:uppercase}.navbar-nav{margin-top:10px;margin-bottom:7.5px;margin-right:-10px;float:right}@media screen and (max-width:1195px){.cart-product-column-name{display:none}}@media screen and (max-width:767px){.carousel-caption{display:none}footer .text{text-align:left;margin-top:-15px}.cart-product-column-brand{display:none}}@media screen and (min-width:992px){.form-input{width:360px;max-width:360px}}@media screen and (max-width:415px){.account-login-container{margin-left:-50px}.page-consent{margin-left:10px;margin-right:80px;padding-right:0;padding-left:0}} \ No newline at end of file +body{margin-top:65px}.navbar-header{position:relative;top:-4px}.navbar-brand>.icon-banner{position:relative;top:-2px;display:inline}.icon{position:relative;top:-10px}.page-consent .client-logo{float:left}.page-consent .client-logo img{width:80px;height:80px}.page-consent .consent-buttons{margin-top:25px}.page-consent .consent-form .consent-scopecheck{display:inline-block;margin-right:5px}.page-consent .consent-form .consent-description{margin-left:25px}.page-consent .consent-form .consent-description label{font-weight:normal}.page-consent .consent-form .consent-remember{padding-left:16px}@font-face{font-family:Montserrat;font-weight:400;src:url("../fonts/Montserrat-Regular.eot?") format("eot"),url("../fonts/Montserrat-Regular.woff") format("woff"),url("../fonts/Montserrat-Regular.ttf") format("truetype"),url("../fonts/Montserrat-Regular.svg#Montserrat") format("svg")}@font-face{font-family:Montserrat;font-weight:700;src:url("../fonts/Montserrat-Bold.eot?") format("eot"),url("../fonts/Montserrat-Bold.woff") format("woff"),url("../fonts/Montserrat-Bold.ttf") format("truetype"),url("../fonts/Montserrat-Bold.svg#Montserrat") format("svg")}body{font-family:Montserrat,sans-serif;min-width:480px}.mt-15{margin-top:15px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.select-filter{background-color:transparent;padding:10px;margin:10px;margin-right:20px;color:#fff;padding-top:20px;padding-bottom:3px;min-width:140px;border-color:#37c7ca;max-height:43px;-webkit-appearance:none}.select-filter option{background-color:#00a69c}select::-ms-expand{display:none}.select-filter-wrapper{z-index:0;display:inline-block;margin-left:-10px}.select-filter-wrapper::before{content:attr(data-name);opacity:.5;z-index:1;text-transform:uppercase;position:absolute;font-size:10px;margin-top:15px;margin-left:21px;color:#fff}.select-filter-arrow{position:absolute;margin-left:130px;margin-top:40px}.btn-brand-small-filter{margin-top:10px;position:absolute;margin-left:15px}.carousel-caption p{font-size:20px;line-height:1.4}.layout-cart-image{height:36px;margin-top:5px}.layout-cart-badge{position:absolute;margin-top:2px;margin-left:14px;background-color:#83d01b;padding:1px;color:#fff;border-radius:50%;width:18px;height:18px;font-size:12px;cursor:pointer}.btn-bracketed:hover:before{display:inline-block;content:"[";padding-right:.5em;color:#7fff00}.btn-bracketed:hover:after{display:inline-block;content:"]";padding-left:.5em;color:#7fff00}.btn-brand{background-color:#83d01b;color:#fff;padding:10px 20px 10px 20px;border-radius:0;border:none;width:255px;display:inline-block;text-align:center;text-transform:uppercase;height:45px;font-size:16px;font-weight:normal}.btn-brand::before{content:'['}.btn-brand::after{content:']'}.btn-brand:hover:before{padding-right:5px}.btn-brand:hover:after{padding-left:5px}.btn-brand-big{width:360px;margin-top:20px}.btn-brand-small{width:45px}.btn-brand-small::before{content:''}.btn-brand-small::after{content:''}.btn-brand-small:hover:before{content:'';padding:0}.btn-brand-small:hover:after{content:'';padding:0}.btn-brand-dark{background-color:#00a69c}.btn-brand:hover{color:#fff;background-color:#83d01b;text-decoration:none}.btn-brand-dark:hover{background-color:#00a69c}.btn-cart{float:right;margin-top:40px;margin-bottom:40px}.btn-catalog-apply{padding:0}.form-label{text-transform:uppercase;font-weight:normal!important;text-align:left;margin-bottom:10px !important;color:#404040}.form-input{border-radius:0;padding:10px;height:45px}.form-input-small{max-width:100px!important}.form-select{border-radius:0;padding:10px;height:45px;width:150px}.carousel-inner .item img[src$=".svg"]{width:100%}.navbar-inverse{background-color:#fff;border-color:#fff}.btn-login{border:1px solid #00a69c;height:36px!important;margin-right:10px;margin-top:10px;background-color:#fff;color:#00a69c;text-transform:uppercase;max-width:140px;width:140px;padding-top:8px!important}.btn-login{font-weight:normal!important}.btn-login::before{content:'['}.btn-login::after{content:']'}.btn-login:hover:before{content:'[ '}.btn-login:hover:after{content:' ]'}.navbar-inverse li a{height:30px;padding:5px 20px;color:#00a69c !important}.navbar-brand{margin-top:20px;background-image:url(../images/brand.PNG);width:201px;height:44px;margin-left:0 !important}.nav>li>a{color:#fff}.nav>li>a:hover,.nav>li>a:focus{background-color:#00a69c;font-weight:bolder}.container-fluid{padding-left:0;padding-right:0}.home-banner{width:100%;margin-right:0;margin-left:0;background-image:url(../images/main_banner.png);background-size:cover;height:258px;background-position:center}.home-banner-text{margin-top:70px}.home-catalog-container{min-height:400px;margin-bottom:20px}.home-catalog-filter-container{background-color:#00a69c;height:63px;line-height:76px}.home-catalog-filter-container li a{padding-top:5px !important}.home-catalog-filter-brands::before{content:'BRAND';color:#fff;font-size:x-small;opacity:.5;margin:10px 0 0 15px}.home-catalog-filter-types::before{content:'TYPES';color:#fff;font-size:x-small;opacity:.5;margin:10px 0 0 15px}.home-catalog-item{margin-top:10px;margin-bottom:10px}.home-catalog-item-image{width:100%;object-fit:cover;text-align:center}.home-catalog-item-image-addCart{background-color:#83d01b;color:#fff;display:inline-block;height:43px;padding:10px 20px 10px 20px;font-weight:bold;text-align:center;margin-top:10px;margin-left:60px;margin-right:60px;font-size:16px;font-weight:normal}.home-catalog-item-image-addCart:hover{color:#fff;text-decoration:none}.home-catalog-item-image:hover:after{cursor:pointer}.home-catalog-item-title{text-align:center;text-transform:uppercase;font-weight:300;font-size:16px;margin-top:20px}.home-catalog-item-price{text-align:center;font-weight:900;font-size:28px}.home-catalog-item-price::before{content:'$'}.home-catalog-noResults{text-align:center;margin-top:100px}.container .nav .navbar-nav .col-sm-6 ::before{content:'BRAND'}.validation-summary-errors li{list-style:none}footer{background-color:#000;height:150px;vertical-align:middle}footer .brand{margin-top:25px;background-image:url(../images/brand_dark.PNG);max-width:231px;height:52px;margin-left:0 !important}footer .text{margin-top:55px}.text{color:#83d01b}.text:hover{color:#83d01b}form .col-md-4{text-align:right}.brand-header-block{background-color:#00a69c;height:63px}.brand-header-block li{list-style:none;display:inline;opacity:.5;margin-top:25px;margin-left:10px;cursor:pointer;color:#fff}.brand-header-block li a{color:#fff}.brand-header-block li a:hover{text-decoration:none}.brand-header-block .active{opacity:1}.brand-header-block .active::before{content:'[ ';color:#adff2f}.brand-header-block .active::after{content:' ]';color:#adff2f}.brand-header-back{float:left!important;margin-top:20px!important;text-transform:uppercase}.account-login-container{min-height:70vh;text-align:center;padding-top:40px}.account-register-container{min-height:70vh;text-align:center !important;align-content:center}.cart-index-container{min-height:70vh;padding-top:40px;margin-bottom:30px;min-width:992px}.register-container{min-height:70vh;padding-top:40px;margin-bottom:30px;padding-left:30px}.order-create-container{min-height:70vh;padding-top:40px;margin-bottom:30px;padding-left:30px;min-width:995px}.cart-product-column{max-width:120px;text-transform:uppercase;vertical-align:middle!important}.order-create-container .cart-product-column{max-width:130px}.cart-product-column-name{width:220px}.cart-subtotal-label{font-size:12px;color:#404040;margin-top:10px}.cart-subtotal-value{font-size:20px;color:#00a69c}.cart-total-label{font-size:14px;color:#404040;margin-top:10px}.cart-total-value{font-size:28px;color:#00a69c;text-align:left}.cart-product-image{max-width:210px}.cart-section-total{margin-bottom:5px;margin-left:175px;text-align:left}.cart-product-column input{width:70px;text-align:center}.cart-refresh-button{margin-top:0;background-image:url('../images/refresh.svg');color:#fff;font-size:8px;width:40px;height:40px;background-color:transparent;border:none;margin-top:25px;margin-left:15px}.cart-refresh-button:hover{background-color:transparent}.cart-totals{border-bottom:none!important}.input-validation-error{border:1px solid #fb0d0d}.text-danger{color:#fb0d0d;font-size:12px}.cart{border:none !important}.form-horizontal h4{margin-top:30px}.form-horizontal .form-group{margin-right:0!important}.form-control:focus{border-color:#83d01b}.form-input-center{margin:auto}.order-index-container{min-height:70vh;padding-top:40px;margin-bottom:30px}.order-index-container .table tbody tr{border-bottom:none}.order-index-container .table tbody tr td{border-top:none;padding-top:10px;padding-bottom:10px}.order-index-container .table tbody tr:nth-child(even){background-color:#f5f5f5}.order-create-section-title{margin-left:-15px;text-transform:uppercase}.order-create-section-items{margin-left:-45px;width:102%}.order-detail-button a{color:#83d01b}.order-detail-container{min-height:70vh;padding-top:40px;margin-bottom:30px}.order-detail-container .table tbody tr:first-child td{border-top:none}.order-detail-container .table tr{border-bottom:none}.order-detail-section{margin-top:50px}.order-detail-container .table{margin-left:-7px}.order-section-total{margin-bottom:5px;margin-left:40px;text-align:left}.fr{float:right!important}.down-arrow{background-image:url('../images/arrow-down.png');height:7px;width:10px;display:inline-block;margin-left:20px}.logout-icon{background-image:url('../images/logout.PNG');display:inline-block;height:19px;width:19px;margin-left:15px}.myorders-icon{background-image:url('../images/my_orders.PNG');display:inline-block;height:20px;width:20px;margin-left:15px}.login-user{position:absolute!important;top:30px;right:65px;cursor:pointer}.login-user-dropdown{position:relative;display:inline-block}.login-user-dropdown-content{display:none;position:absolute;background-color:#fff;min-width:160px;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);right:0}.login-user-dropdown-content a{color:#000;padding:12px 16px;text-decoration:none;display:block;text-align:right;text-transform:uppercase}.login-user:hover .login-user-dropdown-content{display:block}.down-arrow:hover>.login-user-dropdown-content{display:block}.login-user-dropdown-content a:hover{color:#83d01b}.es-header{min-height:80px!important}.es-pager-bottom{margin-top:40px}.es-pager-top{margin-bottom:20px;margin-top:20px}.es-pager-top ul{list-style:none}.es-pager-bottom ul{list-style:none}.page-item{cursor:pointer}.next{position:absolute;right:15px;top:0}.previous{position:absolute;left:0;top:0}.is-disabled{cursor:not-allowed;opacity:.5;pointer-events:none}.table tr{border-bottom:1px solid #ddd}.table th{text-transform:uppercase}.navbar-nav{margin-top:10px;margin-bottom:7.5px;margin-right:-10px;float:right}@media screen and (max-width:1195px){.cart-product-column-name{display:none}}@media screen and (max-width:767px){.carousel-caption{display:none}footer .text{text-align:left;margin-top:-15px}.cart-product-column-brand{display:none}}@media screen and (min-width:992px){.form-input{width:360px;max-width:360px}}@media screen and (max-width:415px){.account-login-container{margin-left:-50px}.page-consent{margin-left:10px;margin-right:80px;padding-right:0;padding-left:0}} \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/wwwroot/images/brand.PNG b/src/Services/Identity/Identity.API/wwwroot/images/brand.PNG index 2afd3dccf..4f7b8a84b 100644 Binary files a/src/Services/Identity/Identity.API/wwwroot/images/brand.PNG and b/src/Services/Identity/Identity.API/wwwroot/images/brand.PNG differ diff --git a/src/Services/Identity/Identity.API/wwwroot/images/brand_dark.PNG b/src/Services/Identity/Identity.API/wwwroot/images/brand_dark.PNG index 44a65364f..04626dcf4 100644 Binary files a/src/Services/Identity/Identity.API/wwwroot/images/brand_dark.PNG and b/src/Services/Identity/Identity.API/wwwroot/images/brand_dark.PNG differ diff --git a/src/Services/Identity/Identity.API/wwwroot/images/logout.PNG b/src/Services/Identity/Identity.API/wwwroot/images/logout.PNG index 9915b9862..d7c4ef140 100644 Binary files a/src/Services/Identity/Identity.API/wwwroot/images/logout.PNG and b/src/Services/Identity/Identity.API/wwwroot/images/logout.PNG differ diff --git a/src/Services/Identity/Identity.API/wwwroot/images/main_footer_text.PNG b/src/Services/Identity/Identity.API/wwwroot/images/main_footer_text.PNG new file mode 100644 index 000000000..d8f90a201 Binary files /dev/null and b/src/Services/Identity/Identity.API/wwwroot/images/main_footer_text.PNG differ diff --git a/src/Services/Identity/Identity.API/wwwroot/images/my_orders.PNG b/src/Services/Identity/Identity.API/wwwroot/images/my_orders.PNG index 145be925b..9ee5f60e7 100644 Binary files a/src/Services/Identity/Identity.API/wwwroot/images/my_orders.PNG and b/src/Services/Identity/Identity.API/wwwroot/images/my_orders.PNG differ diff --git a/src/Services/Location/Locations.API/Controllers/LocationsController.cs b/src/Services/Location/Locations.API/Controllers/LocationsController.cs index a6cb8bdad..a61c7f2d0 100644 --- a/src/Services/Location/Locations.API/Controllers/LocationsController.cs +++ b/src/Services/Location/Locations.API/Controllers/LocationsController.cs @@ -46,7 +46,7 @@ namespace Locations.API.Controllers var location = await _locationsService.GetLocation(locationId); return Ok(location); } - + //POST api/v1/[controller]/ [Route("")] [HttpPost] diff --git a/src/Services/Location/Locations.API/Dockerfile b/src/Services/Location/Locations.API/Dockerfile index 3d00f01a9..2e5a500b6 100644 --- a/src/Services/Location/Locations.API/Dockerfile +++ b/src/Services/Location/Locations.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1 +FROM microsoft/aspnetcore:1.1.2 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/Location/Locations.API/Dockerfile.nanowin b/src/Services/Location/Locations.API/Dockerfile.nanowin new file mode 100644 index 000000000..9c664f4e4 --- /dev/null +++ b/src/Services/Location/Locations.API/Dockerfile.nanowin @@ -0,0 +1,8 @@ +FROM microsoft/dotnet:1.1-runtime-nanoserver +SHELL ["powershell"] +ARG source +WORKDIR /app +RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord +EXPOSE 80 +COPY ${source:-obj/Docker/publish} . +ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/Location/Locations.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs b/src/Services/Location/Locations.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs new file mode 100644 index 000000000..8eccc83cf --- /dev/null +++ b/src/Services/Location/Locations.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs @@ -0,0 +1,31 @@ + +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters +{ + internal class AuthorizeCheckOperationFilter : IOperationFilter + { + public void Apply(Operation operation, OperationFilterContext context) + { + // Check for authorize attribute + var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType().Any() || + context.ApiDescription.ActionAttributes().OfType().Any(); + + if (hasAuthorize) + { + operation.Responses.Add("401", new Response { Description = "Unauthorized" }); + operation.Responses.Add("403", new Response { Description = "Forbidden" }); + + operation.Security = new List>>(); + operation.Security.Add(new Dictionary> + { + { "oauth2", new [] { "locationsapi" } } + }); + } + } + } +} diff --git a/src/Services/Location/Locations.API/Infrastructure/Repositories/LocationsRepository.cs b/src/Services/Location/Locations.API/Infrastructure/Repositories/LocationsRepository.cs index 47d443718..9f8d42ad4 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Repositories/LocationsRepository.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Repositories/LocationsRepository.cs @@ -1,6 +1,5 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories { - using Microsoft.EntityFrameworkCore; using Microsoft.eShopOnContainers.Services.Locations.API.Model; using Microsoft.Extensions.Options; using MongoDB.Bson; diff --git a/src/Services/Location/Locations.API/Infrastructure/Services/IIdentityService.cs b/src/Services/Location/Locations.API/Infrastructure/Services/IIdentityService.cs index d49abe111..a2b79d8d1 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Services/IIdentityService.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Services/IIdentityService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services +namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services { public interface IIdentityService { diff --git a/src/Services/Location/Locations.API/Infrastructure/Services/IdentityService.cs b/src/Services/Location/Locations.API/Infrastructure/Services/IdentityService.cs index bcb7a84f8..d06b44a4f 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Services/IdentityService.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Services/IdentityService.cs @@ -1,14 +1,11 @@ using Microsoft.AspNetCore.Http; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services { public class IdentityService : IIdentityService { - private IHttpContextAccessor _context; + private readonly IHttpContextAccessor _context; public IdentityService(IHttpContextAccessor context) { diff --git a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs index 4b88e1927..81bc16489 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs @@ -1,15 +1,14 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services { - using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories; - using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel; - using Microsoft.eShopOnContainers.Services.Locations.API.Model; - using System; - using System.Threading.Tasks; - using System.Linq; - using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions; - using System.Collections.Generic; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; + using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions; + using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories; + using Microsoft.eShopOnContainers.Services.Locations.API.Model; + using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel; + using System; + using System.Collections.Generic; + using System.Threading.Tasks; public class LocationsService : ILocationsService { diff --git a/src/Services/Location/Locations.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs b/src/Services/Location/Locations.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs index d4112a54d..7c3e72769 100644 --- a/src/Services/Location/Locations.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs +++ b/src/Services/Location/Locations.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs @@ -1,13 +1,13 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events { + using Locations.API.Model; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; - using Microsoft.eShopOnContainers.Services.Locations.API.Model; using System.Collections.Generic; public class UserLocationUpdatedIntegrationEvent : IntegrationEvent { - public string UserId { get; private set; } - public List LocationList { get; private set; } + public string UserId { get; set; } + public List LocationList { get; set; } public UserLocationUpdatedIntegrationEvent(string userId, List locationList) { diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index b9ef671dc..e43a12dcc 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -40,7 +40,10 @@ + + + diff --git a/src/Services/Location/Locations.API/Model/UserLocationDetails.cs b/src/Services/Location/Locations.API/Model/UserLocationDetails.cs index 6e152fe1b..7983e8e59 100644 --- a/src/Services/Location/Locations.API/Model/UserLocationDetails.cs +++ b/src/Services/Location/Locations.API/Model/UserLocationDetails.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Services.Locations.API.Model +namespace Microsoft.eShopOnContainers.Services.Locations.API.Model { public class UserLocationDetails { @@ -11,4 +6,4 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Model public string Code { get; set; } public string Description { get; set; } } -} +} \ No newline at end of file diff --git a/src/Services/Location/Locations.API/Program.cs b/src/Services/Location/Locations.API/Program.cs index 345956401..db2a5532a 100644 --- a/src/Services/Location/Locations.API/Program.cs +++ b/src/Services/Location/Locations.API/Program.cs @@ -14,6 +14,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API { var host = new WebHostBuilder() .UseKestrel() + .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .UseApplicationInsights() diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index f767f227b..34fd8cb75 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -16,6 +16,12 @@ using Microsoft.Extensions.Logging; using RabbitMQ.Client; using System.Reflection; using System; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; +using Microsoft.Azure.ServiceBus; +using System.Collections.Generic; +using Swashbuckle.AspNetCore.Swagger; +using Microsoft.Extensions.HealthChecks; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Locations.API { @@ -51,19 +57,39 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API services.Configure(Configuration); - services.AddSingleton(sp => + if (Configuration.GetValue("AzureServiceBusEnabled")) { - var logger = sp.GetRequiredService>(); - - var factory = new ConnectionFactory() + services.AddSingleton(sp => { - HostName = Configuration["EventBusConnection"] - }; + var logger = sp.GetRequiredService>(); - return new DefaultRabbitMQPersistentConnection(factory, logger); + var serviceBusConnectionString = Configuration["EventBusConnection"]; + var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); + + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => + { + var logger = sp.GetRequiredService>(); + + var factory = new ConnectionFactory + { + HostName = Configuration["EventBusConnection"] + }; + + return new DefaultRabbitMQPersistentConnection(factory, logger); + }); + } + + services.AddHealthChecks(checks => + { + checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok"))); }); - RegisterServiceBus(services); + RegisterEventBus(services); // Add framework services. services.AddSwaggerGen(options => @@ -76,6 +102,21 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API Description = "The Location Microservice HTTP API. This is a Data-Driven/CRUD microservice sample", TermsOfService = "Terms Of Service" }); + + options.AddSecurityDefinition("oauth2", new OAuth2Scheme + { + Type = "oauth2", + Flow = "implicit", + AuthorizationUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/authorize", + TokenUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/token", + Scopes = new Dictionary() + { + { "locations", "Locations API" } + } + }); + + options.OperationFilter(); + }); services.AddCors(options => @@ -117,6 +158,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API .UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + c.ConfigureOAuth2("locationsswaggerui", "", "", "Locations Swagger UI"); }); LocationsContextSeed.SeedAsync(app, loggerFactory) @@ -134,10 +176,28 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API }); } - private void RegisterServiceBus(IServiceCollection services) + private void RegisterEventBus(IServiceCollection services) { - services.AddSingleton(); + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; + + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + } + else + { + services.AddSingleton(); + } + services.AddSingleton(); - } + } } } diff --git a/src/Services/Location/Locations.API/appsettings.json b/src/Services/Location/Locations.API/appsettings.json index a280150a3..511bb5c6a 100644 --- a/src/Services/Location/Locations.API/appsettings.json +++ b/src/Services/Location/Locations.API/appsettings.json @@ -9,5 +9,7 @@ "System": "Information", "Microsoft": "Information" } - } + }, + "AzureServiceBusEnabled": false, + "SubscriptionClientName": "Locations" } \ No newline at end of file diff --git a/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/function.json b/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/function.json new file mode 100644 index 000000000..70b31994a --- /dev/null +++ b/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/function.json @@ -0,0 +1,16 @@ +{ + "bindings": [ + { + "authLevel": "function", + "name": "req", + "type": "httpTrigger", + "direction": "in" + }, + { + "name": "$return", + "type": "http", + "direction": "out" + } + ], + "disabled": false +} \ No newline at end of file diff --git a/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/project.json b/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/project.json new file mode 100644 index 000000000..97c3bba09 --- /dev/null +++ b/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/project.json @@ -0,0 +1,21 @@ +{ + + "frameworks": { + + "net46":{ + + "dependencies": { + + "Dapper": "1.50.2", + + "System.Data.SqlClient":"4.1.0", + + "Microsoft.WindowsAzure.ConfigurationManager":"3.2.1" + + } + + } + + } + +} \ No newline at end of file diff --git a/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/run.csx b/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/run.csx new file mode 100644 index 000000000..9ca9b5a3b --- /dev/null +++ b/src/Services/Marketing/Infrastructure/AzureFunctions/MarketingDetailsHttpTrigger/run.csx @@ -0,0 +1,91 @@ +using System.Net; +using System.Net.Http.Headers; +using System.Configuration; +using Dapper; +using System.Data.SqlClient; + +public static async Task Run(HttpRequestMessage req, TraceWriter log) +{ + log.Info($"Campaign HTTP trigger function processed a request. RequestUri={req.RequestUri}"); + + string htmlResponse = string.Empty; + + // parse query parameter + string campaignId = req.GetQueryNameValuePairs() + .FirstOrDefault(q => string.Compare(q.Key, "campaignId", true) == 0) + .Value; + + string userId = req.GetQueryNameValuePairs() + .FirstOrDefault(q => string.Compare(q.Key, "userId", true) == 0) + .Value; + + var cnnString = ConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString; + + using (var conn = new SqlConnection(cnnString)) + { + await conn.OpenAsync(); + var sql = "SELECT * FROM [dbo].[Campaign] WHERE Id = @CampaignId;"; + var campaign = (await conn.QueryAsync(sql, new { CampaignId = campaignId })).FirstOrDefault(); + htmlResponse = BuildHtmlResponse(campaign); + } + + var response = new HttpResponseMessage(HttpStatusCode.OK); + response.Content = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes(htmlResponse)); + response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); + + return response; +} + +private static string BuildHtmlResponse(Campaign campaign) +{ + var marketingStorageUri = ConfigurationManager.AppSettings["MarketingStorageUri"]; + + return string.Format(@" + + + + +
+ Campaign Details +
+ +
+
+
+
+ Card image cap +
+

{1}

+

{2}

+ +
+
+
+
+ + ", + $"{marketingStorageUri}{campaign.PictureName}", + campaign.Name, + campaign.Description, + campaign.From.ToString("MMMM dd, yyyy"), + campaign.From.ToString("MMMM dd, yyyy")); +} + +public class Campaign +{ + public int Id { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + + public DateTime From { get; set; } + + public DateTime To { get; set; } + + public string PictureUri { get; set; } + + public string PictureName { get; set; } +} diff --git a/src/Services/Marketing/Infrastructure/AzureFunctions/host.json b/src/Services/Marketing/Infrastructure/AzureFunctions/host.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/src/Services/Marketing/Infrastructure/AzureFunctions/host.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/Services/Marketing/Infrastructure/AzureFunctions/local.settings.json b/src/Services/Marketing/Infrastructure/AzureFunctions/local.settings.json new file mode 100644 index 000000000..92d59f7e2 --- /dev/null +++ b/src/Services/Marketing/Infrastructure/AzureFunctions/local.settings.json @@ -0,0 +1,17 @@ +{ + "IsEncrypted": false, + "Value": { + "APPSETTING_FUNCTIONS_EXTENSION_VERSION": "~1", + "APPSETTING_ScmType": "None", + "APPSETTING_WEBSITE_AUTH_ENABLED": "False", + "APPSETTING_REMOTEDEBUGGINGVERSION": "11.0.611103.400", + "APPSETTING_AzureWebJobsDashboard": "", + "APPSETTING_MarketingStorageUri": "", + "APPSETTING_WEBSITE_NODE_DEFAULT_VERSION": "6.5.0", + "APPSETTING_WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "", + "APPSETTING_WEBSITE_CONTENTSHARE": "", + "APPSETTING_WEBSITE_SLOT_NAME": "", + "APPSETTING_AzureWebJobsStorage": "", + "APPSETTING_WEBSITE_SITE_NAME": "" + } +} \ No newline at end of file diff --git a/src/Services/Marketing/Infrastructure/AzureFunctions/marketing-functions.csproj b/src/Services/Marketing/Infrastructure/AzureFunctions/marketing-functions.csproj new file mode 100644 index 000000000..e159feb69 --- /dev/null +++ b/src/Services/Marketing/Infrastructure/AzureFunctions/marketing-functions.csproj @@ -0,0 +1,33 @@ + + + net461 + + + + + + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + diff --git a/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs b/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs index 9b8526a93..146802626 100644 --- a/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs +++ b/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs @@ -1,4 +1,4 @@ -using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services; +using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Services; namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers { @@ -15,6 +15,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers using AspNetCore.Authorization; using Extensions.Options; using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel; + using Microsoft.AspNetCore.Http; [Route("api/v1/[controller]")] [Authorize] @@ -182,15 +183,23 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers private CampaignDTO MapCampaignModelToDto(Campaign campaign) { - return new CampaignDTO + var userId = _identityService.GetUserIdentity(); + var dto = new CampaignDTO { Id = campaign.Id, Name = campaign.Name, Description = campaign.Description, From = campaign.From, To = campaign.To, - PictureUri = GetUriPlaceholder(campaign.PictureUri) + PictureUri = GetUriPlaceholder(campaign), }; + + if (!string.IsNullOrEmpty(_settings.CampaignDetailFunctionUri)) + { + dto.DetailsUri = $"{_settings.CampaignDetailFunctionUri}&campaignId={campaign.Id}&userId={userId}"; + } + + return dto; } private Campaign MapCampaignDtoToModel(CampaignDTO campaignDto) @@ -206,13 +215,13 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers }; } - private string GetUriPlaceholder(string campaignUri) + private string GetUriPlaceholder(Campaign campaign) { - var baseUri = _settings.ExternalCatalogBaseUrl; + var baseUri = _settings.PicBaseUrl; - campaignUri = campaignUri.Replace("http://externalcatalogbaseurltobereplaced", baseUri); - - return campaignUri; + return _settings.AzureStorageEnabled + ? baseUri + campaign.PictureName + : baseUri.Replace("[0]", campaign.Id.ToString()); } } } \ No newline at end of file diff --git a/src/Services/Marketing/Marketing.API/Dockerfile.nanowin b/src/Services/Marketing/Marketing.API/Dockerfile.nanowin new file mode 100644 index 000000000..9c664f4e4 --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Dockerfile.nanowin @@ -0,0 +1,8 @@ +FROM microsoft/dotnet:1.1-runtime-nanoserver +SHELL ["powershell"] +ARG source +WORKDIR /app +RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord +EXPOSE 80 +COPY ${source:-obj/Docker/publish} . +ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/Marketing/Marketing.API/Dto/CampaignDTO.cs b/src/Services/Marketing/Marketing.API/Dto/CampaignDTO.cs index 829011ce5..3c409c8a9 100644 --- a/src/Services/Marketing/Marketing.API/Dto/CampaignDTO.cs +++ b/src/Services/Marketing/Marketing.API/Dto/CampaignDTO.cs @@ -15,5 +15,6 @@ public DateTime To { get; set; } public string PictureUri { get; set; } + public string DetailsUri { get; set; } } } \ No newline at end of file diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs b/src/Services/Marketing/Marketing.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs new file mode 100644 index 000000000..d1540ba3a --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filters +{ + public class AuthorizeCheckOperationFilter : IOperationFilter + { + public void Apply(Operation operation, OperationFilterContext context) + { + // Check for authorize attribute + var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType().Any() || + context.ApiDescription.ActionAttributes().OfType().Any(); + + if (hasAuthorize) + { + operation.Responses.Add("401", new Response { Description = "Unauthorized" }); + operation.Responses.Add("403", new Response { Description = "Forbidden" }); + + operation.Security = new List>>(); + operation.Security.Add(new Dictionary> + { + { "oauth2", new [] { "marketingapi" } } + }); + } + } + } +} \ No newline at end of file diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs index fc8c02b4c..ecb3f3c80 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs @@ -38,6 +38,7 @@ From = DateTime.Now, To = DateTime.Now.AddDays(7), PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/1/pic", + PictureName = "1.png", Rules = new List { new UserLocationRule @@ -54,6 +55,7 @@ From = DateTime.Now.AddDays(-7), To = DateTime.Now.AddDays(14), PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/2/pic", + PictureName = "2.png", Rules = new List { new UserLocationRule diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170629102516_added-campaign-details.Designer.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170629102516_added-campaign-details.Designer.cs new file mode 100644 index 000000000..342d1d02f --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170629102516_added-campaign-details.Designer.cs @@ -0,0 +1,121 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure; + +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations +{ + [DbContext(typeof(MarketingContext))] + [Migration("20170629102516_added-campaign-details")] + partial class addedcampaigndetails + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "1.1.2") + .HasAnnotation("SqlServer:Sequence:.campaign_hilo", "'campaign_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:Sequence:.rule_hilo", "'rule_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "campaign_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Description") + .IsRequired() + .HasColumnName("Description"); + + b.Property("DetailsUri"); + + b.Property("From") + .HasColumnName("From"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name"); + + b.Property("PictureName"); + + b.Property("PictureUri") + .IsRequired() + .HasColumnName("PictureUri"); + + b.Property("To") + .HasColumnName("To"); + + b.HasKey("Id"); + + b.ToTable("Campaign"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "rule_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("CampaignId"); + + b.Property("Description") + .IsRequired() + .HasColumnName("Description"); + + b.Property("RuleTypeId"); + + b.HasKey("Id"); + + b.HasIndex("CampaignId"); + + b.ToTable("Rule"); + + b.HasDiscriminator("RuleTypeId"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.PurchaseHistoryRule", b => + { + b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule"); + + + b.ToTable("PurchaseHistoryRule"); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.UserLocationRule", b => + { + b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule"); + + b.Property("LocationId") + .HasColumnName("LocationId"); + + b.ToTable("UserLocationRule"); + + b.HasDiscriminator().HasValue(3); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.UserProfileRule", b => + { + b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule"); + + + b.ToTable("UserProfileRule"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", "Campaign") + .WithMany("Rules") + .HasForeignKey("CampaignId") + .OnDelete(DeleteBehavior.Cascade); + }); + } + } +} diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170629102516_added-campaign-details.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170629102516_added-campaign-details.cs new file mode 100644 index 000000000..9d6ddf399 --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/20170629102516_added-campaign-details.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations +{ + public partial class addedcampaigndetails : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DetailsUri", + table: "Campaign", + nullable: true); + + migrationBuilder.AddColumn( + name: "PictureName", + table: "Campaign", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DetailsUri", + table: "Campaign"); + + migrationBuilder.DropColumn( + name: "PictureName", + table: "Campaign"); + } + } +} diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/MarketingContextModelSnapshot.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/MarketingContextModelSnapshot.cs index bcac40659..3866a63ab 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/MarketingContextModelSnapshot.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingMigrations/MarketingContextModelSnapshot.cs @@ -29,6 +29,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark .IsRequired() .HasColumnName("Description"); + b.Property("DetailsUri"); + b.Property("From") .HasColumnName("From"); @@ -36,6 +38,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark .IsRequired() .HasColumnName("Name"); + b.Property("PictureName"); + b.Property("PictureUri") .IsRequired() .HasColumnName("PictureUri"); diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/Services/IIdentityService.cs b/src/Services/Marketing/Marketing.API/Infrastructure/Services/IIdentityService.cs index d49abe111..42df49ebc 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/Services/IIdentityService.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/Services/IIdentityService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Services { public interface IIdentityService { diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/Services/IdentityService.cs b/src/Services/Marketing/Marketing.API/Infrastructure/Services/IdentityService.cs index bcb7a84f8..82ce214be 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/Services/IdentityService.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/Services/IdentityService.cs @@ -1,11 +1,8 @@ -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Services { + using AspNetCore.Http; + using System; + public class IdentityService : IIdentityService { private IHttpContextAccessor _context; @@ -20,4 +17,4 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Serv return _context.HttpContext.User.FindFirst("sub").Value; } } -} +} \ No newline at end of file diff --git a/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs b/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs index a7ab0cafd..f894d903f 100644 --- a/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs +++ b/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs @@ -1,13 +1,13 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.IntegrationEvents.Events { - using Model; + using Marketing.API.Model; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using System.Collections.Generic; - using BuildingBlocks.EventBus.Events; public class UserLocationUpdatedIntegrationEvent : IntegrationEvent { - public string UserId { get; private set; } - public List LocationList { get; private set; } + public string UserId { get; set; } + public List LocationList { get; set; } public UserLocationUpdatedIntegrationEvent(string userId, List locationList) { diff --git a/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs b/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs index 7879c3d96..5393608a0 100644 --- a/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs +++ b/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs @@ -1,12 +1,13 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.IntegrationEvents.Handlers { - using BuildingBlocks.EventBus.Abstractions; - using System.Threading.Tasks; - using Events; + using Marketing.API.IntegrationEvents.Events; + using Marketing.API.Model; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; + using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Repositories; + using Microsoft.eShopOnContainers.Services.Marketing.API.Model; using System; - using Infrastructure.Repositories; - using Model; using System.Collections.Generic; + using System.Threading.Tasks; public class UserLocationUpdatedIntegrationEventHandler : IIntegrationEventHandler diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index 4a6e2d4ea..1582a239f 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -56,6 +56,10 @@ + + + + diff --git a/src/Services/Marketing/Marketing.API/MarketingSettings.cs b/src/Services/Marketing/Marketing.API/MarketingSettings.cs index f83200019..20e5d9c44 100644 --- a/src/Services/Marketing/Marketing.API/MarketingSettings.cs +++ b/src/Services/Marketing/Marketing.API/MarketingSettings.cs @@ -6,5 +6,8 @@ public string MongoConnectionString { get; set; } public string MongoDatabase { get; set; } public string ExternalCatalogBaseUrl { get; set; } + public string CampaignDetailFunctionUri { get; set; } + public string PicBaseUrl { get; set; } + public bool AzureStorageEnabled { get; set; } } } diff --git a/src/Services/Marketing/Marketing.API/Model/Campaign.cs b/src/Services/Marketing/Marketing.API/Model/Campaign.cs index 51a4c017c..841580427 100644 --- a/src/Services/Marketing/Marketing.API/Model/Campaign.cs +++ b/src/Services/Marketing/Marketing.API/Model/Campaign.cs @@ -15,8 +15,12 @@ public DateTime To { get; set; } + public string PictureName { get; set; } + public string PictureUri { get; set; } + public string DetailsUri { get; set; } + public List Rules { get; set; } diff --git a/src/Services/Marketing/Marketing.API/Program.cs b/src/Services/Marketing/Marketing.API/Program.cs index 2bf3b3d9c..dbde65b27 100644 --- a/src/Services/Marketing/Marketing.API/Program.cs +++ b/src/Services/Marketing/Marketing.API/Program.cs @@ -1,8 +1,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API { using System.IO; - using Microsoft.AspNetCore.Builder; - using Microsoft.AspNetCore.Hosting; + using AspNetCore.Hosting; public class Program { @@ -10,6 +9,7 @@ { var host = new WebHostBuilder() .UseKestrel() + .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .UseWebRoot("Pics") diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index f5f726c62..4c39d9524 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -1,31 +1,35 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services; - -namespace Microsoft.eShopOnContainers.Services.Marketing.API +namespace Microsoft.eShopOnContainers.Services.Marketing.API { - using Microsoft.AspNetCore.Builder; - using Microsoft.AspNetCore.Hosting; - using Microsoft.EntityFrameworkCore.Infrastructure; - using Microsoft.EntityFrameworkCore; - using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.Logging; - using System.Reflection; - using System; - using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filters; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; - using RabbitMQ.Client; - using BuildingBlocks.EventBus.Abstractions; - using BuildingBlocks.EventBus; - using IntegrationEvents.Events; - using IntegrationEvents.Handlers; - using Infrastructure.Repositories; using Autofac; using Autofac.Extensions.DependencyInjection; + using IntegrationEvents.Events; + using AspNetCore.Builder; + using AspNetCore.Hosting; + using AspNetCore.Http; + using Azure.ServiceBus; + using EntityFrameworkCore; + using EntityFrameworkCore.Infrastructure; + using BuildingBlocks.EventBus; + using BuildingBlocks.EventBus.Abstractions; + using BuildingBlocks.EventBusRabbitMQ; + using BuildingBlocks.EventBusServiceBus; + using Infrastructure; + using Infrastructure.Filters; + using Infrastructure.Repositories; + using Infrastructure.Services; + using Extensions.Configuration; + using Extensions.DependencyInjection; + using Extensions.Logging; using Polly; - using System.Threading.Tasks; + using RabbitMQ.Client; + using System; using System.Data.SqlClient; + using System.Reflection; + using System.Threading.Tasks; + using Extensions.HealthChecks; + using Marketing.API.IntegrationEvents.Handlers; + using Swashbuckle.AspNetCore.Swagger; + using System.Collections.Generic; public class Startup { @@ -60,6 +64,18 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API services.Configure(Configuration); + services.AddHealthChecks(checks => + { + checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok"))); + + var accountName = Configuration.GetValue("AzureStorageAccountName"); + var accountKey = Configuration.GetValue("AzureStorageAccountKey"); + if (!string.IsNullOrEmpty(accountName) && !string.IsNullOrEmpty(accountKey)) + { + checks.AddAzureBlobStorageCheck(accountName, accountKey); + } + }); + services.AddDbContext(options => { options.UseSqlServer(Configuration["ConnectionString"], @@ -76,19 +92,32 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API //Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval }); - services.AddSingleton(sp => + if (Configuration.GetValue("AzureServiceBusEnabled")) { - var logger = sp.GetRequiredService>(); - - var factory = new ConnectionFactory() + services.AddSingleton(sp => { - HostName = Configuration["EventBusConnection"] - }; + var logger = sp.GetRequiredService>(); - return new DefaultRabbitMQPersistentConnection(factory, logger); - }); + var serviceBusConnectionString = Configuration["EventBusConnection"]; + var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); - RegisterServiceBus(services); + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => + { + var logger = sp.GetRequiredService>(); + + var factory = new ConnectionFactory() + { + HostName = Configuration["EventBusConnection"] + }; + + return new DefaultRabbitMQPersistentConnection(factory, logger); + }); + } // Add framework services. services.AddSwaggerGen(options => @@ -101,6 +130,20 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API Description = "The Marketing Service HTTP API", TermsOfService = "Terms Of Service" }); + + options.AddSecurityDefinition("oauth2", new OAuth2Scheme + { + Type = "oauth2", + Flow = "implicit", + AuthorizationUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/authorize", + TokenUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/token", + Scopes = new Dictionary() + { + { "marketing", "Marketing API" } + } + }); + + options.OperationFilter(); }); services.AddCors(options => @@ -112,10 +155,14 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API .AllowCredentials()); }); + RegisterEventBus(services); + services.AddTransient(); services.AddSingleton(); services.AddTransient(); + services.AddOptions(); + //configure autofac var container = new ContainerBuilder(); container.Populate(services); @@ -139,7 +186,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API .UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); - }); + c.ConfigureOAuth2("marketingswaggerui", "", "", "Marketing Swagger UI"); + }); var context = (MarketingContext)app .ApplicationServices.GetService(typeof(MarketingContext)); @@ -160,21 +208,35 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API }); } - private void RegisterServiceBus(IServiceCollection services) + private void RegisterEventBus(IServiceCollection services) { - services.AddSingleton(); - services.AddSingleton(); + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; - services.AddTransient, - UserLocationUpdatedIntegrationEventHandler>(); + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + } + else + { + services.AddSingleton(); + } + + services.AddSingleton(); + services.AddTransient(); } private void ConfigureEventBus(IApplicationBuilder app) { var eventBus = app.ApplicationServices.GetRequiredService(); - eventBus.Subscribe>(); + eventBus.Subscribe(); } private async Task WaitForSqlAvailabilityAsync(MarketingContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0) diff --git a/src/Services/Marketing/Marketing.API/appsettings.json b/src/Services/Marketing/Marketing.API/appsettings.json index a05a01836..21aae065a 100644 --- a/src/Services/Marketing/Marketing.API/appsettings.json +++ b/src/Services/Marketing/Marketing.API/appsettings.json @@ -5,9 +5,13 @@ "Default": "Warning" } }, - "ConnectionString": "127.0.0.1", + "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word", "MongoConnectionString": "mongodb://nosql.data", "MongoDatabase": "MarketingDb", "IdentityUrl": "http://localhost:5105", - "ExternalCatalogBaseUrl": "http://localhost:5110" + "PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/", + "AzureServiceBusEnabled": false, + "SubscriptionClientName": "Marketing", + "AzureStorageEnabled": false + } diff --git a/src/Services/Ordering/Ordering.API/Extensions/LinqSelectExtensions.cs b/src/Services/Ordering/Ordering.API/Extensions/LinqSelectExtensions.cs new file mode 100644 index 000000000..4efe08c07 --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Extensions/LinqSelectExtensions.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Ordering.API.Extensions +{ + public static class LinqSelectExtensions + { + public static IEnumerable> SelectTry(this IEnumerable enumerable, Func selector) + { + foreach (TSource element in enumerable) + { + SelectTryResult returnedValue; + try + { + returnedValue = new SelectTryResult(element, selector(element), null); + } + catch (Exception ex) + { + returnedValue = new SelectTryResult(element, default(TResult), ex); + } + yield return returnedValue; + } + } + + public static IEnumerable OnCaughtException(this IEnumerable> enumerable, Func exceptionHandler) + { + return enumerable.Select(x => x.CaughtException == null ? x.Result : exceptionHandler(x.CaughtException)); + } + + public static IEnumerable OnCaughtException(this IEnumerable> enumerable, Func exceptionHandler) + { + return enumerable.Select(x => x.CaughtException == null ? x.Result : exceptionHandler(x.Source, x.CaughtException)); + } + + public class SelectTryResult + { + internal SelectTryResult(TSource source, TResult result, Exception exception) + { + Source = source; + Result = result; + CaughtException = exception; + } + + public TSource Source { get; private set; } + public TResult Result { get; private set; } + public Exception CaughtException { get; private set; } + } + } +} diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs new file mode 100644 index 000000000..3b569e0ba --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Ordering.API.Infrastructure.Filters +{ + public class AuthorizeCheckOperationFilter : IOperationFilter + { + public void Apply(Operation operation, OperationFilterContext context) + { + // Check for authorize attribute + var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType().Any() || + context.ApiDescription.ActionAttributes().OfType().Any(); + + if (hasAuthorize) + { + operation.Responses.Add("401", new Response { Description = "Unauthorized" }); + operation.Responses.Add("403", new Response { Description = "Forbidden" }); + + operation.Security = new List>>(); + operation.Security.Add(new Dictionary> + { + { "oauth2", new [] { "orderingapi" } } + }); + } + } + } +} \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs b/src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs index ebc4778d1..7443024ee 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs @@ -8,40 +8,175 @@ using System.Threading.Tasks; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; + using System.Collections.Generic; + using Microsoft.AspNetCore.Hosting; + using System.IO; + using Microsoft.Extensions.Options; + using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; + using System; + using global::Ordering.API.Extensions; public class OrderingContextSeed { - public static async Task SeedAsync(IApplicationBuilder applicationBuilder) + public static async Task SeedAsync(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory) { + var log = loggerFactory.CreateLogger("ordering seed"); + var context = (OrderingContext)applicationBuilder .ApplicationServices.GetService(typeof(OrderingContext)); + var settings = applicationBuilder + .ApplicationServices.GetRequiredService>().Value; + + var useCustomizationData = settings.UseCustomizationData; + var contentRootPath = env.ContentRootPath; + + using (context) { context.Database.Migrate(); if (!context.CardTypes.Any()) { - context.CardTypes.Add(CardType.Amex); - context.CardTypes.Add(CardType.Visa); - context.CardTypes.Add(CardType.MasterCard); + context.CardTypes.AddRange(useCustomizationData + ? GetCardTypesFromFile(contentRootPath, log) + : GetPredefinedCardTypes()); await context.SaveChangesAsync(); } if (!context.OrderStatus.Any()) { - context.OrderStatus.Add(OrderStatus.Submitted); - context.OrderStatus.Add(OrderStatus.AwaitingValidation); - context.OrderStatus.Add(OrderStatus.StockConfirmed); - context.OrderStatus.Add(OrderStatus.Paid); - context.OrderStatus.Add(OrderStatus.Shipped); - context.OrderStatus.Add(OrderStatus.Cancelled); + context.OrderStatus.AddRange(useCustomizationData + ? GetOrderStatusFromFile(contentRootPath, log) + : GetPredefinedOrderStatus()); } await context.SaveChangesAsync(); } } + static IEnumerable GetCardTypesFromFile(string contentRootPath, ILogger log) + { + string csvFileCardTypes = Path.Combine(contentRootPath, "Setup", "CardTypes.csv"); + + if (!File.Exists(csvFileCardTypes)) + { + return GetPredefinedCardTypes(); + } + + string[] csvheaders; + try + { + string[] requiredHeaders = { "CardType" }; + csvheaders = GetHeaders(requiredHeaders, csvFileCardTypes); + } + catch (Exception ex) + { + log.LogError(ex.Message); + return GetPredefinedCardTypes(); + } + + int id = 1; + return File.ReadAllLines(csvFileCardTypes) + .Skip(1) // skip header column + .SelectTry(x => CreateCardType(x, ref id)) + .OnCaughtException(ex => { log.LogError(ex.Message); return null; }) + .Where(x => x != null); + } + + static CardType CreateCardType(string value, ref int id) + { + if (String.IsNullOrEmpty(value)) + { + throw new Exception("Orderstatus is null or empty"); + } + + return new CardType(id++, value.Trim('"').Trim()); + } + + + private static IEnumerable GetPredefinedCardTypes() + { + return new List() + { + CardType.Amex, + CardType.Visa, + CardType.MasterCard + }; + } + + static IEnumerable GetOrderStatusFromFile(string contentRootPath, ILogger log) + { + string csvFileOrderStatus = Path.Combine(contentRootPath, "Setup", "OrderStatus.csv"); + + if (!File.Exists(csvFileOrderStatus)) + { + return GetPredefinedOrderStatus(); + } + + string[] csvheaders; + try + { + string[] requiredHeaders = { "OrderStatus" }; + csvheaders = GetHeaders(requiredHeaders, csvFileOrderStatus); + } + catch (Exception ex) + { + log.LogError(ex.Message); + return GetPredefinedOrderStatus(); + } + + int id = 1; + return File.ReadAllLines(csvFileOrderStatus) + .Skip(1) // skip header row + .SelectTry(x => CreateOrderStatus(x, ref id)) + .OnCaughtException(ex => { log.LogError(ex.Message); return null; }) + .Where(x => x != null); + } + + static OrderStatus CreateOrderStatus(string value, ref int id) + { + if (String.IsNullOrEmpty(value)) + { + throw new Exception("Orderstatus is null or empty"); + } + + return new OrderStatus(id++, value.Trim('"').Trim().ToLowerInvariant()); + } + + static IEnumerable GetPredefinedOrderStatus() + { + return new List() + { + OrderStatus.Submitted, + OrderStatus.AwaitingValidation, + OrderStatus.StockConfirmed, + OrderStatus.Paid, + OrderStatus.Shipped, + OrderStatus.Cancelled + }; + } + + static string[] GetHeaders(string[] requiredHeaders, string csvfile) + { + string[] csvheaders = File.ReadLines(csvfile).First().ToLowerInvariant().Split(','); + + if (csvheaders.Count() != requiredHeaders.Count()) + { + throw new Exception($"requiredHeader count '{ requiredHeaders.Count()}' is different then read header '{csvheaders.Count()}'"); + } + + foreach (var requiredHeader in requiredHeaders) + { + if (!csvheaders.Contains(requiredHeader)) + { + throw new Exception($"does not contain required header '{requiredHeader}'"); + } + } + + return csvheaders; + } } } diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 96b4f6627..29d50f326 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -16,10 +16,14 @@ PreserveNewest + + PreserveNewest + + @@ -73,6 +77,9 @@ Always + + PreserveNewest + diff --git a/src/Services/Ordering/Ordering.API/OrderingSettings.cs b/src/Services/Ordering/Ordering.API/OrderingSettings.cs new file mode 100644 index 000000000..8c75ba62d --- /dev/null +++ b/src/Services/Ordering/Ordering.API/OrderingSettings.cs @@ -0,0 +1,7 @@ +namespace Microsoft.eShopOnContainers.Services.Ordering.API +{ + public class OrderingSettings + { + public bool UseCustomizationData { get; set; } + } +} diff --git a/src/Services/Ordering/Ordering.API/Program.cs b/src/Services/Ordering/Ordering.API/Program.cs index 752c15e80..ba92a2da9 100644 --- a/src/Services/Ordering/Ordering.API/Program.cs +++ b/src/Services/Ordering/Ordering.API/Program.cs @@ -10,7 +10,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API { var host = new WebHostBuilder() .UseKestrel() - .UseFailing("/Failing") .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() diff --git a/src/Services/Ordering/Ordering.API/Setup/CardTypes.csv b/src/Services/Ordering/Ordering.API/Setup/CardTypes.csv new file mode 100644 index 000000000..5a610b3e8 --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Setup/CardTypes.csv @@ -0,0 +1,5 @@ +CardType +Amex +Visa +MasterCard +Capital One \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Setup/OrderStatus.csv b/src/Services/Ordering/Ordering.API/Setup/OrderStatus.csv new file mode 100644 index 000000000..8a3109887 --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Setup/OrderStatus.csv @@ -0,0 +1,7 @@ +OrderStatus +Submitted +AwaitingValidation +StockConfirmed +Paid +Shipped +Cancelled \ 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 80b7b2abe..8a35f534c 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -4,20 +4,20 @@ using Autofac; using Autofac.Extensions.DependencyInjection; using global::Ordering.API.Application.IntegrationEvents; - using global::Ordering.API.Application.IntegrationEvents.EventHandling; using global::Ordering.API.Application.IntegrationEvents.Events; - using global::Ordering.API.Infrastructure.Middlewares; + using global::Ordering.API.Infrastructure.Filters; using Infrastructure; - using Infrastructure.Auth; using Infrastructure.AutofacModules; using Infrastructure.Filters; using Infrastructure.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; + using Microsoft.Azure.ServiceBus; using Microsoft.EntityFrameworkCore; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; + using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services; using Microsoft.Extensions.Configuration; @@ -27,7 +27,9 @@ using Ordering.Infrastructure; using Polly; using RabbitMQ.Client; + using Swashbuckle.AspNetCore.Swagger; using System; + using System.Collections.Generic; using System.Data.Common; using System.Data.SqlClient; using System.Reflection; @@ -87,6 +89,8 @@ ServiceLifetime.Scoped //Showing explicitly that the DbContext is shared across the HTTP request scope (graph of objects started in the HTTP request) ); + services.Configure(Configuration); + services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); @@ -97,6 +101,20 @@ Description = "The Ordering Service HTTP API", TermsOfService = "Terms Of Service" }); + + options.AddSecurityDefinition("oauth2", new OAuth2Scheme + { + Type = "oauth2", + Flow = "implicit", + AuthorizationUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/authorize", + TokenUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/token", + Scopes = new Dictionary() + { + { "orders", "Ordering API" } + } + }); + + options.OperationFilter(); }); services.AddCors(options => @@ -116,19 +134,35 @@ services.AddTransient(); - services.AddSingleton(sp => + if (Configuration.GetValue("AzureServiceBusEnabled")) { - var logger = sp.GetRequiredService>(); - - var factory = new ConnectionFactory() + services.AddSingleton(sp => { - HostName = Configuration["EventBusConnection"] - }; + var logger = sp.GetRequiredService>(); - return new DefaultRabbitMQPersistentConnection(factory, logger); - }); + var serviceBusConnectionString = Configuration["EventBusConnection"]; + var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); + + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => + { + var logger = sp.GetRequiredService>(); + + var factory = new ConnectionFactory() + { + HostName = Configuration["EventBusConnection"] + }; + + return new DefaultRabbitMQPersistentConnection(factory, logger); + }); + } + + RegisterEventBus(services); - RegisterServiceBus(services); services.AddOptions(); //configure autofac @@ -157,10 +191,10 @@ .UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + c.ConfigureOAuth2("orderingswaggerui", "", "", "Ordering Swagger UI"); }); - WaitForSqlAvailabilityAsync(loggerFactory, app).Wait(); - ConfigureEventBus(app); + WaitForSqlAvailabilityAsync(loggerFactory, app, env).Wait(); var integrationEventLogContext = new IntegrationEventLogContext( new DbContextOptionsBuilder() @@ -168,12 +202,7 @@ .Options); integrationEventLogContext.Database.Migrate(); - } - - private void RegisterServiceBus(IServiceCollection services) - { - services.AddSingleton(); - services.AddSingleton(); + ConfigureEventBus(app); } private void ConfigureEventBus(IApplicationBuilder app) @@ -199,14 +228,37 @@ }); } + private void RegisterEventBus(IServiceCollection services) + { + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; - private async Task WaitForSqlAvailabilityAsync(ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0) + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + } + else + { + services.AddSingleton(); + } + + services.AddSingleton(); + } + + private async Task WaitForSqlAvailabilityAsync(ILoggerFactory loggerFactory, IApplicationBuilder app, IHostingEnvironment env, int retries = 0) { var logger = loggerFactory.CreateLogger(nameof(Startup)); var policy = CreatePolicy(retries, logger, nameof(WaitForSqlAvailabilityAsync)); await policy.ExecuteAsync(async () => { - await OrderingContextSeed.SeedAsync(app); + await OrderingContextSeed.SeedAsync(app, env, loggerFactory); }); } diff --git a/src/Services/Ordering/Ordering.API/settings.json b/src/Services/Ordering/Ordering.API/settings.json index 09552377a..aa3499295 100644 --- a/src/Services/Ordering/Ordering.API/settings.json +++ b/src/Services/Ordering/Ordering.API/settings.json @@ -1,6 +1,7 @@ { "ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", "IdentityUrl": "http://localhost:5105", + "UseCustomizationData": false, "Logging": { "IncludeScopes": false, "LogLevel": { @@ -8,5 +9,7 @@ "System": "Information", "Microsoft": "Information" } - } + }, + "AzureServiceBusEnabled": false, + "SubscriptionClientName": "Ordering" } diff --git a/src/Services/Payment/Payment.API/Controllers/HomeController.cs b/src/Services/Payment/Payment.API/Controllers/HomeController.cs index 1372ea720..ae1b931ed 100644 --- a/src/Services/Payment/Payment.API/Controllers/HomeController.cs +++ b/src/Services/Payment/Payment.API/Controllers/HomeController.cs @@ -13,7 +13,7 @@ namespace Payment.API.Controllers // GET: // public IActionResult Index() { - return new RedirectResult("~/swagger/ui"); + return new RedirectResult("~/swagger"); } } } diff --git a/src/Services/Payment/Payment.API/Dockerfile b/src/Services/Payment/Payment.API/Dockerfile index 0bb3473d9..522c20056 100644 --- a/src/Services/Payment/Payment.API/Dockerfile +++ b/src/Services/Payment/Payment.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1 +FROM microsoft/aspnetcore:1.1.2 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/Payment/Payment.API/Dockerfile.nanowin b/src/Services/Payment/Payment.API/Dockerfile.nanowin new file mode 100644 index 000000000..9c664f4e4 --- /dev/null +++ b/src/Services/Payment/Payment.API/Dockerfile.nanowin @@ -0,0 +1,8 @@ +FROM microsoft/dotnet:1.1-runtime-nanoserver +SHELL ["powershell"] +ARG source +WORKDIR /app +RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord +EXPOSE 80 +COPY ${source:-obj/Docker/publish} . +ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs b/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs index dfdba0068..bf2e4c1ca 100644 --- a/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs +++ b/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs @@ -22,7 +22,14 @@ public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event) { IntegrationEvent orderPaymentIntegrationEvent; - if(_settings.PaymentSucceded) + + //Business feature comment: + // When OrderStatusChangedToStockConfirmed Integration Event is handled. + // Here we're simulating that we'd be performing the payment against any payment gateway + // Instead of a real payment we just take the env. var to simulate the payment + // The payment can be successful or it can fail + + if (_settings.PaymentSucceded) { orderPaymentIntegrationEvent = new OrderPaymentSuccededIntegrationEvent(@event.OrderId); } diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj index dc8aad80d..3a1c4e248 100644 --- a/src/Services/Payment/Payment.API/Payment.API.csproj +++ b/src/Services/Payment/Payment.API/Payment.API.csproj @@ -27,6 +27,7 @@ + diff --git a/src/Services/Payment/Payment.API/Startup.cs b/src/Services/Payment/Payment.API/Startup.cs index 32d0fc8c4..9cba1415d 100644 --- a/src/Services/Payment/Payment.API/Startup.cs +++ b/src/Services/Payment/Payment.API/Startup.cs @@ -12,6 +12,8 @@ using RabbitMQ.Client; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Payment.API.IntegrationEvents.Events; using Payment.API.IntegrationEvents.EventHandling; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; +using Microsoft.Azure.ServiceBus; namespace Payment.API { @@ -35,19 +37,34 @@ namespace Payment.API // Add framework services. services.AddMvc(); services.Configure(Configuration); - services.AddSingleton(sp => + if (Configuration.GetValue("AzureServiceBusEnabled")) { - var logger = sp.GetRequiredService>(); - - var factory = new ConnectionFactory() + services.AddSingleton(sp => { - HostName = Configuration["EventBusConnection"] - }; + var logger = sp.GetRequiredService>(); - return new DefaultRabbitMQPersistentConnection(factory, logger); - }); + var serviceBusConnectionString = Configuration["EventBusConnection"]; + var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); - RegisterServiceBus(services); + return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); + }); + } + else + { + services.AddSingleton(sp => + { + var logger = sp.GetRequiredService>(); + + var factory = new ConnectionFactory() + { + HostName = Configuration["EventBusConnection"] + }; + + return new DefaultRabbitMQPersistentConnection(factory, logger); + }); + } + + RegisterEventBus(services); services.AddSwaggerGen(options => { @@ -84,20 +101,35 @@ namespace Payment.API ConfigureEventBus(app); } - private void RegisterServiceBus(IServiceCollection services) + private void RegisterEventBus(IServiceCollection services) { - services.AddSingleton(); - services.AddSingleton(); + if (Configuration.GetValue("AzureServiceBusEnabled")) + { + services.AddSingleton(sp => + { + var serviceBusPersisterConnection = sp.GetRequiredService(); + var iLifetimeScope = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var eventBusSubcriptionsManager = sp.GetRequiredService(); + var subscriptionClientName = Configuration["SubscriptionClientName"]; - services.AddTransient, - OrderStatusChangedToStockConfirmedIntegrationEventHandler>(); + return new EventBusServiceBus(serviceBusPersisterConnection, logger, + eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); + }); + } + else + { + services.AddSingleton(); + } + + services.AddTransient(); + services.AddSingleton(); } private void ConfigureEventBus(IApplicationBuilder app) { var eventBus = app.ApplicationServices.GetRequiredService(); - eventBus.Subscribe>(); + eventBus.Subscribe(); } } } \ No newline at end of file diff --git a/src/Services/Payment/Payment.API/appsettings.json b/src/Services/Payment/Payment.API/appsettings.json index 601eaa246..9aef99a14 100644 --- a/src/Services/Payment/Payment.API/appsettings.json +++ b/src/Services/Payment/Payment.API/appsettings.json @@ -5,5 +5,7 @@ "Default": "Warning" } }, - "PaymentSucceded": "true" + "PaymentSucceded": true, + "AzureServiceBusEnabled": false, + "SubscriptionClientName": "Payment" } diff --git a/src/Web/WebMVC/AppSettings.cs b/src/Web/WebMVC/AppSettings.cs index b15167647..42946262f 100644 --- a/src/Web/WebMVC/AppSettings.cs +++ b/src/Web/WebMVC/AppSettings.cs @@ -12,7 +12,9 @@ namespace Microsoft.eShopOnContainers.WebMVC public string OrderingUrl { get; set; } public string BasketUrl { get; set; } public string MarketingUrl { get; set; } + public bool ActivateCampaignDetailFunction { get; set; } public Logging Logging { get; set; } + public bool UseCustomizationData { get; set; } } public class Connectionstrings diff --git a/src/Web/WebMVC/Controllers/CampaignsController.cs b/src/Web/WebMVC/Controllers/CampaignsController.cs index 8f291bb49..cbb08e051 100644 --- a/src/Web/WebMVC/Controllers/CampaignsController.cs +++ b/src/Web/WebMVC/Controllers/CampaignsController.cs @@ -11,19 +11,29 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers using System; using ViewModels.Pagination; using global::WebMVC.ViewModels; + using Microsoft.Extensions.Options; [Authorize] public class CampaignsController : Controller { private readonly ICampaignService _campaignService; + private readonly AppSettings _settings; - public CampaignsController(ICampaignService campaignService) => + public CampaignsController(ICampaignService campaignService, IOptionsSnapshot settings) + { _campaignService = campaignService; + _settings = settings.Value; + } public async Task Index(int page = 0, int pageSize = 10) { var campaignList = await _campaignService.GetCampaigns(pageSize, page); + if(campaignList is null) + { + return View(); + } + var totalPages = (int) Math.Ceiling((decimal) campaignList.Count / pageSize); var vm = new CampaignViewModel @@ -40,6 +50,8 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers } }; + ViewBag.IsCampaignDetailFunctionActive = _settings.ActivateCampaignDetailFunction; + return View(vm); } diff --git a/src/Web/WebMVC/Controllers/CartController.cs b/src/Web/WebMVC/Controllers/CartController.cs index 9e5aa0a91..a7bb84959 100644 --- a/src/Web/WebMVC/Controllers/CartController.cs +++ b/src/Web/WebMVC/Controllers/CartController.cs @@ -7,6 +7,7 @@ using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authentication; +using Polly.CircuitBreaker; namespace Microsoft.eShopOnContainers.WebMVC.Controllers { @@ -26,47 +27,79 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers public async Task Index() { - var user = _appUserParser.Parse(HttpContext.User); - var vm = await _basketSvc.GetBasket(user); - + try + { + var user = _appUserParser.Parse(HttpContext.User); + var vm = await _basketSvc.GetBasket(user); - return View(vm); + return View(vm); + } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + HandleBrokenCircuitException(); + } + + return View(); } [HttpPost] public async Task Index(Dictionary quantities, string action) { - var user = _appUserParser.Parse(HttpContext.User); - var basket = await _basketSvc.SetQuantities(user, quantities); - var vm = await _basketSvc.UpdateBasket(basket); - - if (action == "[ Checkout ]") + try { - var order = _basketSvc.MapBasketToOrder(basket); - return RedirectToAction("Create", "Order"); + var user = _appUserParser.Parse(HttpContext.User); + var basket = await _basketSvc.SetQuantities(user, quantities); + var vm = await _basketSvc.UpdateBasket(basket); + + if (action == "[ Checkout ]") + { + var order = _basketSvc.MapBasketToOrder(basket); + return RedirectToAction("Create", "Order"); + } } - - return View(vm); + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + HandleBrokenCircuitException(); + } + + return View(); } public async Task AddToCart(CatalogItem productDetails) { - if (productDetails.Id != null) + try { - var user = _appUserParser.Parse(HttpContext.User); - var product = new BasketItem() + if (productDetails.Id != null) { - Id = Guid.NewGuid().ToString(), - Quantity = 1, - ProductName = productDetails.Name, - PictureUrl = productDetails.PictureUri, - UnitPrice = productDetails.Price, - ProductId = productDetails.Id - }; - await _basketSvc.AddItemToBasket(user, product); + var user = _appUserParser.Parse(HttpContext.User); + var product = new BasketItem() + { + Id = Guid.NewGuid().ToString(), + Quantity = 1, + ProductName = productDetails.Name, + PictureUrl = productDetails.PictureUri, + UnitPrice = productDetails.Price, + ProductId = productDetails.Id + }; + await _basketSvc.AddItemToBasket(user, product); + } + return RedirectToAction("Index", "Catalog"); } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + HandleBrokenCircuitException(); + } + return RedirectToAction("Index", "Catalog"); } + + private void HandleBrokenCircuitException() + { + TempData["BasketInoperativeMsg"] = "Basket Service is inoperative, please try later on. (Business Msg Due to Circuit-Breaker)"; + } } } diff --git a/src/Web/WebMVC/Controllers/OrderController.cs b/src/Web/WebMVC/Controllers/OrderController.cs index 8f34c2282..11e688728 100644 --- a/src/Web/WebMVC/Controllers/OrderController.cs +++ b/src/Web/WebMVC/Controllers/OrderController.cs @@ -56,7 +56,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { ModelState.AddModelError("Error", "It was not possible to create a new order, please try later on. (Business Msg Due to Circuit-Breaker)"); } - return View(model); + return View("Create", model); } public async Task Cancel(string orderId) diff --git a/src/Web/WebMVC/Infrastructure/WebContextSeed.cs b/src/Web/WebMVC/Infrastructure/WebContextSeed.cs new file mode 100644 index 000000000..65063e34f --- /dev/null +++ b/src/Web/WebMVC/Infrastructure/WebContextSeed.cs @@ -0,0 +1,97 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.eShopOnContainers.WebMVC; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using System; +using System.IO; +using System.IO.Compression; +using System.Linq; + +namespace WebMVC.Infrastructure +{ + public class WebContextSeed + { + public static void Seed(IApplicationBuilder applicationBuilder, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + var log = loggerFactory.CreateLogger("WebMVC seed"); + + var settings = (AppSettings)applicationBuilder + .ApplicationServices.GetRequiredService>().Value; + + var useCustomizationData = settings.UseCustomizationData; + var contentRootPath = env.ContentRootPath; + var webroot = env.WebRootPath; + + if (useCustomizationData) + { + GetPreconfiguredImages(contentRootPath, webroot, log); + + GetPreconfiguredCSS(contentRootPath, webroot, log); + } + } + + static void GetPreconfiguredCSS(string contentRootPath, string webroot, ILogger log) + { + try + { + string overrideCssFile = Path.Combine(contentRootPath, "Setup", "override.css"); + if (!File.Exists(overrideCssFile)) + { + log.LogError($" override css file '{overrideCssFile}' does not exists."); + return; + } + + string destinationFilename = Path.Combine(webroot, "css", "override.css"); + File.Copy(overrideCssFile, destinationFilename, true ); + } + catch (Exception ex) + { + log.LogError($"Exception in method GetPreconfiguredCSS WebMVC. Exception Message={ex.Message}"); + } + } + + static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogger log) + { + try + { + string imagesZipFile = Path.Combine(contentRootPath, "Setup", "images.zip"); + if (!File.Exists(imagesZipFile)) + { + log.LogError($" zip file '{imagesZipFile}' does not exists."); + return; + } + + string imagePath = Path.Combine(webroot, "images"); + string[] imageFiles = Directory.GetFiles(imagePath).Select(file => Path.GetFileName(file)).ToArray(); + + using (ZipArchive zip = ZipFile.Open(imagesZipFile, ZipArchiveMode.Read)) + { + foreach (ZipArchiveEntry entry in zip.Entries) + { + if (imageFiles.Contains(entry.Name)) + { + string destinationFilename = Path.Combine(imagePath, entry.Name); + if (File.Exists(destinationFilename)) + { + File.Delete(destinationFilename); + } + entry.ExtractToFile(destinationFilename); + } + else + { + log.LogWarning($"Skip file '{entry.Name}' in zipfile '{imagesZipFile}'"); + } + } + } + } + catch ( Exception ex ) + { + log.LogError($"Exception in method GetPreconfiguredImages WebMVC. Exception Message={ex.Message}"); + } + } + + } + +} diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs index 55cec1bb9..a025fe200 100644 --- a/src/Web/WebMVC/Services/BasketService.cs +++ b/src/Web/WebMVC/Services/BasketService.cs @@ -21,7 +21,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services public BasketService(IOptionsSnapshot settings, IHttpContextAccessor httpContextAccesor, IHttpClient httpClient) { _settings = settings; - _remoteServiceBaseUrl = _settings.Value.BasketUrl; + _remoteServiceBaseUrl = $"{_settings.Value.BasketUrl}/api/v1/basket"; _httpContextAccesor = httpContextAccesor; _apiClient = httpClient; } diff --git a/src/Web/WebMVC/Setup/images.zip b/src/Web/WebMVC/Setup/images.zip new file mode 100644 index 000000000..531ed26f2 Binary files /dev/null and b/src/Web/WebMVC/Setup/images.zip differ diff --git a/src/Web/WebMVC/Setup/override.css b/src/Web/WebMVC/Setup/override.css new file mode 100644 index 000000000..e8b5bb50f --- /dev/null +++ b/src/Web/WebMVC/Setup/override.css @@ -0,0 +1,3 @@ +.esh-catalog-button { + background-color: #83D01B; /* to override the style of this button ie. to make it red, use background-color: #FF001b; */ +} diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 8147f6720..75b7b1e9b 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -12,6 +12,7 @@ using Microsoft.Extensions.HealthChecks; using Microsoft.Extensions.Logging; using System; using System.IdentityModel.Tokens.Jwt; +using WebMVC.Infrastructure; namespace Microsoft.eShopOnContainers.WebMVC { @@ -39,7 +40,8 @@ namespace Microsoft.eShopOnContainers.WebMVC // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc(); + services.AddMvc(); + services.AddSession(); if (Configuration.GetValue("IsClusterEnv") == bool.TrueString) { @@ -63,6 +65,7 @@ namespace Microsoft.eShopOnContainers.WebMVC checks.AddUrlCheck(Configuration["OrderingUrl"] + "/hc", TimeSpan.FromMinutes(minutes)); checks.AddUrlCheck(Configuration["BasketUrl"] + "/hc", TimeSpan.FromMinutes(minutes)); checks.AddUrlCheck(Configuration["IdentityUrl"] + "/hc", TimeSpan.FromMinutes(minutes)); + checks.AddUrlCheck(Configuration["MarketingUrl"] + "/hc", TimeSpan.FromMinutes(minutes)); }); // Add application services. @@ -102,6 +105,7 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseExceptionHandler("/Catalog/Error"); } + app.UseSession(); app.UseStaticFiles(); app.UseCookieAuthentication(new CookieAuthenticationOptions @@ -112,23 +116,27 @@ namespace Microsoft.eShopOnContainers.WebMVC var identityUrl = Configuration.GetValue("IdentityUrl"); var callBackUrl = Configuration.GetValue("CallBackUrl"); + var useLoadTest = Configuration.GetValue("UseLoadTest"); var log = loggerFactory.CreateLogger("identity"); var oidcOptions = new OpenIdConnectOptions { AuthenticationScheme = "oidc", SignInScheme = "Cookies", - Authority = identityUrl.ToString(), - PostLogoutRedirectUri = callBackUrl.ToString(), - ClientId = "mvc", + Authority = identityUrl, + PostLogoutRedirectUri = callBackUrl, ClientSecret = "secret", - ResponseType = "code id_token", + ClientId = useLoadTest ? "mvctest" : "mvc", + ResponseType = useLoadTest ? "code id_token token" : "code id_token", SaveTokens = true, GetClaimsFromUserInfoEndpoint = true, RequireHttpsMetadata = false, - Scope = { "openid", "profile", "orders", "basket", "marketing" } + Scope = { "openid", "profile", "orders", "basket", "marketing", "locations" } }; + //Seed Data + WebContextSeed.Seed(app, env, loggerFactory); + //Wait untill identity service is ready on compose. app.UseOpenIdConnectAuthentication(oidcOptions); diff --git a/src/Web/WebMVC/ViewComponents/Cart.cs b/src/Web/WebMVC/ViewComponents/Cart.cs index 2db0e35b6..05c7dac50 100644 --- a/src/Web/WebMVC/ViewComponents/Cart.cs +++ b/src/Web/WebMVC/ViewComponents/Cart.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Polly.CircuitBreaker; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents { @@ -17,11 +18,19 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents public async Task InvokeAsync(ApplicationUser user) { - var itemsInCart = await ItemsInCartAsync(user); - var vm = new CartComponentViewModel() + var vm = new CartComponentViewModel(); + try { - ItemsCount = itemsInCart - }; + var itemsInCart = await ItemsInCartAsync(user); + vm.ItemsCount = itemsInCart; + return View(vm); + } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + ViewBag.IsBasketInoperative = true; + } + return View(vm); } private async Task ItemsInCartAsync(ApplicationUser user) diff --git a/src/Web/WebMVC/ViewComponents/CartList.cs b/src/Web/WebMVC/ViewComponents/CartList.cs index 099cc8a3d..04a7a783a 100644 --- a/src/Web/WebMVC/ViewComponents/CartList.cs +++ b/src/Web/WebMVC/ViewComponents/CartList.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Polly.CircuitBreaker; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents { @@ -16,8 +17,19 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents public async Task InvokeAsync(ApplicationUser user) { - var item = await GetItemsAsync(user); - return View(item); + var vm = new Basket(); + try + { + vm = await GetItemsAsync(user); + return View(vm); + } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + TempData["BasketInoperativeMsg"] = "Basket Service is inoperative, please try later on. (Business Msg Due to Circuit-Breaker)"; + } + + return View(vm); } private Task GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user); diff --git a/src/Web/WebMVC/ViewModels/CampaignItem.cs b/src/Web/WebMVC/ViewModels/CampaignItem.cs index a0bfbaf66..04e220229 100644 --- a/src/Web/WebMVC/ViewModels/CampaignItem.cs +++ b/src/Web/WebMVC/ViewModels/CampaignItem.cs @@ -15,5 +15,6 @@ public DateTime To { get; set; } public string PictureUri { get; set; } + public string DetailsUri { get; set; } } } \ No newline at end of file diff --git a/src/Web/WebMVC/Views/Campaigns/Index.cshtml b/src/Web/WebMVC/Views/Campaigns/Index.cshtml index d4c8abe48..bca288ed6 100644 --- a/src/Web/WebMVC/Views/Campaigns/Index.cshtml +++ b/src/Web/WebMVC/Views/Campaigns/Index.cshtml @@ -13,10 +13,8 @@ new Header() { Controller = "Catalog", Text = "Back to catalog" } })
- @if (Model.CampaignItems != null && Model.CampaignItems.Any()) + @if(Model != null && Model.CampaignItems.Any()) { - @Html.Partial("_pagination", Model.PaginationInfo) -
@foreach (var catalogItem in Model.CampaignItems) { diff --git a/src/Web/WebMVC/Views/Campaigns/_campaign.cshtml b/src/Web/WebMVC/Views/Campaigns/_campaign.cshtml index de3b52657..c0a074b12 100644 --- a/src/Web/WebMVC/Views/Campaigns/_campaign.cshtml +++ b/src/Web/WebMVC/Views/Campaigns/_campaign.cshtml @@ -1,17 +1,21 @@ @model CampaignItem - -

@Model.Name

@Model.Name - + @if (ViewBag.IsCampaignDetailFunctionActive == true) + { + + } + else + { + + }
+
diff --git a/src/Web/WebMVC/Views/Catalog/Index.cshtml b/src/Web/WebMVC/Views/Catalog/Index.cshtml index ddac94196..23667500f 100644 --- a/src/Web/WebMVC/Views/Catalog/Index.cshtml +++ b/src/Web/WebMVC/Views/Catalog/Index.cshtml @@ -23,6 +23,15 @@
+
+
+ @if(TempData.ContainsKey("BasketInoperativeMsg")) + { + + } +
@if (Model.CatalogItems.Count() > 0) { diff --git a/src/Web/WebMVC/Views/Order/Detail.cshtml b/src/Web/WebMVC/Views/Order/Detail.cshtml index c17ffb2a9..810a59559 100644 --- a/src/Web/WebMVC/Views/Order/Detail.cshtml +++ b/src/Web/WebMVC/Views/Order/Detail.cshtml @@ -68,9 +68,9 @@
@item.ProductName
-
$ @Math.Round(item.UnitPrice, 2)
+
$ @item.UnitPrice.ToString("N2")
@item.Units
-
$ @Math.Round(item.Units * item.UnitPrice, 2)
+
$ @Math.Round(item.Units * item.UnitPrice, 2).ToString("N2")
} diff --git a/src/Web/WebMVC/Views/Order/Index.cshtml b/src/Web/WebMVC/Views/Order/Index.cshtml index 61a871f26..312e81162 100644 --- a/src/Web/WebMVC/Views/Order/Index.cshtml +++ b/src/Web/WebMVC/Views/Order/Index.cshtml @@ -9,6 +9,7 @@
@Html.Partial("_Header", new List
() { new Header() { Controller = "Catalog", Text = "Back to catalog" }, + new Header() { Text = " / " }, new Header() { Controller = "OrderManagement", Text = "Orders Management" } })
@@ -19,7 +20,8 @@
Status
- + @if (Model != null && Model.Any()) + { @foreach (var item in Model) {
@@ -38,6 +40,7 @@
} + }