packages/docs/docs/azure-container-apps.mdx
:::note This guide has been contributed by the community and has not yet been tested by the Remotion team. :::
This guide provides a walkthrough for deploying Remotion rendering service with basic render queuing on Azure Container Apps.
npm create video) with provision to use Docker.azure login) and a subscription is selected after authentication.Azure Container Apps, if not, request here.docker login).For simplicity, we'll use remotion-gpu which is configured to leverage GPU acceleration. This project is based with Remotion render server template and uses the scene composition from gpu-scene project.
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.
docker build -t your-dockerhub-username/remotion-docker-gpu:1.0.0 .
docker push your-dockerhub-username/remotion-docker-gpu:1.0.0
Set the environment variables for the azure cli
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"
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 representing GPU family to use.az group create \
--name $RESOURCE_GROUP \
--location $LOCATION \
--query "properties.provisioningState"
az provider register -n Microsoft.OperationalInsights --wait
az containerapp env create \
--name $ENVIRONMENT_NAME \
--resource-group $RESOURCE_GROUP \
--location "$LOCATION" \
--query "properties.provisioningState"
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
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 and when completed will provide a URL which accepts HTTP requests.
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 documentation.
:::
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/.
curl -X POST {YOUR_SERVICE_URL}/renders \
-H "Content-Type: application/json" \
-d '{}'
If successful, the API will respond with JSON containing the jobId which can be used to get the status of render.
{
"jobId": "955338f6-2607-48bd-bedb-6d4c98f7b4dc"
}
Send a GET request to get the render status, replace YOUR_SERVICE_URL with the URL from the deployment output and the jobId from the render request output.
curl {YOUR_SERVICE_URL}/renders/{jobId}
{
"status": "completed",
"videoUrl": "/renders/955338f6-2607-48bd-bedb-6d4c98f7b4dc.mp4",
"data": {"titleText": "Hello, world!"}
}
If status is completed, combine YOUR_SERVICE_URL and the videoUrl response to generate the download link (https://remotion-gpu.grayocean-24741fc9.australiaeast.azurecontainerapps.io/renders/955338f6-2607-48bd-bedb-6d4c98f7b4dc.mp4).
Optional) Delete the resource groupaz group delete --name $RESOURCE_GROUP
This will delete all the resources inside the resource group including the 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, but actual GPU utilization has not been confirmed. :::