🎥 Make videos programmatically with React
complete documentation for using azure container apps
alex fernandez9df6dae2dca8
diff --git a/packages/docs/docs/azure-container-apps.mdx b/packages/docs/docs/azure-container-apps.mdxnew file mode 100644index 0000000000..3d436de26f--- /dev/null+++ b/packages/docs/docs/azure-container-apps.mdx@@ -0,0 +1,177 @@+---+image: /generated/articles-docs-azure-container-apps.png+title: 'Deploying a Renderer to Azure Container Apps'+sidebar_label: 'Azure Container Apps'+crumb: 'Server-side rendering'+---++This guide provides a walkthrough for deploying Remotion rendering service with basic render queuing on [Azure Container Apps](https://azure.microsoft.com/en-us/products/container-apps).+++## Prerequisites++- A working Remotion project (e.g., from `npm create video`) with provision to use [Docker](https://www.docker.com/).+- An [Azure account](https://azure.microsoft.com/en-au/pricing/purchase-options/azure-account).+- A basic understanding of [Docker](https://www.docker.com/) and having it installed on your system is required.+- The [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/?view=azure-cli-latest) installed, authenticated (`azure login`) and a subscription is selected after authentication.+- The Azure account is provisioned to use GPU on `Azure Container Apps`, if not, request [here](https://aka.ms/aca/gpus-request-access).+- A [docker hub account](https://www.docker.com/get-started/) to host the docker image and authenticate (`docker login`).+++## Step 1: Pick a project++For simplicity, we'll use [remotion-gpu](https://github.com/alexfernandez803/remotion-azure) which is configured to leverage GPU acceleration. This project is based with [Remotion render server template](https://github.com/remotion-dev/template-render-server) and uses the [scene](https://github.com/remotion-dev/gpu-scene/blob/main/src/Root.tsx#L23) composition from [gpu-scene](https://github.com/remotion-dev/gpu-scene) project.++## Step 2: Build and tag the docker image++From the project directory, build the Docker image and push it to Docker Hub with your account, specifying an image name and version tag. The `image-name` is `remotion-docker-gpu` and `version` is `1.0.0`.++```bash+docker build -t your-dockerhub-username/remotion-docker-gpu:1.0.0 .+```++## Step 3: Push the image to docker hub++```bash+docker push your-dockerhub-username/remotion-docker-gpu:1.0.0+```++## Step 4: Set environment variables++Set the environment variables for the `azure cli`++```bash title="set evironment variables"+CONTAINER_IMAGE="docker.io/your-dockerhub-username/remotion-docker-gpu:1.0.0"+RESOURCE_GROUP="<RESOURCE_GROUP>"+ENVIRONMENT_NAME="<ENVIRONMENT_NAME>"+LOCATION="swedencentral"+CONTAINER_APP_NAME="<CONTAINER_APP_NAME>"+WORKLOAD_PROFILE_NAME="NC8as-T4"+WORKLOAD_PROFILE_TYPE="Consumption-GPU-NC8as-T4"+```+### Variable representation+- `CONTAINER_IMAGE` represents the `docker.io` domain and docker image.+- `LOCATION` represents the region where the GPU is allocated.+- `WORKLOAD_PROFILE_NAME` and `WORKLOAD_PROFILE_TYPE` are constant variables from Azure [documentation](https://learn.microsoft.com/en-us/azure/container-apps/gpu-image-generation?pivots=azure-cli) representing GPU family to use.+++## Step 5: Create the resource group++```bash+az group create \+ --name $RESOURCE_GROUP \+ --location $LOCATION \+ --query "properties.provisioningState"+```+++## Step 6: Register insights for monitoring++```bash+az provider register -n Microsoft.OperationalInsights --wait++```++## Step 7: Create a Container Apps environment++```bash+az containerapp env create \+ --name $ENVIRONMENT_NAME \+ --resource-group $RESOURCE_GROUP \+ --location "$LOCATION" \+ --query "properties.provisioningState"+```++## Step 8: Add a workload profile to your environment++```bash+az containerapp env workload-profile add \+ --name $ENVIRONMENT_NAME \+ --resource-group $RESOURCE_GROUP \+ --workload-profile-name $WORKLOAD_PROFILE_NAME \+ --workload-profile-type $WORKLOAD_PROFILE_TYPE+```++## Step 9: Deploy container app++```bash+az containerapp create \+ --name $CONTAINER_APP_NAME \+ --resource-group $RESOURCE_GROUP \+ --environment $ENVIRONMENT_NAME \+ --image $CONTAINER_IMAGE \+ --target-port 3000 \+ --ingress external \+ --cpu 8.0 \+ --memory 56.0Gi \+ --workload-profile-name $WORKLOAD_PROFILE_NAME \+ --query properties.configuration.ingress.fqdn+```++`Azure CLI` will deploy the image to `Azure Container Apps` when completed will provide a url which accepts `HTTP` request.++```bash title="Deployment Output (example)"+Container app created. Access your app at https://remotion-gpu.grayocean-24741fc9.australiaeast.azurecontainerapps.io/+"remotion-gpu.grayocean-24741fc9.australiaeast.azurecontainerapps.io"+```++:::note+The `target-port` is the `port` that the `Node.js` server listens on for incoming requests. Steps 4 to 9 are based on the [Azure Container App](https://learn.microsoft.com/en-us/azure/container-apps/gpu-image-generation?pivots=azure-cli) documentation.+:::++## Step 10: Trigger a Render++Send a POST request to the service's /renders endpoint. Replace `YOUR_SERVICE_URL` with the URL from the deployment output, `https://remotion-gpu.grayocean-24741fc9.australiaeast.azurecontainerapps.io/`.++```bash+curl -X POST {YOUR_SERVICE_URL}/renders \+-H "Content-Type: application/json" \+-d '{}'+```++### Response++If successful, the API will respond with `JSON` containing the `jobId` which can be used to get the status of render.++```json title="Example Response"+{+ "jobId":"955338f6-2607-48bd-bedb-6d4c98f7b4dc"+}+```++## Step 11: Get render status++Send a GET request to the get the render status, replace `YOUR_SERVICE_URL` with the URL from the deployment output and the `jobId` from the render request output.++```bash+curl {YOUR_SERVICE_URL}/renders/{jobId}+```++### Response+```json title="Example Response"+{+ "status":"completed",+ "videoUrl":"/renders/955338f6-2607-48bd-bedb-6d4c98f7b4dc.mp4",+ "data":{"titleText":"Hello, world!"}+}+```++If `status` is `completed`, combine `YOUR_SERVICE_URL` and the `video_url` response to generate the download link (`https://remotion-gpu.grayocean-24741fc9.australiaeast.azurecontainerapps.io/renders/955338f6-2607-48bd-bedb-6d4c98f7b4dc.mp4`).+++## Step 12: (`Optional`) Delete the resource group++```bash+az group delete --name $RESOURCE_GROUP+```+This will delete all the resource inside the resource group including application container.+++:::warning+Cost: This implementation does not include cost management. Refer to Azure pricing documentation for usage estimates. Use at your own risk.+Performance: Generated videos may appear blurry. GPU acceleration is configured in the project [config](https://github.com/alexfernandez803/remotion-azure/blob/main/remotion.config.ts#L6), but actual GPU utilization has not been confirmed.+:::+++## See also+- [Cloudflare Containers](/docs/cloudflare-containers)diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex 15ac0ab78a..01926fbd5b 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -904,6 +904,7 @@ const sidebars: SidebarsConfig = {'compare-ssr','distributed-rendering','cloudflare-containers',+ 'azure-container-apps',],},{diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 7f4edc6f5b..62bc3bf0f5 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -368,6 +368,15 @@ export const articles = [noAi: false,slug: 'audio-buffer-to-data-url',},+ {+ id: 'azure-container-apps',+ title: 'Deploying a Renderer to Azure Container Apps',+ relativePath: 'docs/azure-container-apps.mdx',+ compId: 'articles-docs-azure-container-apps',+ crumb: 'Server-side rendering',+ noAi: false,+ slug: 'azure-container-apps',+ },{id: 'brownfield',title: 'Installing Remotion in an existing project',@@ -3131,15 +3140,6 @@ export const articles = [noAi: false,slug: 'miscellaneous/cloud-gpu',},- {- id: 'miscellaneous/cloudflare-containers',- title: 'Deploying a Renderer to Cloudflare Containers',- relativePath: 'docs/miscellaneous/cloudflare-containers.mdx',- compId: 'articles-docs-miscellaneous-cloudflare-containers',- crumb: 'Server-side rendering',- noAi: false,- slug: 'miscellaneous/cloudflare-containers',- },{id: 'cross-origin-isolation',title: 'Cross-Origin Isolation',diff --git a/packages/docs/static/generated/articles-docs-azure-container-apps.png b/packages/docs/static/generated/articles-docs-azure-container-apps.pngnew file mode 100644index 0000000000..7486baa587Binary files /dev/null and b/packages/docs/static/generated/articles-docs-azure-container-apps.png differ