The Sidecar Concept
In this configuration, PvRForecast and SAP-RFC are deployed as Sidecars to PvTaskManager.
Key Characteristics of Your Sidecar Implementation
- Shared Network Stack
By using network_mode: "container:pv_task_manager", the sidecars do not have their own IP addresses.
They share the localhost of the Task Manager.
- Simplified Communication
The Task Manager calls the service using http://localhost:PORT, rather than an external DNS name.
- R Forecast service via
http://localhost:8000 - SAP-RFC service via
http://localhost:9090
1. Implementation in Azure Kubernetes Service (AKS)
In Kubernetes, the sidecar pattern is native. You group these containers into a single Pod.
All containers within a Pod share:
- the same network namespace (localhost)
- the same storage volumes
AKS Deployment Manifest (YAML)
apiVersion: apps/v1
kind: Deployment
metadata:
name: pv-task-manager-pod
spec:
replicas: 1
selector:
matchLabels:
app: task-manager
template:
metadata:
labels:
app: task-manager
spec:
containers:
# 1. Main Container
- name: pv-task-manager
image: planvisage.azurecr.io/pvtaskmanagerscheduler:latest
env:
- name: R_FRCST_URL
value: "http://localhost:8000"
ports:
- containerPort: 8081
# 2. Sidecar: R Forecast
- name: pv-r-forecast
image: planvisage.azurecr.io/pvrforecast:latest
# 3. Sidecar: SAP RFC
- name: sap-rfc
image: planvisage.azurecr.io/pv-sap-rfc-api:latest
2. Implementation in AWS ECS (Fargate / EC2)
In AWS ECS, the equivalent of a Kubernetes Pod is a Task Definition.
To replicate the Docker Compose Sidecar pattern, you define multiple containers within a single Task.
When using the awsvpc network mode (standard for Fargate), containers in the same task communicate via localhost.
ECS Task Definition (JSON Snippet)
{
"containerDefinitions": [
{
"name": "PvTaskManager",
"image": "planvisage.azurecr.io/pvtaskmanagerscheduler:latest",
"portMappings": [
{ "containerPort": 8081, "hostPort": 8081 }
],
"environment": [
{ "name": "R_FRCST_URL", "value": "http://localhost:8000" }
]
},
{
"name": "PvRForecast",
"image": "planvisage.azurecr.io/pvrforecast:latest",
"dependsOn": [
{ "containerName": "PvTaskManager", "condition": "START" }
]
},
{
"name": "SAP-RFC",
"image": "planvisage.azurecr.io/pv-sap-rfc-api:latest",
"dependsOn": [
{ "containerName": "PvTaskManager", "condition": "START" }
]
}
]
}
3. Implementation Using Docker Compose
name: 'planvisage-scm'
services:
PvWebApplication:
image: planvisage.azurecr.io/pvwebapp:latest
hostname: PV-WebApplication
ports:
- "8081:8080"
environment:
- TZ=Asia/Kolkata
- LICENSE_KEY=v3vh-t8m2-y1x3-s8t9
- LICENSE_NAME=planvisage-demo
- LICENSE_EMAIL=shiyas.m@planvisage.com
- DB_CONNECTSTR=Data Source=host.docker.internal;Initial Catalog=SUDC_PV;User ID=sa;Password=sa123;TrustServerCertificate=True;
- TASK_MNGR_URL=http://PvTaskManager:8080
volumes:
- ./PvWebApp/log/:/app/wwwroot/log/
- ./PvWebApp/xml/:/app/wwwroot/xml/
networks:
- pv-network
PvTaskManager:
image: planvisage.azurecr.io/pvtaskmanagerscheduler:latest
container_name: pv_task_manager
ports:
- "8082:8081"
- "8083:8000"
- "8084:9090"
environment:
- TZ=Asia/Kolkata
- DB_CONNECTSTR=Data Source=host.docker.internal;Initial Catalog=SUDC_PV;User ID=sa;Password=sa123;TrustServerCertificate=True;
- R_FRCST_URL=http://localhost:8000
volumes:
- ./PvWebAppTaskMngr/log/:/app/wwwroot/log/
- ./PvWebAppTaskMngr/xml/:/app/wwwroot/xml/
networks:
- pv-network
PvRForecast:
image: planvisage.azurecr.io/pvrforecast:latest
network_mode: "container:pv_task_manager"
environment:
- TZ=Asia/Kolkata
depends_on:
- PvTaskManager
SAP-RFC:
image: planvisage.azurecr.io/pv-sap-rfc-api:latest
network_mode: "container:pv_task_manager"
environment:
- TZ=Asia/Kolkata
depends_on:
- PvTaskManager
networks:
pv-network:
driver: bridge
Summary
| Platform | Equivalent Concept | Communication |
|---|---|---|
| Docker Compose | Sidecar via network_mode: container |
localhost |
| Kubernetes (AKS) | Multiple containers in a Pod | localhost |
| AWS ECS | Multiple containers in a Task Definition | localhost |
The core idea is the same across platforms:
Containers share the same network namespace, allowing them to communicate using
localhostinstead of external service DNS.