From c12d96b7d030686199d8f0b5750443b738a84d35 Mon Sep 17 00:00:00 2001 From: Rich Roberts Date: Thu, 13 Aug 2026 17:11:22 -0500 Subject: [PATCH 1/4] restore removed irCatalog documentation --- doc/ircatalog.md | 149 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 doc/ircatalog.md diff --git a/doc/ircatalog.md b/doc/ircatalog.md new file mode 100644 index 0000000..8ac0f89 --- /dev/null +++ b/doc/ircatalog.md @@ -0,0 +1,149 @@ +Catalog +==== +Catalog is a business rule management tool that provides centralized management of rules to ensure the integrity of business rules, keep everyone working on the latest version of rules, and promote sharing of common rules across customers, processes or applications. + +If you have not done so already, please read the [prerequisites](../README.md#prerequisites) before you get started. + +# Database Deployment + +Catalog supports both Microsoft SQL Server (which includes Microsoft Azure SQL Databases) and Oracle Database. This section explains how to provision a new Microsoft Azure SQL Database for Catalog. If you have an existing database, you may skip to the the [Web App Deployment](#web-app-deployment) section. + +## Sign in to Microsoft Azure +First, [open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Microsoft Azure subscription: +```powershell +az login +``` + +## Set active subscription +If your Microsoft Azure account has access to multiple subscriptions, you will need to [set your active subscription](https://docs.microsoft.com/en-us/cli/azure/account#az-account-set) to where you create your Azure resources: +```powershell +# Example: az account set --subscription "Contoso Subscription 1" +az account set --subscription SUBSCRIPTION_NAME +``` + +## Create resource group +Create the resource group (one resource group per environment is typical) that will contain the InRule-related Azure resources with the [az group create](https://docs.microsoft.com/en-us/cli/azure/group#az-group-create) command: +```powershell +# Example: az group create --name inrule-prod-rg --location eastus +az group create --name RESOURCE_GROUP_NAME --location LOCATION +``` + +## Create Database Server +Create the [Azure SQL Server](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-logical-servers) with the [az sql server create](https://docs.microsoft.com/en-us/cli/azure/sql/server?view=azure-cli-latest#az-sql-server-create) command: +```powershell +# Example: az sql server create --name contoso-catalog-prod-sql --resource-group inrule-prod-rg --location eastus --admin-user admin --admin-password %14TVpB*g$4b +az sql server create --name SERVER_NAME --resource-group RESOURCE_GROUP_NAME --location LOCATION --admin-user ADMIN_USER_NAME --admin-password ADMIN_USER_PASSWORD +``` + +## Create Database +Create the [Azure SQL Server Database](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-databases-manage) with the [az sql db create](https://docs.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-create) command: +```powershell +# Example: az sql db create --name catalog-prod-db --server contoso-catalog-prod-sql --resource-group inrule-prod-rg +az sql db create --name DATABASE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME +``` + +## Allow Catalog Server Access via Firewall Rule +In order to allow the Catalog Server access to the database, a firewall rule must be added to allow Azure services access to the Azure SQL Server. + +Create a rule in the firewall to allow you to access the newly created database with the [az sql server firewall-rule create](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-create) command: +```powershell +# Example: az sql server firewall-rule create --name AllowAllWindowsAzureIps --server contoso-catalog-prod-sql --resource-group inrule-prod-rg --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 +az sql server firewall-rule create --name AllowAllWindowsAzureIps --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 +``` +## Allow Your Local Machine Access via Firewall Rule +In order to run the catalog database install/upgrade application, a firewall rule must be added to allow your local machine access to the Azure SQL Server. One way to find your external IP address would be to use [Google](https://www.google.com/search?q=what+is+my+ip). + +Create a rule in the firewall to allow you to access the newly created database with the [az sql server firewall-rule create](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-create) command: +```powershell +# Example: az sql server firewall-rule create --name myLocalMachine --server contoso-catalog-prod-sql --resource-group inrule-prod-rg --start-ip-address 1.2.3.4 --end-ip-address 1.2.3.4 +az sql server firewall-rule create --name FIREWALL_RULE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME --start-ip-address MY_EXTERNAL_IP --end-ip-address MY_EXTERNAL_IP +``` + +## Deploy the Catalog Database +First, [download](https://github.com/InRule/AzureAppServices/releases/latest) the latest Catalog Database package (`InRule.Catalog.Service.Database.zip`) from GitHub, and unzip into a directory of your choosing. + +Update the `appsettings.json` found in the newly unzipped directory with the connection string for your database. Be sure to set a valid user name and password. You can retrieve the connection string with the [az sql db show-connection-string](https://docs.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-show-connection-string) command: +```powershell +# Example: az sql db show-connection-string --server contoso-catalog-prod-sql --name catalog-prod-db --client ado.net +az sql db show-connection-string --server SERVER_NAME --name DATABASE_NAME --client ado.net +``` + +Then run the included executable to deploy the initial Catalog database schema: +```powershell +.\InRule.Catalog.Service.Database.exe +``` + +## (Optional) Remove Local Machine Firewall Rule +While not required, the local machine firewall rule that was added earlier may be removed with the [az sql server firewall-rule delete](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-delete) command: +```powershell +# Example: az sql server firewall-rule delete --name myLocalMachine --server contoso-catalog-prod-sql --resource-group inrule-prod-rg +az sql server firewall-rule delete --name FIREWALL_RULE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME +``` + +# Web App Deployment + +## Sign in to Azure +First, [open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Azure subscription: +```powershell +az login +``` + +## Set active subscription +If your Azure account has access to multiple subscriptions, you will need to [set your active subscription](https://docs.microsoft.com/en-us/cli/azure/account#az-account-set) to where you create your Azure resources: +```powershell +# Example: az account set --subscription "Contoso Subscription 1" +az account set --subscription SUBSCRIPTION_NAME +``` + +## Create resource group +Create the resource group (one resource group per environment is typical) that will contain the InRule-related Azure resources with the [az group create](https://docs.microsoft.com/en-us/cli/azure/group#az-group-create) command: +```powershell +# Example: az group create --name inrule-prod-rg --location eastus +az group create --name RESOURCE_GROUP_NAME --location LOCATION +``` + +## Create App Service plan +Create the [App Service plan](https://docs.microsoft.com/en-us/azure/app-service/azure-web-sites-web-hosting-plans-in-depth-overview) that will host the InRule-related web apps with the [az appservice plan create](https://docs.microsoft.com/en-us/cli/azure/appservice/plan#az-appservice-plan-create) command: +```powershell +# Example: az appservice plan create --name inrule-prod-sp --resource-group inrule-prod-rg --location eastus +az appservice plan create --name APP_SERVICE_PLAN_NAME --resource-group RESOURCE_GROUP_NAME --location LOCATION +``` + +## Create Web App +Create the [Azure App Service Web App](https://docs.microsoft.com/en-us/azure/app-service/app-service-web-overview) for the Catalog Service with the [az webapp create](https://docs.microsoft.com/en-us/cli/azure/webapp#az-webapp-create) command: +```powershell +# Example: az webapp create --name contoso-catalog-prod-wa --plan inrule-prod-sp --resource-group inrule-prod-rg +az webapp create --name WEB_APP_NAME --plan APP_SERVICE_PLAN_NAME --resource-group RESOURCE_GROUP_NAME +``` + +## Deploy package +First, [download](https://github.com/InRule/AzureAppServices/releases/latest) the latest Catalog package (`InRule.Catalog.Service.zip`) from GitHub. Then [deploy the zip file](https://docs.microsoft.com/en-us/azure/app-service/app-service-deploy-zip) package to the Web App with the [az webapp deployment source](https://docs.microsoft.com/en-us/cli/azure/webapp/deployment/source#az-webapp-deployment-source-config-zip) command: +```powershell +# Example: az webapp deployment source config-zip --name contoso-catalog-prod-wa --resource-group inrule-prod-rg --src InRule.Catalog.Service.zip +az webapp deployment source config-zip --name WEB_APP_NAME --resource-group RESOURCE_GROUP_NAME --src FILE_PATH +``` + +## Upload valid license file +In order for Catalog Service to properly function, a valid license file must be uploaded to the web app. The simplest way to upload the license file is via FTP. + +First, retrieve the FTP deployment profile (url and credentials) with the [az webapp deployment list-publishing-profiles](https://docs.microsoft.com/en-us/cli/azure/webapp/deployment#az-webapp-deployment-list-publishing-profiles) command and put the values into a variable: +```powershell +# Example: az webapp deployment list-publishing-profiles --name contoso-catalog-prod-wa --resource-group inrule-prod-rg --query "[?contains(publishMethod, 'FTP')].{publishUrl:publishUrl,userName:userName,userPWD:userPWD}[0]" | ConvertFrom-Json -OutVariable creds | Out-Null +az webapp deployment list-publishing-profiles --name WEB_APP_NAME --resource-group RESOURCE_GROUP_NAME --query "[?contains(publishMethod, 'FTP')].{publishUrl:publishUrl,userName:userName,userPWD:userPWD}[0]" | ConvertFrom-Json -OutVariable creds | Out-Null +``` + +Then, upload the license file using those retrieved values: +```powershell +# Example: $client = New-Object System.Net.WebClient;$client.Credentials = New-Object System.Net.NetworkCredential($creds.userName,$creds.userPWD);$uri = New-Object System.Uri($creds.publishUrl + "/InRuleLicense.xml");$client.UploadFile($uri, "$pwd\InRuleLicense.xml"); +$client = New-Object System.Net.WebClient;$client.Credentials = New-Object System.Net.NetworkCredential($creds.userName,$creds.userPWD);$uri = New-Object System.Uri($creds.publishUrl + "/InRuleLicense.xml");$client.UploadFile($uri, "LICENSE_FILE_ABSOLUTE_PATH") +``` + +## Change the connection string +The Catalog application now needs to be configured to point to your Catalog database. +```powershell +# Example: az webapp config appsettings set --name contoso-catalog-prod-wa --resource-group inrule-prod-rg --settings inrule:repository:service:connectionString="Server=tcp:contoso-catalog-prod-sql.database.windows.net,1433;Initial Catalog=catalog-prod-db;Persist Security Info=False;User ID=admin;Password=%14TVpB*g$4b;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"; +az webapp config appsettings set --name WEB_APP_NAME --resource-group RESOURCE_GROUP_NAME --settings inrule:repository:service:connectionString="Server=tcp:SERVER_NAME.database.windows.net,1433;Initial Catalog=DATABASE_NAME;Persist Security Info=False;User ID=USER_NAME;Password=USER_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"; +``` + +## Verify using irAuthor +Using irAuthor you should now be able to connect to your catalog using the url [https://WEB_APP_NAME.azurewebsites.net/service.svc](https://WEB_APP_NAME.azurewebsites.net/service.svc). \ No newline at end of file From ebb569aa4ed5da738a3a1341d17b396e0323cc80 Mon Sep 17 00:00:00 2001 From: Rich Roberts Date: Thu, 13 Aug 2026 17:30:14 -0500 Subject: [PATCH 2/4] remove Oracle reference --- doc/ircatalog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ircatalog.md b/doc/ircatalog.md index 8ac0f89..7f88ea1 100644 --- a/doc/ircatalog.md +++ b/doc/ircatalog.md @@ -6,7 +6,7 @@ If you have not done so already, please read the [prerequisites](../README.md#pr # Database Deployment -Catalog supports both Microsoft SQL Server (which includes Microsoft Azure SQL Databases) and Oracle Database. This section explains how to provision a new Microsoft Azure SQL Database for Catalog. If you have an existing database, you may skip to the the [Web App Deployment](#web-app-deployment) section. +Catalog supports Microsoft SQL Server (which includes Microsoft Azure SQL Databases). This section explains how to provision a new Microsoft Azure SQL Database for Catalog. If you have an existing database, you may skip to the the [Web App Deployment](#web-app-deployment) section. ## Sign in to Microsoft Azure First, [open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Microsoft Azure subscription: From a5f083b477caea13571e6e8834216dc18ff0be01 Mon Sep 17 00:00:00 2001 From: Rich Roberts Date: Fri, 14 Aug 2026 10:35:10 -0500 Subject: [PATCH 3/4] fix typo --- doc/ircatalog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ircatalog.md b/doc/ircatalog.md index 7f88ea1..25105fa 100644 --- a/doc/ircatalog.md +++ b/doc/ircatalog.md @@ -6,7 +6,7 @@ If you have not done so already, please read the [prerequisites](../README.md#pr # Database Deployment -Catalog supports Microsoft SQL Server (which includes Microsoft Azure SQL Databases). This section explains how to provision a new Microsoft Azure SQL Database for Catalog. If you have an existing database, you may skip to the the [Web App Deployment](#web-app-deployment) section. +Catalog supports Microsoft SQL Server (which includes Microsoft Azure SQL Databases). This section explains how to provision a new Microsoft Azure SQL Database for Catalog. If you have an existing database, you may skip to the [Web App Deployment](#web-app-deployment) section. ## Sign in to Microsoft Azure First, [open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Microsoft Azure subscription: From 324cd81febcd6a2922dc0d231e7fbe050a12862b Mon Sep 17 00:00:00 2001 From: Rich Roberts Date: Fri, 14 Aug 2026 11:35:07 -0500 Subject: [PATCH 4/4] rename irCatalog file; remove duplication; fix links --- README.md | 4 + doc/ircatalog-arm-template-deployment.md | 4 +- doc/ircatalog-database-deployment.md | 78 ++++++++++++ doc/ircatalog.md | 149 ----------------------- 4 files changed, 84 insertions(+), 151 deletions(-) create mode 100644 doc/ircatalog-database-deployment.md delete mode 100644 doc/ircatalog.md diff --git a/README.md b/README.md index bc32dbd..5b97425 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ The Catalog Manager is a stand-alone web application that provides an administra * [ARM Template Deployment](doc/ircatalog-arm-template-deployment.md) +#### Catalog database: + +* [Catalog Database Deployment](doc/ircatalog-database-deployment.md) - provisioning the Azure SQL resources, and installing or upgrading the Catalog database schema. + # Decision Services diff --git a/doc/ircatalog-arm-template-deployment.md b/doc/ircatalog-arm-template-deployment.md index 909817d..6a419f2 100644 --- a/doc/ircatalog-arm-template-deployment.md +++ b/doc/ircatalog-arm-template-deployment.md @@ -62,10 +62,10 @@ az deployment group create -g RESOURCE_GROUP_NAME --template-file .\InRule.Catal ``` ## Allow Your Local Machine Access via Firewall Rule -You'll need to temporarily allow access to your local machine to deploy the schema and data for the database. This step can be found in the Catalog web app deployment guide [Catalog Web App Deployment](ircatalog.md#allow-ircatalog-server-access-via-firewall-rule) +You'll need to temporarily allow access to your local machine to deploy the schema and data for the database. This step can be found in the [Catalog Database Deployment](/doc/ircatalog-database-deployment.md#allow-your-local-machine-access-via-firewall-rule) guide. ## Deploy the Catalog Database -After opening the firewall, you'll need to use the provided tool to setup the database. This step can be found in the Catalog web app deployment guide [Catalog Web App Deployment](ircatalog.md#deploy-the-ircatalog-database) +After opening the firewall, you'll need to use the provided tool to setup the database. This step can be found in the [Catalog Database Deployment](/doc/ircatalog-database-deployment.md#deploy-the-catalog-database) guide. ## Upload valid license file In order for Catalog Service to properly function, a valid license file must be uploaded to the web app. For information on how to upload your license file please refer to our [license upload documentation](/doc/upload-license-file.md). diff --git a/doc/ircatalog-database-deployment.md b/doc/ircatalog-database-deployment.md new file mode 100644 index 0000000..af7cc75 --- /dev/null +++ b/doc/ircatalog-database-deployment.md @@ -0,0 +1,78 @@ +Catalog Database Deployment +==== +This document covers provisioning the Azure SQL resources for Catalog and deploying the Catalog database schema. + +If you are deploying Catalog and Catalog Manager for the first time, start with the [ARM Template Deployment](/doc/ircatalog-arm-template-deployment.md) guide. That template provisions the SQL server, the database, and both app services for you, and refers back to this document for the firewall and schema deployment steps. + +Catalog supports Microsoft SQL Server (which includes Microsoft Azure SQL Databases). + +If you have not done so already, please read the [prerequisites](../README.md#prerequisites) before you get started. + +# Sign in to Microsoft Azure +[Open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Microsoft Azure subscription. If your account has access to multiple subscriptions, also [set your active subscription](https://docs.microsoft.com/en-us/cli/azure/account#az-account-set) to the one containing your Azure resources: +```powershell +az login + +# Example: az account set --subscription "Contoso Subscription 1" +az account set --subscription SUBSCRIPTION_NAME +``` + +# (Optional) Create the Database Server and Database +The Catalog [ARM template](/doc/ircatalog-arm-template-deployment.md) provisions the Azure SQL server and database for you. Skip this section if you deployed with the template, or if you already have a database. + +## Create Database Server +Create the [Azure SQL Server](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-logical-servers) with the [az sql server create](https://docs.microsoft.com/en-us/cli/azure/sql/server?view=azure-cli-latest#az-sql-server-create) command: +```powershell +# Example: az sql server create --name contoso-catalog-prod-sql --resource-group inrule-prod-rg --location eastus --admin-user admin --admin-password %14TVpB*g$4b +az sql server create --name SERVER_NAME --resource-group RESOURCE_GROUP_NAME --location LOCATION --admin-user ADMIN_USER_NAME --admin-password ADMIN_USER_PASSWORD +``` + +## Create Database +Create the [Azure SQL Server Database](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-databases-manage) with the [az sql db create](https://docs.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-create) command: +```powershell +# Example: az sql db create --name catalog-prod-db --server contoso-catalog-prod-sql --resource-group inrule-prod-rg +az sql db create --name DATABASE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME +``` + +# Allow Catalog Server Access via Firewall Rule +In order to allow the Catalog Server access to the database, a firewall rule must be added to allow Azure services access to the Azure SQL Server. + +Create a rule in the firewall to allow you to access the newly created database with the [az sql server firewall-rule create](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-create) command: +```powershell +# Example: az sql server firewall-rule create --name AllowAllWindowsAzureIps --server contoso-catalog-prod-sql --resource-group inrule-prod-rg --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 +az sql server firewall-rule create --name AllowAllWindowsAzureIps --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 +``` + +# Allow Your Local Machine Access via Firewall Rule +In order to run the catalog database install/upgrade application, a firewall rule must be added to allow your local machine access to the Azure SQL Server. One way to find your external IP address would be to use [Google](https://www.google.com/search?q=what+is+my+ip). + +Create a rule in the firewall to allow you to access the newly created database with the [az sql server firewall-rule create](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-create) command: +```powershell +# Example: az sql server firewall-rule create --name myLocalMachine --server contoso-catalog-prod-sql --resource-group inrule-prod-rg --start-ip-address 1.2.3.4 --end-ip-address 1.2.3.4 +az sql server firewall-rule create --name FIREWALL_RULE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME --start-ip-address MY_EXTERNAL_IP --end-ip-address MY_EXTERNAL_IP +``` + +# Deploy the Catalog Database +First, [download](https://github.com/InRule/AzureAppServices/releases/latest) the latest Catalog Database package (`InRule.Catalog.Service.Database.zip`) from GitHub, and unzip into a directory of your choosing. + +Update the `appsettings.json` found in the newly unzipped directory with the connection string for your database. Be sure to set a valid user name and password. You can retrieve the connection string with the [az sql db show-connection-string](https://docs.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-show-connection-string) command: +```powershell +# Example: az sql db show-connection-string --server contoso-catalog-prod-sql --name catalog-prod-db --client ado.net +az sql db show-connection-string --server SERVER_NAME --name DATABASE_NAME --client ado.net +``` + +Then run the included executable to deploy the initial Catalog database schema: +```powershell +.\InRule.Catalog.Service.Database.exe +``` + +The same executable is used to upgrade the schema of an existing Catalog database. + +If you are configuring a Catalog web app that was not deployed with the ARM template, set this same connection string as the `inrule:repository:service:connectionString` app setting on the web app. The ARM template configures this setting for you from its `catalogSql*` parameters. + +# (Optional) Remove Local Machine Firewall Rule +While not required, the local machine firewall rule that was added earlier may be removed with the [az sql server firewall-rule delete](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-delete) command: +```powershell +# Example: az sql server firewall-rule delete --name myLocalMachine --server contoso-catalog-prod-sql --resource-group inrule-prod-rg +az sql server firewall-rule delete --name FIREWALL_RULE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME +``` diff --git a/doc/ircatalog.md b/doc/ircatalog.md deleted file mode 100644 index 25105fa..0000000 --- a/doc/ircatalog.md +++ /dev/null @@ -1,149 +0,0 @@ -Catalog -==== -Catalog is a business rule management tool that provides centralized management of rules to ensure the integrity of business rules, keep everyone working on the latest version of rules, and promote sharing of common rules across customers, processes or applications. - -If you have not done so already, please read the [prerequisites](../README.md#prerequisites) before you get started. - -# Database Deployment - -Catalog supports Microsoft SQL Server (which includes Microsoft Azure SQL Databases). This section explains how to provision a new Microsoft Azure SQL Database for Catalog. If you have an existing database, you may skip to the [Web App Deployment](#web-app-deployment) section. - -## Sign in to Microsoft Azure -First, [open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Microsoft Azure subscription: -```powershell -az login -``` - -## Set active subscription -If your Microsoft Azure account has access to multiple subscriptions, you will need to [set your active subscription](https://docs.microsoft.com/en-us/cli/azure/account#az-account-set) to where you create your Azure resources: -```powershell -# Example: az account set --subscription "Contoso Subscription 1" -az account set --subscription SUBSCRIPTION_NAME -``` - -## Create resource group -Create the resource group (one resource group per environment is typical) that will contain the InRule-related Azure resources with the [az group create](https://docs.microsoft.com/en-us/cli/azure/group#az-group-create) command: -```powershell -# Example: az group create --name inrule-prod-rg --location eastus -az group create --name RESOURCE_GROUP_NAME --location LOCATION -``` - -## Create Database Server -Create the [Azure SQL Server](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-logical-servers) with the [az sql server create](https://docs.microsoft.com/en-us/cli/azure/sql/server?view=azure-cli-latest#az-sql-server-create) command: -```powershell -# Example: az sql server create --name contoso-catalog-prod-sql --resource-group inrule-prod-rg --location eastus --admin-user admin --admin-password %14TVpB*g$4b -az sql server create --name SERVER_NAME --resource-group RESOURCE_GROUP_NAME --location LOCATION --admin-user ADMIN_USER_NAME --admin-password ADMIN_USER_PASSWORD -``` - -## Create Database -Create the [Azure SQL Server Database](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-databases-manage) with the [az sql db create](https://docs.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-create) command: -```powershell -# Example: az sql db create --name catalog-prod-db --server contoso-catalog-prod-sql --resource-group inrule-prod-rg -az sql db create --name DATABASE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME -``` - -## Allow Catalog Server Access via Firewall Rule -In order to allow the Catalog Server access to the database, a firewall rule must be added to allow Azure services access to the Azure SQL Server. - -Create a rule in the firewall to allow you to access the newly created database with the [az sql server firewall-rule create](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-create) command: -```powershell -# Example: az sql server firewall-rule create --name AllowAllWindowsAzureIps --server contoso-catalog-prod-sql --resource-group inrule-prod-rg --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 -az sql server firewall-rule create --name AllowAllWindowsAzureIps --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 -``` -## Allow Your Local Machine Access via Firewall Rule -In order to run the catalog database install/upgrade application, a firewall rule must be added to allow your local machine access to the Azure SQL Server. One way to find your external IP address would be to use [Google](https://www.google.com/search?q=what+is+my+ip). - -Create a rule in the firewall to allow you to access the newly created database with the [az sql server firewall-rule create](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-create) command: -```powershell -# Example: az sql server firewall-rule create --name myLocalMachine --server contoso-catalog-prod-sql --resource-group inrule-prod-rg --start-ip-address 1.2.3.4 --end-ip-address 1.2.3.4 -az sql server firewall-rule create --name FIREWALL_RULE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME --start-ip-address MY_EXTERNAL_IP --end-ip-address MY_EXTERNAL_IP -``` - -## Deploy the Catalog Database -First, [download](https://github.com/InRule/AzureAppServices/releases/latest) the latest Catalog Database package (`InRule.Catalog.Service.Database.zip`) from GitHub, and unzip into a directory of your choosing. - -Update the `appsettings.json` found in the newly unzipped directory with the connection string for your database. Be sure to set a valid user name and password. You can retrieve the connection string with the [az sql db show-connection-string](https://docs.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-show-connection-string) command: -```powershell -# Example: az sql db show-connection-string --server contoso-catalog-prod-sql --name catalog-prod-db --client ado.net -az sql db show-connection-string --server SERVER_NAME --name DATABASE_NAME --client ado.net -``` - -Then run the included executable to deploy the initial Catalog database schema: -```powershell -.\InRule.Catalog.Service.Database.exe -``` - -## (Optional) Remove Local Machine Firewall Rule -While not required, the local machine firewall rule that was added earlier may be removed with the [az sql server firewall-rule delete](https://docs.microsoft.com/en-us/cli/azure/sql/server/firewall-rule?view=azure-cli-latest#az-sql-server-firewall-rule-delete) command: -```powershell -# Example: az sql server firewall-rule delete --name myLocalMachine --server contoso-catalog-prod-sql --resource-group inrule-prod-rg -az sql server firewall-rule delete --name FIREWALL_RULE_NAME --server SERVER_NAME --resource-group RESOURCE_GROUP_NAME -``` - -# Web App Deployment - -## Sign in to Azure -First, [open a PowerShell prompt](https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell) and use the Azure CLI to [sign in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) to your Azure subscription: -```powershell -az login -``` - -## Set active subscription -If your Azure account has access to multiple subscriptions, you will need to [set your active subscription](https://docs.microsoft.com/en-us/cli/azure/account#az-account-set) to where you create your Azure resources: -```powershell -# Example: az account set --subscription "Contoso Subscription 1" -az account set --subscription SUBSCRIPTION_NAME -``` - -## Create resource group -Create the resource group (one resource group per environment is typical) that will contain the InRule-related Azure resources with the [az group create](https://docs.microsoft.com/en-us/cli/azure/group#az-group-create) command: -```powershell -# Example: az group create --name inrule-prod-rg --location eastus -az group create --name RESOURCE_GROUP_NAME --location LOCATION -``` - -## Create App Service plan -Create the [App Service plan](https://docs.microsoft.com/en-us/azure/app-service/azure-web-sites-web-hosting-plans-in-depth-overview) that will host the InRule-related web apps with the [az appservice plan create](https://docs.microsoft.com/en-us/cli/azure/appservice/plan#az-appservice-plan-create) command: -```powershell -# Example: az appservice plan create --name inrule-prod-sp --resource-group inrule-prod-rg --location eastus -az appservice plan create --name APP_SERVICE_PLAN_NAME --resource-group RESOURCE_GROUP_NAME --location LOCATION -``` - -## Create Web App -Create the [Azure App Service Web App](https://docs.microsoft.com/en-us/azure/app-service/app-service-web-overview) for the Catalog Service with the [az webapp create](https://docs.microsoft.com/en-us/cli/azure/webapp#az-webapp-create) command: -```powershell -# Example: az webapp create --name contoso-catalog-prod-wa --plan inrule-prod-sp --resource-group inrule-prod-rg -az webapp create --name WEB_APP_NAME --plan APP_SERVICE_PLAN_NAME --resource-group RESOURCE_GROUP_NAME -``` - -## Deploy package -First, [download](https://github.com/InRule/AzureAppServices/releases/latest) the latest Catalog package (`InRule.Catalog.Service.zip`) from GitHub. Then [deploy the zip file](https://docs.microsoft.com/en-us/azure/app-service/app-service-deploy-zip) package to the Web App with the [az webapp deployment source](https://docs.microsoft.com/en-us/cli/azure/webapp/deployment/source#az-webapp-deployment-source-config-zip) command: -```powershell -# Example: az webapp deployment source config-zip --name contoso-catalog-prod-wa --resource-group inrule-prod-rg --src InRule.Catalog.Service.zip -az webapp deployment source config-zip --name WEB_APP_NAME --resource-group RESOURCE_GROUP_NAME --src FILE_PATH -``` - -## Upload valid license file -In order for Catalog Service to properly function, a valid license file must be uploaded to the web app. The simplest way to upload the license file is via FTP. - -First, retrieve the FTP deployment profile (url and credentials) with the [az webapp deployment list-publishing-profiles](https://docs.microsoft.com/en-us/cli/azure/webapp/deployment#az-webapp-deployment-list-publishing-profiles) command and put the values into a variable: -```powershell -# Example: az webapp deployment list-publishing-profiles --name contoso-catalog-prod-wa --resource-group inrule-prod-rg --query "[?contains(publishMethod, 'FTP')].{publishUrl:publishUrl,userName:userName,userPWD:userPWD}[0]" | ConvertFrom-Json -OutVariable creds | Out-Null -az webapp deployment list-publishing-profiles --name WEB_APP_NAME --resource-group RESOURCE_GROUP_NAME --query "[?contains(publishMethod, 'FTP')].{publishUrl:publishUrl,userName:userName,userPWD:userPWD}[0]" | ConvertFrom-Json -OutVariable creds | Out-Null -``` - -Then, upload the license file using those retrieved values: -```powershell -# Example: $client = New-Object System.Net.WebClient;$client.Credentials = New-Object System.Net.NetworkCredential($creds.userName,$creds.userPWD);$uri = New-Object System.Uri($creds.publishUrl + "/InRuleLicense.xml");$client.UploadFile($uri, "$pwd\InRuleLicense.xml"); -$client = New-Object System.Net.WebClient;$client.Credentials = New-Object System.Net.NetworkCredential($creds.userName,$creds.userPWD);$uri = New-Object System.Uri($creds.publishUrl + "/InRuleLicense.xml");$client.UploadFile($uri, "LICENSE_FILE_ABSOLUTE_PATH") -``` - -## Change the connection string -The Catalog application now needs to be configured to point to your Catalog database. -```powershell -# Example: az webapp config appsettings set --name contoso-catalog-prod-wa --resource-group inrule-prod-rg --settings inrule:repository:service:connectionString="Server=tcp:contoso-catalog-prod-sql.database.windows.net,1433;Initial Catalog=catalog-prod-db;Persist Security Info=False;User ID=admin;Password=%14TVpB*g$4b;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"; -az webapp config appsettings set --name WEB_APP_NAME --resource-group RESOURCE_GROUP_NAME --settings inrule:repository:service:connectionString="Server=tcp:SERVER_NAME.database.windows.net,1433;Initial Catalog=DATABASE_NAME;Persist Security Info=False;User ID=USER_NAME;Password=USER_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"; -``` - -## Verify using irAuthor -Using irAuthor you should now be able to connect to your catalog using the url [https://WEB_APP_NAME.azurewebsites.net/service.svc](https://WEB_APP_NAME.azurewebsites.net/service.svc). \ No newline at end of file