Skip to main content

Documentation Index

Fetch the complete documentation index at: https://arivu.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Azure offers multiple deployment options for Arivu, from simple App Service to enterprise-grade AKS Kubernetes.

Architecture Comparison

Step-by-Step Implementation

1

1. Create Azure Resource Group

# Install Azure CLI
# https://docs.microsoft.com/cli/azure/install-azure-cli

# Login to Azure
az login

# Create resource group
az group create \
  --name arivu-rg \
  --location eastus
2

2. Create Azure SQL Database

# Create SQL Server
az sql server create \
  --resource-group arivu-rg \
  --name arivu-server \
  --admin-user sqladmin \
  --admin-password ComplexPassword123!

# Create database
az sql db create \
  --resource-group arivu-rg \
  --server arivu-server \
  --name arivu_db \
  --service-objective Basic

# Get connection string
az sql db show-connection-string \
  --server arivu-server \
  --name arivu_db \
  --client psql
3

3. Create Azure Cache for Redis

az redis create \
  --resource-group arivu-rg \
  --name arivu-redis \
  --location eastus \
  --sku Basic \
  --vm-size c0

# Get connection string
az redis list-keys \
  --resource-group arivu-rg \
  --name arivu-redis \
  --query primaryKey
4

4. Create Storage Account

For static files and blobs:
az storage account create \
  --resource-group arivu-rg \
  --name arivustg \
  --location eastus \
  --sku Standard_LRS

# Create container
az storage container create \
  --account-name arivustg \
  --name frontend
5

5. Create App Service Plan

# Create plan
az appservice plan create \
  --name arivu-plan \
  --resource-group arivu-rg \
  --sku B2 \
  --is-linux

# Create Web App
az webapp create \
  --resource-group arivu-rg \
  --plan arivu-plan \
  --name arivu-backend \
  --runtime "PYTHON:3.10"
6

6. Create Container Registry

For managing Docker images:
az acr create \
  --resource-group arivu-rg \
  --name arivu \
  --sku Basic

# Build image in registry
az acr build \
  --registry arivu \
  --image arivu-backend:latest \
  --file Dockerfile .
7

7. Deploy Backend Container

# Enable managed identity
az webapp identity assign \
  --resource-group arivu-rg \
  --name arivu-backend

# Configure app settings
az webapp config appsettings set \
  --resource-group arivu-rg \
  --name arivu-backend \
  --settings \
    MEMORY_BACKEND=redis \
    REDIS_URL="redis://:password@arivu-redis.redis.cache.windows.net:6379/0" \
    DATABASE_URL="postgresql://..." \
    WEBSITES_PORT=8000

# Enable container deployment
az webapp config container set \
  --name arivu-backend \
  --resource-group arivu-rg \
  --docker-custom-image-name arivu.azurecr.io/arivu-backend:latest \
  --docker-registry-server-url https://arivu.azurecr.io \
  --docker-registry-server-user username \
  --docker-registry-server-password password
8

8. Deploy Frontend (Static Web App)

# Create static web app
az staticwebapp create \
  --resource-group arivu-rg \
  --name arivu-frontend \
  --source https://github.com/your-account/arivu \
  --location eastus \
  --branch main \
  --github-token ghp_xxxx

# Get static app URL
az staticwebapp show \
  --resource-group arivu-rg \
  --name arivu-frontend \
  --query url
9

9. Create Application Gateway

Route traffic to frontend and backend:
# Create public IP
az network public-ip create \
  --resource-group arivu-rg \
  --name arivu-pip

# Create Application Gateway
az network application-gateway create \
  --resource-group arivu-rg \
  --name arivu-appgw \
  --location eastus \
  --public-ip-address arivu-pip \
  --sku Standard_v2
10

10. Configure Auto-Scaling

# Get App Service Plan ID
PLAN_ID=$(az appservice plan show \
  --resource-group arivu-rg \
  --name arivu-plan \
  --query id)

# Create auto-scale setting
az monitor autoscale create \
  --resource-group arivu-rg \
  --resource $PLAN_ID \
  --resource-type "Microsoft.Web/serverfarms" \
  --name arivu-autoscale \
  --min-count 2 \
  --max-count 10 \
  --count 2

# Add scaling rule
az monitor autoscale rule create \
  --resource-group arivu-rg \
  --autoscale-name arivu-autoscale \
  --condition "Percentage CPU > 70" \
  --scale out 1

Dockerfile for Azure

FROM python:3.10-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
  build-essential libpq-dev curl && \
  rm -rf /var/lib/apt/lists/*

# Copy requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy app
COPY arivu ./arivu

# Expose port (Azure expects WEBSITES_PORT)
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
  CMD curl -f http://localhost:8000/api/health || exit 1

# Start server
CMD ["uvicorn", "arivu.dashboard.backend._app:app", \
     "--host", "0.0.0.0", "--port", "8000", \
     "--access-log", "--log-level", "info"]

Cost Breakdown (Monthly)

ComponentSizeCost
App ServiceB2 plan, 2 instances$50
Azure SQLBasic tier$5
Azure CacheBasic, 250 MB$15
Blob Storage100 GB$2
Static Web App1 appFree
Total$72/month

Security Best Practices

Azure Key Vault

Store secrets securely:
# Create key vault
az keyvault create \
  --resource-group arivu-rg \
  --name arivu-kv

# Store secrets
az keyvault secret set \
  --vault-name arivu-kv \
  --name openai-api-key \
  --value "sk-..."

# Access in app
az webapp config appsettings set \
  --resource-group arivu-rg \
  --name arivu-backend \
  --settings "@{[Email Protected]:/subscriptions/xxxx/resourceGroups/arivu-rg/providers/Microsoft.KeyVault/vaults/arivu-kv/secrets/openai-api-key"
  • Enable managed identity on App Service
  • Grant access to Key Vault and databases
  • No credential management needed
  • Virtual Network integration
  • Private endpoints for databases
  • Application Gateway WAF rules
  • DDoS Protection Standard
  • Azure Monitor for logs
  • Application Insights for tracing
  • Azure Policy for compliance
  • Log Analytics for analysis

CI/CD with Azure DevOps

trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

variables:
  dockerRegistryServiceConnection: 'arivu'
  imageRepository: 'arivu-backend'
  containerRegistry: 'arivu.azurecr.io'
  dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
  tag: '$(Build.BuildId)'

stages:
- stage: Build
  displayName: Build and Push
  jobs:
  - job: BuildImage
    displayName: Build Docker Image
    steps:
    - task: Docker@2
      displayName: Build and push image
      inputs:
        command: buildAndPush
        repository: $(imageRepository)
        dockerfile: $(dockerfilePath)
        containerRegistry: $(dockerRegistryServiceConnection)
        tags: |
          $(tag)
          latest

- stage: Deploy
  displayName: Deploy to App Service
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: DeployToAppService
    displayName: Deploy
    environment: 'production'
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureWebAppContainer@1
            inputs:
              azureSubscription: connection
              appName: arivu-backend
              imageName: $(containerRegistry)/$(imageRepository):$(tag)

Scaling Considerations

App Service Scaling

  • Auto scale based on CPU/Memory
  • 2-10 instances typical range
  • Scale out for traffic, in to save costs

Database Scaling

  • Azure SQL: DTU or vCore models
  • Read replicas for high traffic
  • Connection pooling in app

Troubleshooting

# Check logs
az webapp log download \
  --resource-group arivu-rg \
  --name arivu-backend

# Stream logs in real-time
az webapp log tail \
  --resource-group arivu-rg \
  --name arivu-backend
  • Check Firewall rules: Allow Azure services
  • Verify connection string format
  • Check SSL/TLS certificate if required
  • Check CPU/Memory metrics in Portal
  • Review Query Performance Insights
  • Increase databases DTU tier

Next Steps

  1. Customize settings: Adjust SKUs, regions, and scaling policies
  2. Set up CI/CD: Connect to GitHub/Azure DevOps
  3. Configure monitoring: Application Insights dashboards
  4. Plan DR strategy: Backup and disaster recovery
  5. Implement security: Azure AD, WAF, DDoS protection