At Microsoft Ignite 2023, we unveiled our ongoing work on implementing a Sidecar pattern for Linux App Service. While the complete implementation is still in progress, we want to provide you with a sneak peek into this upcoming feature. Moreover, we'll guide you on how to start using it immediately (with certain restrictions) on Linux App Service. In this blog post, we'll delve into the Sidecar pattern, its significance, and practical ways to leverage it for your applications.
What is the Sidecar Pattern
Applications and services often require related functionality, such as monitoring, logging, configuration, and networking services. These peripheral tasks can be implemented as separate components or services, built using different languages and technologies.
The Sidecar pattern allows you to co-locate a cohesive set of tasks with the primary application but place them inside their own process or container. This container is attached as a supplementary container (the 'sidecar') to the main application container. The sidecar container runs alongside the primary application, providing additional functionalities, such as logging, monitoring, security, or other auxiliary services.
A Step-by-step guide to creating a Sidecar enabled site for Linux App Service
While we're diligently refining the portal experience for the Sidecar pattern on Linux App Service, you can already start experimenting with this exciting feature using ARM Templates.
Currently, it's only available in West Central US. More regions will be available soon.
In this section, we'll guide you through the steps of creating an application on Linux App Service, leveraging the Sidecar pattern.
Before we dive into the implementation, make sure you have Azure CLI installed. If not, you can install it by following the instructions here.
The application code, including the ARM template, for this example is available on here. Feel free to clone and explore the codebase to understand the integration of main and sidecar containers.
In this scenario, we’ll run a main app powered by NGINX, which will be supplemented by three sidecar containers executing Dotnet, Python, and Node.js applications. This example demonstrates how to create sidecars running different language stacks for your application.
Open a command prompt and type in these commands -
git clone https://github.com/Azure-Samples/appservice-linux-sidecar.git
az group create --name <RESOURCE-GROUP> --location "<AZURE-REGION>"
az deployment group create --resource-group <RESOURCE-GROUP> --parameters webAppName=<WEB-APP-NAME> sku=P0v3 --template-file armtemplatemultictr.json
This feature is only available in West Central US for the moment. We will update the document with more regions as our deployment progresses.
Substitute the values for <SUBSCRIPTION-ID>, <RESOURCE-GROUP>, <AZURE-REGION> and <WEB-APP-NAME>.
Feel free to adapt the parameters and configurations based on your specific requirements. The setup will take a couple of minutes to complete.
The site might take 1-3 minutes to start. Once the site has started, you can test it out by using these endpoints -
<APP_URL>: Shows up Nginx home page from main Nginx container.
<APP_URL>/dotnetcore: Shows up welcome page from dotnet sidecar container.
<APP_URL>/python: Shows up welcome page from python sidecar container.
<APP_URL>/nodejs : Shows up welcome page from nodejs sidecar container.
In conclusion, the Sidecar pattern for Linux App Service opens a world of possibilities for enhancing your application's capabilities. Don't hesitate to experiment with deploying your custom or publicly available containers as sidecars, tailoring your setup to suit your specific needs.
As we continue refining and expanding this feature, stay tuned for updates! We are actively working on adding more regions and ensuring a smoother user experience.