This repository demonstrates how to implement the Strangler Fig Pattern using Azure services such as Azure App Service, Azure Functions, Azure Cosmos DB, and Azure API Management. The project includes Bicep templates for infrastructure deployment, Python code for the legacy monolithic application and new microservices, and GitHub Actions workflows for continuous integration and deployment.
/infrastructure
: Contains the Bicep template for deploying Azure resources and the GitHub Action for automating the deployment./legacy-app-service
: Contains the Python code for the legacy monolithic application and a GitHub Action to deploy it to Azure App Service./ExtractedFunction
: Contains the Python code for the new Azure Function that replaces part of the legacy functionality and a GitHub Action to deploy it.
The Strangler Fig Pattern is a migration strategy that allows you to gradually replace parts of a legacy system with new microservices or components. Instead of a risky, large-scale migration, you "strangle" the old system incrementally by routing specific functionality to new services. This pattern reduces risk, allows continuous operation, and supports incremental improvements.
- Azure Subscription: An active Azure account.
- Azure CLI: Installed and configured.
- GitHub Repository: Clone this repository to your local machine.
-
Deploy Infrastructure:
- Navigate to the
/infrastructure
folder. - Run the GitHub Action to deploy the Bicep template.
- Navigate to the
-
Deploy the Legacy Application:
- Navigate to the
/legacy-app-service
folder. - Run the GitHub Action to deploy the Python app to Azure App Service.
- Navigate to the
-
Deploy the New Feature Function:
- Navigate to the
/ExtractedFunction
folder. - Run the GitHub Action to deploy the new Azure Function.
- Navigate to the
<policies>
<inbound>
<base />
<!-- Route to Legacy Function for GET requests -->
<choose>
<when condition="@(context.Request.Method == "GET")">
<set-backend-service base-url="https://<your-legacy-function-app-name>.azurewebsites.net/api/legacy-feature-function" />
</when>
<!-- Route to New Feature Function for POST requests -->
<when condition="@(context.Request.Method == "POST")">
<set-backend-service base-url="https://<your-new-function-app-name>.azurewebsites.net/api/new-feature-function" />
</when>
</choose>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
This project is licensed under the MIT License - see the LICENSE file for details.