4.8 KiB
Azure Setup für Teams Browser Bot
Architektur
Der Browser Bot ist ein zentraler Service der von allen Gateway-Instanzen (dev, int, prod) genutzt wird. Jede Gateway-Instanz sendet ihre eigene WebSocket-URL mit dem Join-Request, sodass der Bot sich immer zur richtigen Gateway-Instanz zurückverbindet.
┌─────────────────┐ ┌──────────────────────────┐
│ Gateway PROD │────►│ │
│ (gateway.xyz) │◄────│ Teams Browser Bot │
├─────────────────┤ │ (zentraler Service) │
│ Gateway INT │────►│ │
│ (gateway-int..) │◄────│ resource-core │
├─────────────────┤ │ │
│ Gateway DEV │────►│ │
│ (localhost) │◄────│ │
└─────────────────┘ └──────────────────────────┘
Aktuelle Konfiguration
| Ressource | Wert |
|---|---|
| Container App URL | https://cae-poweron-shared.redwater-53d21339.switzerlandnorth.azurecontainerapps.io |
| Azure Container Registry | acrpoweron.azurecr.io |
| Image | acrpoweron.azurecr.io/teams-browser-bot:latest |
| Health Check | /health |
1. Voraussetzungen
1.1 Azure Container Registry (ACR)
Eine ACR muss existieren. Falls nicht:
- Azure Portal → Suche "Container registries" → + Create
- Name:
acrpoweron, SKU: Basic, Location: Switzerland North - Nach Erstellung: Access keys → Admin user aktivieren
1.2 GitHub Secrets für CI/CD
Im GitHub Repo valueonag/service-teams-browser-bot:
Settings → Secrets and variables → Actions:
| Secret Name | Wert |
|---|---|
ACR_LOGIN_SERVER |
acrpoweron.azurecr.io |
ACR_USERNAME |
acrpoweron |
ACR_PASSWORD |
Password aus ACR Access keys |
2. Container App erstellen (Azure Portal)
- Azure Portal → Suche "Container Apps" → + Create
Basics Tab
| Feld | Wert |
|---|---|
| Subscription | Subscription Product |
| Resource group | resource-core |
| Container app name | teams-browser-bot |
| Region | Switzerland North |
| Container Apps Environment | Create new → Name: cae-poweron-shared |
Container Tab
| Feld | Wert |
|---|---|
| Use quickstart image | ❌ Deaktivieren |
| Registry | acrpoweron (Azure Container Registry) |
| Image | teams-browser-bot |
| Image tag | latest |
| Authentication type | Managed identity |
| CPU and memory | 2 CPU cores, 4 Gi memory |
Environment Variables
| Name | Value |
|---|---|
| NODE_ENV | production |
| PORT | 4100 |
| BOT_NAME | PowerOn AI |
| BOT_HEADLESS | true |
| LOG_LEVEL | info |
⚠️ Wichtig: KEINE
GATEWAY_WS_URLVariable setzen! Die URL kommt dynamisch vom Gateway.
Ingress Tab
| Feld | Wert |
|---|---|
| Ingress | ✅ Enabled |
| Ingress traffic | Accepting traffic from anywhere |
| Target port | 4100 |
- Review + create → Create
3. Gateway Konfiguration
Die Gateway env-Files sind bereits konfiguriert:
env_prod.env & env_int.env:
TEAMSBOT_BROWSER_BOT_URL=https://cae-poweron-shared.redwater-53d21339.switzerlandnorth.azurecontainerapps.io
env_dev.env (lokal):
TEAMSBOT_BROWSER_BOT_URL=http://localhost:4100
4. CI/CD Pipeline
Der GitHub Actions Workflow (build-deploy.yml) pusht automatisch zu ACR bei jedem Push auf main.
Manuelles Update der Container App:
- Azure Portal → Container Apps →
teams-browser-bot - Revisions and replicas → Create new revision
- Das neue Image wird automatisch gepullt
5. Kosten
Azure Container Apps (Consumption Plan):
- vCPU: ~$0.000024/vCPU-second
- Memory: ~$0.000003/GiB-second
- Requests: Erste 2M/Monat kostenlos
- Scale to zero: Keine Kosten wenn idle
Geschätzte Kosten bei 10h Bot-Nutzung/Tag:
- ~$15-25/Monat
6. Troubleshooting (Azure Portal)
Logs anzeigen
- Container Apps → teams-browser-bot
- Monitoring → Log stream (Live-Logs)
- Oder: Monitoring → Logs (historisch)
Container startet nicht
- Revisions and replicas → Klicke auf aktive Revision
- Console logs prüfen
- Häufige Probleme:
- Image nicht gefunden → Registry credentials prüfen
- Port falsch → Target port = 4100
Revision neu starten
- Revisions and replicas
- Aktive Revision → ... → Restart
WebSocket Probleme
- Container Apps unterstützen WebSockets standardmässig
- Gateway CORS-Einstellungen prüfen