Skip to content

Commit 1fc5d07

Browse files
authored
Merge pull request #533 from Azure/vsts-sidecar
Blog for VSTS tasks for sidecars
2 parents f876508 + c833fe4 commit 1fc5d07

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: "Azure Pipeline samples: add sidecars to Azure App Service for Linux"
3+
author_name: "Tulika Chaudharie"
4+
toc: true
5+
toc_sticky: true
6+
---
7+
8+
Sidecars on Azure App Service let you attach extra containers — logging, telemetry, lightweight APIs, caches, AI inference helpers — alongside your main app, in the same App Service. They start and run with your app, but you don’t have to bake that logic into your main code.
9+
10+
We’re publishing two Azure Pipelines (Azure DevOps / VSTS) YAML samples to make this easy.
11+
12+
## VSTS samples
13+
14+
* **[`vsts-blessed-sitecontainers.yml`](https://github.com/Azure/actions-workflow-samples/blob/master/AppService/vsts-blessed-sitecontainers.yml)**
15+
For built-in runtimes on App Service for Linux (for example, Python or Node on the built-in stack).
16+
* Builds your app, zips it, and deploys it using `AzureWebApp@1`.
17+
* In the same deploy step, it sends a `sitecontainersConfig` payload that defines one or more sidecar containers by image, port, and config.
18+
* Your app keeps running on the App Service runtime; the sidecars run next to it.
19+
20+
* **[`vsts-only-sitecontainers.yml`](https://github.com/Azure/actions-workflow-samples/blob/master/AppService/vsts-only-sitecontainers.yml)**
21+
For containerized apps (Web App for Containers style).
22+
* Builds and pushes multiple images (main app container + sidecars) to your container registry.
23+
* Uses `AzureWebAppContainer@1` to deploy them all together to App Service for Linux.
24+
* One container is marked `"isMain": true`; the rest are `"isMain": false`.
25+
26+
Both samples assume Azure App Service for Linux and the sidecar model, where containers in the same app can talk to each other over localhost.
27+
28+
## How the pipelines work
29+
30+
1. **Build and Publish**
31+
* `vsts-blessed-sitecontainers.yml`: sets up your language/runtime, installs dependencies, and produces a ZIP artifact of your app. It also uses Docker tasks to build and publish the sidecar container.
32+
* `vsts-only-sitecontainers.yml`: uses Docker tasks to build and push multiple container images.
33+
34+
2. **Deploy to App Service for Linux**
35+
* Code-based flow: `AzureWebApp@1` deploys the ZIP and sidecar containers defined in `sitecontainersConfig`.
36+
* Container flow: `AzureWebAppContainer@1` deploys your main container and sidecars, defined in `sitecontainersConfig`.
37+
38+
That’s it: one pipeline run builds, packages, and deploys your main app plus its helper containers.
39+
40+
## Quick start
41+
42+
1. **Pick a template**
43+
* Built-in runtime on App Service for Linux? Use `vsts-blessed-sitecontainers.yml`.
44+
* Already running containers? Use `vsts-only-sitecontainers.yml`.
45+
46+
2. **Add it to your repo**
47+
Save the YAML as `azure-pipelines.yml` (or add it as a new pipeline in Azure DevOps).
48+
49+
3. **Fill in the placeholders**
50+
* `azureServiceConnectionId` / `azureSubscription`: your Azure RM service connection.
51+
* `webAppName` / `appName`: the target App Service for Linux app.
52+
* `resourceGroup`: where that app lives.
53+
* `containerRegistry`, image names, and ports for each container in the multi-container case.
54+
* Each container in `sitecontainersConfig` declares its port and whether it’s the main app or a sidecar.
55+
56+
4. **Run it in Azure DevOps**
57+
Create a new pipeline from YAML, authorize the service connections, and run.
58+
59+
5. **Check your app**
60+
In the Azure portal, go to Deployment Center->Containers and your App Service will now show your primary app plus the sidecar containers defined in the pipeline.
61+
62+
## Customize to fit
63+
64+
These YAMLs are starting points. You can:
65+
* Add test/lint stages before deployment so you only ship good builds.
66+
* Swap the agent pool (`ubuntu-latest` vs your own self-hosted pool).
67+
* Deploy to a staging slot first, then swap to production.
68+
* Tune each sidecar in `sitecontainersConfig`: env vars, ports, credentials, etc.
69+
70+
You don’t have to redesign CI/CD every time you want to add observability, a cache container, or a small inference helper next to your app — you just describe the containers and ship.
71+
72+
73+
## Learn more
74+
75+
* **Deploy to Azure App Service using Azure Pipelines**
76+
Full walkthrough for setting up [Azure Pipelines with App Service](https://learn.microsoft.com/en-us/azure/app-service/deploy-azure-pipelines?tabs=yaml), including service connections and the `AzureWebApp@1` / `AzureWebAppContainer@1` tasks.
77+
78+
* **Sidecars on App Service for Linux**
79+
[How sidecars work](https://learn.microsoft.com/en-us/azure/app-service/overview-sidecar), how `isMain` is used, networking rules (localhost between containers), and common patterns like telemetry/OTEL agents, API helpers, and lightweight caches.
80+
81+
Drop these templates into your pipeline, point them at your app, and you’ve got repeatable CI/CD for multi-containers in App Service.

0 commit comments

Comments
 (0)