|
| 1 | +# Azure Deployment with Azure Developer CLI (azd) |
| 2 | + |
| 3 | +This guide shows how to deploy the Visionary Lab to Azure using the Azure Developer CLI for one-click deployments. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [Azure Developer CLI (azd)](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd) installed |
| 8 | +- Azure subscription with access to: |
| 9 | + - Azure Container Apps |
| 10 | + - Azure OpenAI Service (with GPT-4o, DALL-E 3, and Sora deployments) |
| 11 | + - Azure Storage Account |
| 12 | + - Azure Log Analytics |
| 13 | + |
| 14 | +## Quick Start (One-Click Deployment) |
| 15 | + |
| 16 | +1. **Clone the repository**: |
| 17 | + ```bash |
| 18 | + git clone <repository-url> |
| 19 | + cd visionary-lab |
| 20 | + ``` |
| 21 | + |
| 22 | +2. **Authenticate and deploy**: |
| 23 | + ```bash |
| 24 | + azd auth login |
| 25 | + azd up |
| 26 | + ``` |
| 27 | + |
| 28 | +3. **Configure during deployment**: |
| 29 | + When prompted by `azd up`, provide your Azure OpenAI service details in this order: |
| 30 | + |
| 31 | + **LLM Configuration:** |
| 32 | + - **LLM_AOAI_RESOURCE**: Your Azure OpenAI resource name for LLM |
| 33 | + - **LLM_DEPLOYMENT**: Your GPT deployment name (e.g., "gpt-4.1") |
| 34 | + - **LLM_AOAI_API_KEY**: Your LLM API key |
| 35 | + |
| 36 | + **Image Generation Configuration:** |
| 37 | + - **IMAGEGEN_AOAI_RESOURCE**: Your Azure OpenAI resource name for image generation |
| 38 | + - **IMAGEGEN_DEPLOYMENT**: Your image generation deployment name (e.g., "gpt-image-1") |
| 39 | + - **IMAGEGEN_AOAI_API_KEY**: Your image generation API key |
| 40 | + |
| 41 | + **Sora Configuration:** |
| 42 | + - **SORA_AOAI_RESOURCE**: Your Azure OpenAI resource name for Sora |
| 43 | + - **SORA_DEPLOYMENT**: Your Sora deployment name (e.g., "sora") |
| 44 | + - **SORA_AOAI_API_KEY**: Your Sora API key |
| 45 | + |
| 46 | +That's it! The `azd up` command will: |
| 47 | +- Create a new environment |
| 48 | +- Prompt for required Azure OpenAI configuration (resource names, deployments, API keys) |
| 49 | +- Provision all Azure resources (Container Registry, Container Apps, Storage, etc.) |
| 50 | +- Build Docker images for frontend and backend |
| 51 | +- Push images to your private Azure Container Registry |
| 52 | +- Deploy both services to Azure Container Apps |
| 53 | +- Configure networking, authentication, and environment variables |
| 54 | +- Provide you with the application URLs |
| 55 | + |
| 56 | +## Manual Steps |
| 57 | + |
| 58 | +If you prefer manual control over the deployment process: |
| 59 | + |
| 60 | +### 1. Initialize Environment |
| 61 | +```bash |
| 62 | +azd env new <environment-name> |
| 63 | +``` |
| 64 | + |
| 65 | +### 2. Configure Environment Variables |
| 66 | +Set your Azure OpenAI service details: |
| 67 | +```bash |
| 68 | +# LLM OpenAI |
| 69 | +azd env set LLM_AOAI_RESOURCE "your-openai-resource-name" |
| 70 | +azd env set LLM_DEPLOYMENT "gpt-4.1" |
| 71 | +azd env set LLM_AOAI_API_KEY "your-gpt-key" |
| 72 | + |
| 73 | +# Image Generation OpenAI |
| 74 | +azd env set IMAGEGEN_AOAI_RESOURCE "your-openai-resource-name" |
| 75 | +azd env set IMAGEGEN_DEPLOYMENT "gpt-image-1" |
| 76 | +azd env set IMAGEGEN_AOAI_API_KEY "your-image-gen-key" |
| 77 | + |
| 78 | +# Sora OpenAI |
| 79 | +azd env set SORA_AOAI_RESOURCE "your-openai-resource-name" |
| 80 | +azd env set SORA_DEPLOYMENT "sora" |
| 81 | +azd env set SORA_AOAI_API_KEY "your-sora-key" |
| 82 | +``` |
| 83 | + |
| 84 | +### 3. Deploy Infrastructure |
| 85 | +```bash |
| 86 | +azd provision |
| 87 | +``` |
| 88 | + |
| 89 | +### 4. Deploy Application |
| 90 | +```bash |
| 91 | +azd deploy |
| 92 | +``` |
| 93 | + |
| 94 | +## Architecture |
| 95 | + |
| 96 | +The deployment creates: |
| 97 | + |
| 98 | +- **Azure Container Apps Environment**: Serverless container hosting |
| 99 | +- **Backend Container App**: FastAPI application (Python) |
| 100 | +- **Frontend Container App**: Next.js application (Node.js) |
| 101 | +- **Azure Container Registry**: Private registry for storing Docker images |
| 102 | +- **Azure Storage Account**: For storing generated images and videos |
| 103 | +- **Log Analytics Workspace**: For monitoring and logging |
| 104 | + |
| 105 | +## Environment Variables |
| 106 | + |
| 107 | +The following environment variables are automatically configured: |
| 108 | + |
| 109 | +### Backend & Frontend |
| 110 | +- `AZURE_STORAGE_ACCOUNT_NAME`: Auto-generated storage account |
| 111 | +- `AZURE_BLOB_SERVICE_URL`: Storage endpoint URL |
| 112 | +- `AZURE_STORAGE_ACCOUNT_KEY`: Storage access key |
| 113 | +- `AZURE_BLOB_IMAGE_CONTAINER`: Container for images (default: "images") |
| 114 | +- `AZURE_CONTAINER_REGISTRY_ENDPOINT`: Container registry login server |
| 115 | + |
| 116 | +### AI Services (All Configurable) |
| 117 | +**LLM Configuration:** |
| 118 | +- `LLM_AOAI_RESOURCE`: LLM OpenAI resource name |
| 119 | +- `LLM_DEPLOYMENT`: LLM deployment name |
| 120 | +- `LLM_AOAI_API_KEY`: LLM API key |
| 121 | + |
| 122 | +**Image Generation Configuration:** |
| 123 | +- `IMAGEGEN_AOAI_RESOURCE`: Image generation OpenAI resource name |
| 124 | +- `IMAGEGEN_DEPLOYMENT`: Image generation deployment name |
| 125 | +- `IMAGEGEN_AOAI_API_KEY`: Image generation API key |
| 126 | + |
| 127 | +**Sora Configuration:** |
| 128 | +- `SORA_AOAI_RESOURCE`: Sora OpenAI resource name |
| 129 | +- `SORA_DEPLOYMENT`: Sora deployment name |
| 130 | +- `SORA_AOAI_API_KEY`: Sora API key |
| 131 | + |
| 132 | +## Monitoring |
| 133 | + |
| 134 | +Access your deployment logs and metrics: |
| 135 | + |
| 136 | +```bash |
| 137 | +# View application logs |
| 138 | +azd logs |
| 139 | + |
| 140 | +# Monitor resources in Azure Portal |
| 141 | +azd show --output table |
| 142 | +``` |
| 143 | + |
| 144 | +## Cleanup |
| 145 | + |
| 146 | +To remove all Azure resources: |
| 147 | + |
| 148 | +```bash |
| 149 | +azd down |
| 150 | +``` |
| 151 | + |
| 152 | +## Troubleshooting |
| 153 | + |
| 154 | +### Common Issues |
| 155 | + |
| 156 | +1. **Missing OpenAI Resources**: Ensure you have created Azure OpenAI resources with the required model deployments |
| 157 | +2. **Permission Issues**: Verify your Azure account has Contributor access to the subscription |
| 158 | +3. **Region Availability**: Some OpenAI models may not be available in all regions |
| 159 | + |
| 160 | +### Getting Help |
| 161 | + |
| 162 | +```bash |
| 163 | +# Check azd status |
| 164 | +azd env list |
| 165 | + |
| 166 | +# View detailed logs |
| 167 | +azd logs --follow |
| 168 | + |
| 169 | +# Get environment info |
| 170 | +azd env get-values |
| 171 | +``` |
| 172 | + |
| 173 | +For more information, see the [Azure Developer CLI documentation](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/). |
0 commit comments