Skip to content

How to deploy FairPlayCombined?

Eduardo Fonseca edited this page Jun 10, 2024 · 14 revisions

Before reading this page, it is recommended you first read the official .NET Aspire Deployment Documentation

Pre-Requisites

Follow the following first How-to-setup-FairPlayCombined

Database

  • Create an Azure SQL Database, given that the platform uses background service, which are querying the database very often, it is recommended you use a DTU-based database.
  • Configure the database server to allow connections from other Azure Resources.
  • Save the connectionstring to use it later.

Deployment Steps

  • Make sure to install Azure Developer CLI by, you can do it by running the following in a command prompt:

winget install microsoft.azd

  • Make sure to configure your secrets.json with all the required secrets and enable only the projects you want deployed.

  • In the same command prompt navigate to the directory containing the file "GenerateAspireManifest.bat". This file is to create a deployment manifest if desired, for now, just ignore it.

  • Run azd init, it will ask you a name, this is the name that will be used for your new Azure Resource Group, make sure to use one that does not exist yet.

  • Run azd up, the process will request your subscription, the region and the database connectionstring, fill the values.

  • Once the process finishes it will give show your .NET Aspire Dashboard Url, if it loads correctly, your deployment is successful.

Note: Before running any of the main apps, you must do the following

  • Navigate to the Admin Portal.
  • Register a new user
  • Manually set that user rule to be "SystemAdmin", through an sql script.
  • Log in to the admin portal with your admin user.
  • Navigate to the Configure Secrets page, and input all of the configuration values.
  • Once that's done you should be able to run the main apps.

Note: You may need to restart the VideoIndexing service, since it would probably have failed trying to find the configuration secrets before you add them.

Configuring Custom Domains

Real World production applications often have custom domains, you can configure it through the Azure Portal. Follow the Azure documentation to configure them:

Custom domain names and bring your own certificates in Azure Container Apps

Note: If you use Custom Domains, and re-deploy your app, the deployment process will delete the custom domains. See the following GitHub items:

According to the threads, for now, you should be able to persist your custom domains using the following command before re-deploying your app. Check if you have an azd version supporting the feature flag

  • Run

azd list-alpha

If persistDomains does not show in the list, then proceed to install this version of the CLI. Azure Dev CLI Install Instructions

  • Now run

azd config set alpha.aca.persistDomains on

Now custom domains should persist after re-deployments.

CORS

If you upload videos and try to play them after from the Home Page, you may get a CORS error on the Storage Account supporting your Azure Video Indexer Account. To fix the issue, you need enable CORS in the Storage Account:

  • Allowed origins: https://*.yourdomain
  • Allowed methods: GET

Session Affinity

If some applications, such as FairPlayTube, you may get an error like the one in the image below. image

If you get that error, enable Session Affinity in your Container App. For now, this process must be done manually. To stay updated on progress for this within .NET Aspire see this GitHub Issue and comment

Localization Resources

If you run the app, you may notice some text shows the values of the Resource Keys. To fix this, make sure to run the "LocalizationGenerator" service from your development environment. The service will inspect the code for the Resource Keys and translate them. This process needs to be executed only in two situations:

  • Initial Setup
  • New Resource Keys Added
Clone this wiki locally