platformplatform / PlatformPlatform

🚀 Pre-alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
https://platformplatform.github.io
MIT License
226 stars 24 forks source link

Make Azure location configurable #476

Closed tjementum closed 3 months ago

tjementum commented 3 months ago

Summary & Motivation

Remove the hardcoded West Europe location when deploying Azure resources, making the location configurable using GitHub variables. This change allows for more flexible and dynamic deployment configurations and addresses the AKSCapacityError triggered by the West Europe region running out of capacity for Azure Container Apps.

Include a curated list of Azure Data Centers with names and acronyms that can be used for naming Azure resources (e.g., EastUs/eus and Germany West Central/gwc).

Update the GitHub configuration to support different Azure subscriptions, splitting the Azure Service Principal used for deploying resources into separate ones for Staging and Production. This enhances security and management of deployment environments.

Grant the Service Principal for Staging and Production different permissions, e.g., only the Staging Service Principal can be used when detecting changes to infrastructure on pull requests, while the Production Service Principal can only be used when triggered from the main branch.

Remove deployment bash scripts like production-west-europe.sh, consolidating all configurations into GitHub variables. This includes moving soft secrets like TENANT_ID and SERVICE_PRINCIPAL_ID to the variables page. Now there are 2 shared variables (TENANT_ID and UNIQUE_PREFIX), 5 environment variables (like PRODUCTION_SUBSCRIPTION_ID, PRODUCTION_SERVICE_PRINCIPAL_ID, PRODUCTION_SHARED_LOCATION, PRODUCTION_SQL_ADMIN_OBJECT_ID, and PRODUCTION_DOMAIN_NAME), and 3 cluster variables (like PRODUCTION_CLUSTER1_LOCATION, PRODUCTION_CLUSTER1_LOCATION_ACRONYM, and PRODUCTION_CLUSTER1_ENABLED). The ENABLED flag defaults to true for the Staging environment and false for the Production environment.

Extract a reusable GitHub workflow for deploying infrastructure, making adding new clusters as simple as duplicating one job in the cloud-infrastructure.yml file and _deploy-container.yml and adding 3 GitHub variables like PRODUCTION_CLUSTER2_LOCATION, PRODUCTION_CLUSTER2_LOCATION_ACRONYM, and PRODUCTION_CLUSTER2_ENABLED.

Major update to the configure-continuous-deployments CLI command to collect the new information, making it more resilient to errors. It will no longer continue triggering GitHub actions if the previous workflow failed, and in case of errors, a clear message will be shown. Additionally, on success, it will now report how long the full deployment took.

Checklist

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud