diff --git a/.github/workflows/podcast-web.yml b/.github/workflows/podcast-web.yml index 3322992..44c595d 100644 --- a/.github/workflows/podcast-web.yml +++ b/.github/workflows/podcast-web.yml @@ -45,7 +45,6 @@ jobs: azPSVersion: "latest" inlineScript: | az extension add --name containerapp - az provider register --namespace Microsoft.App $apiUrl = "https://$(az containerapp show -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} -n ${{ env.API_RESOURCE_NAME }} -o tsv --query properties.configuration.ingress.fqdn)" $listenTogetherHubUrl = "https://${{ secrets.HUB_WEBAPP_NAME }}.azurewebsites.net/listentogether" echo "PODCAST_API_URL=$apiUrl" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append diff --git a/Deploy-websites-services.md b/Deploy-websites-services.md index 0fe569a..f0c8aa0 100644 --- a/Deploy-websites-services.md +++ b/Deploy-websites-services.md @@ -35,13 +35,29 @@ First, you need to create an Azure Resource group within your subscription. If y To create the resource group, run the following command in the terminal: ```console -az group create --name podcastrg --location westus2 +az group create --name podcastrg --location canadacentral ``` The above resource group name will be added to the GitHub secrets in a later step. If you decide to use your own resource group name, be sure to update the same later. Checkout [Azure CLI](https://docs.microsoft.com/azure/azure-resource-manager/management/manage-resource-groups-cli) or [Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/quickstart#create-a-resource-group) if you need additional help to set up a resource group. +### Register Subscription dependencies + +Run the following command to ensure the following dependencies + +```console +az provider register --namespace Microsoft.ContainerRegistry +``` + +and also Microsoft.App + +```console +az provider register --namespace Microsoft.App +``` + +> If you see errors similar to "The subscription is not registered to use namespace `'Microsoft.'`", execute the command az provider register --namespace `'Microsoft.'` in Azure CLI and re-run the failed jobs again. + ### Configure Azure Credentials in GitHub Secrets To connect GitHub Actions, you will create a secret named `AZURE_CREDENTIALS` that you can use to authenticate with Azure. @@ -72,7 +88,7 @@ To connect GitHub Actions, you will create a secret named `AZURE_CREDENTIALS` th ![Select Settings in the navigation](docs/github-repo-settings.png) -1. Select **Secrets** and then **New Secret**. +1. Under **Security** Select **Secrets** -> **Actions** and then **New repository secret**. ![Choose to add a secret](docs/select-secrets.png) @@ -113,7 +129,9 @@ Go to the GitHub actions tab, and enable the workflows. ## Run the Podcast API CICD first -The backend services need to be run first to set up all necessary dependencies, databases, and blob storage. You can manually run this from the `Actions` tab, click on `Select workflow` -> `Podcast API CICD` -> `Run workflow`. +> IMPORTANT: The backend services need to be run first to set up all necessary dependencies, databases, and blob storage. + +You can manually run this from the `Actions` tab, click on `Select workflow` -> `Podcast API CICD` -> `Run workflow`. Wait for the workflow run to complete and execute the next steps. The first time you run this it will take a bit longer as it creates all of the Azure resources. @@ -121,7 +139,13 @@ Wait for the workflow run to complete and execute the next steps. The first time Next we will wanto to deploy the listen together hub and the web app. -You can manually run the Hub action from the `Actions` tab, click on `Select workflow` -> `Podcast Hub CICD` -> `Run workflow`. Then run the web action with `Select workflow` -> `Podcast Web CICD` -> `Run workflow` +You can manually run the Hub action from the `Actions` tab, click on: +* `Select workflow` -> `Podcast Hub CICD` -> `Run workflow`. + +> Note: If deploy fails, re-run as it may be a timing issue. + +Then run the web action with: +* `Select workflow` -> `Podcast Web CICD` -> `Run workflow` Once all the runs are complete, you'll see something like this under the Actions tab. diff --git a/docs/azure-secret-add.png b/docs/azure-secret-add.png index 73abfa4..1e12858 100644 Binary files a/docs/azure-secret-add.png and b/docs/azure-secret-add.png differ diff --git a/docs/select-secrets.png b/docs/select-secrets.png index 24118c9..cdb6632 100644 Binary files a/docs/select-secrets.png and b/docs/select-secrets.png differ diff --git a/src/Services/Podcasts/Podcast.Ingestion.Worker/PodcastIngestionHandler.cs b/src/Services/Podcasts/Podcast.Ingestion.Worker/PodcastIngestionHandler.cs index 160e67a..c643921 100644 --- a/src/Services/Podcasts/Podcast.Ingestion.Worker/PodcastIngestionHandler.cs +++ b/src/Services/Podcasts/Podcast.Ingestion.Worker/PodcastIngestionHandler.cs @@ -28,7 +28,7 @@ public class PodcastIngestionHandler : IPodcastIngestionHandler CancellationToken stoppingToken) { _logger.LogInformation($"The show {title} at {url} was received by the ingestion worker."); - var isExistingShow = await _podcastDbContext.Feeds.AnyAsync(feed => string.Equals(feed.Url, url, StringComparison.OrdinalIgnoreCase), stoppingToken); + var isExistingShow = await _podcastDbContext.Feeds.AnyAsync(feed => feed.Url.ToLower() == url.ToLower(), stoppingToken); if (isExistingShow) return; @@ -39,7 +39,7 @@ public class PodcastIngestionHandler : IPodcastIngestionHandler _logger.LogInformation($"The show {title} at {url} was not automatically approved."); // Must be manually approved var userFeed = new UserSubmittedFeed( - title, url, string.Join(",", feedCategories)); + url, title, string.Join(",", feedCategories)); await _podcastDbContext.UserSubmittedFeeds.AddAsync(userFeed, stoppingToken); await _podcastDbContext.SaveChangesAsync(stoppingToken); _logger.LogInformation($"The show {title} at {url} was saved as a user-submitted feed.");