# Enterprise Deployment Guide for Azure

Deploying RagaAI Catalyst on your Azure infrastructure ensures that your data remains secure and within your control. Follow these steps to set up RagaAI Catalyst in your Azure account.

1. [Provision Base Infrastructure](#provision-base-infrastructure)
2. [Installation Execution](#install-raga-catalyst)
3. [Verify Installation](#access-raga-catalyst)

## Provision Base Infrastructure

To get started quickly, you can use the Terraform Templates and scripts provided by the Raga team:

### Pre-Requirements

* **Set Up Azure User:** The user running the installation should have Contributor and User Access Administrator roles.
* **Resource Provider Quotas:** Ensure that you have sufficient quota for the Standard\_D8a\_v4 VM with minimum 16 available vCPUs, in your target region for AKS Node Pools.
* Ensure that your system supports Bash commands
* The following CLI tools should be installed:
  * [terraform](https://developer.hashicorp.com/terraform/install)
  * [azure cli](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)
  * [python](https://www.python.org/downloads/)

### Azure Login using CLI

<details>

<summary>Option A: Using az login</summary>

```bash
az login
```

This will open a browser window for authentication.

</details>

<details>

<summary>Option B: Using Service Principal</summary>

```bash
export AZURE_CLIENT_ID=your-client-id
export AZURE_CLIENT_SECRET=your-client-secret
export AZURE_TENANT_ID=your-tenant-id
export AZURE_SUBSCRIPTION_ID=your-subscription-id
```

</details>

**Validate Azure CLI Login:**

```bash
az account show
```

### Execute the following command to Provision the Environment:

Extract the TAR file provided by the RagaAI team:

```bash
tar -zxvf raga-catalyst-terraform-azure-<version>.tar
```

`azure-infra.sh` is the cloud provisioning script. This uses python, azure cli and terraform to provision the base infra.

```bash
bash azure-infra.sh --location=<location> --customer-name=<customer-name>
```

Replace placeholders:

* `<location>`: Azure region (e.g., eastus)
* `<customer-name>`: This will be prifix for all azure resources

#### List of Azure Resources Provisioned by RagaAI Terraform Infrastructure

> Note: You can also set up your cloud environment using the following requirements as an Alternative to the RagaAI Terraform templates

<details>

<summary>Storage Account</summary>

Create Storage Account with Blob Container and configure CORS with the following settings:

* Allowed Methods: GET, PUT
* Allowed Origins: \* (all origins)
* Allowed Headers: \* (all headers)
* Exposed Headers: none
* Max Age: 3000 seconds

</details>

<details>

<summary>AKS Cluster</summary>

* Kubernetes v1.24+ (Recommend containerd runtime)
* Ensure sufficient quota for compute resources
* **Node Pool Configuration**

  | **Node Pool**      | **VM Type**       | **vCPU & Memory** | **Min Size** | **OS Disk** | **Architecture** | **Taints** | **Labels** |
  | ------------------ | ----------------- | ----------------- | ------------ | ----------- | ---------------- | ---------- | ---------- |
  | **AMD Node Group** | Standard\_D8a\_v4 | 8vCPU & 32GB      | 2 nodes      | 64 GB       | x86\_64          | N/A        | N/A        |
* **Cluster Add-ons**
  * Azure Disk CSI Driver
* **Cluster Autoscaler**
  * Enable cluster autoscaler for node pools

</details>

<details>

<summary>Azure Database for MySQL</summary>

* SKU: General Purpose
* Compute: 2 vCore
* Memory: 8 GiB RAM
* Storage: 50 GB
* Version: MySQL 8.0

</details>

<details>

<summary>Virtual Machine</summary>

* Create a VM in a public subnet to act as a bastion/jump box
  * Size: Standard\_B1s (1 vCPU and 1 GB Memory)
  * OS Disk: 8 GB
* Network Security Group for bastion host
  * Inbound Rules:
    * Allow SSH (port 22)
  * Outbound Rules:
    * Allow all outbound within VNet
* Network Security Group for internal load balancer
  * Inbound Rules:
    * Allow HTTP (port 80) from VNet
    * Allow HTTPS (port 443) from VNet
  * Outbound Rules:
    * Allow all outbound within VNet

</details>

<details>

<summary>Virtual Network</summary>

* Virtual Network with address space
* 2 Public and 2 private subnets
* Route table for private subnets
* NAT Gateway for private subnet outbound

</details>

## Install Raga Catalyst

#### Install Raga Catalyst:

* SSH into the bastion VM and run the installation command
* [Configure azure cli](#azure-login-using-cli)

Download and Extract the TAR file provided by the RagaAI team:

```bash
curl -o $HOME/raga-catalyst-azure-deploy-<version>.tar "<URL>"
tar -zxvf $HOME/raga-catalyst-azure-deploy-<version>.tar
```

`raga-catalyst-azure-deploy.sh` is the Catayst deployment script.

> Note: Update the `.env` file with credentials.

```bash
bash raga-catalyst-azure-deploy.sh --location=<location> --customer-name=<customer-name> --release-tag=<release-tag>
```

* `<location>`: Azure region
* `<customer-name>`: This will be prifix for all azure resources
* `<release-tag>`: Get the release version from Raga team

## Access Raga Catalyst

Access Catalyst UI with the private load balancer IP/DNS

* Portal: `http://<Load_Balancer_IP>`
* API: `http://<Load_Balancer_IP>/api`

***

For any issues during the deployment process or additional assistance, please contact our support team at <contact@raga.ai>.
