diff --git a/docker-compose.prod.acr.yml b/docker-compose.prod.acr.yml index 527bfad..a9a8ec2 100644 --- a/docker-compose.prod.acr.yml +++ b/docker-compose.prod.acr.yml @@ -21,7 +21,7 @@ services: start_period: 40s frontend: - image: zuyderlandcmdbacr.azurecr.io/zuyderland-cmdb-gui/frontend:latest + image: zdlas.azurecr.io/zuyderland-cmdb-gui/frontend:latest depends_on: - backend restart: unless-stopped diff --git a/docs/DEPLOYMENT-NEXT-STEPS.md b/docs/DEPLOYMENT-NEXT-STEPS.md new file mode 100644 index 0000000..9541df2 --- /dev/null +++ b/docs/DEPLOYMENT-NEXT-STEPS.md @@ -0,0 +1,324 @@ +# Deployment Next Steps - Images Gereed! 🚀 + +Je Docker images zijn succesvol gebouwd en gepusht naar Azure Container Registry! Hier zijn de volgende stappen voor deployment. + +## ✅ Wat is al klaar: + +- ✅ Azure Container Registry (ACR): `zdlas.azurecr.io` +- ✅ Docker images gebouwd en gepusht: + - `zdlas.azurecr.io/zuyderland-cmdb-gui/backend:latest` + - `zdlas.azurecr.io/zuyderland-cmdb-gui/frontend:latest` +- ✅ Azure DevOps Pipeline: Automatische builds bij push naar `main` +- ✅ Docker Compose configuratie: `docker-compose.prod.acr.yml` + +--- + +## 🎯 Deployment Opties + +Je hebt verschillende opties om de applicatie te deployen. Kies de optie die het beste past bij jouw situatie: + +### Optie 1: Azure App Service (Aanbevolen voor productie) ⭐ + +**Voordelen:** +- Managed service (geen server management) +- Automatische scaling +- Ingebouwde SSL/TLS +- Deployment slots (zero-downtime updates) +- Integratie met Azure Key Vault +- Monitoring via Application Insights + +**Geschikt voor:** Productie deployment, kleine tot middelgrote teams + +**Kosten:** ~€15-25/maand (Basic B1 plan) + +**Stappen:** +1. Maak App Service Plan aan +2. Maak 2 Web Apps aan (backend + frontend) +3. Configureer container deployment vanuit ACR +4. Stel environment variabelen in +5. Configureer SSL certificaat + +**Zie:** `docs/AZURE-APP-SERVICE-DEPLOYMENT.md` (te maken) + +--- + +### Optie 2: Azure Container Instances (ACI) - Eenvoudig + +**Voordelen:** +- Snel op te zetten +- Pay-per-use pricing +- Geen server management + +**Geschikt voor:** Test/development, kleine deployments + +**Kosten:** ~€30-50/maand (2 containers) + +**Stappen:** +1. Maak 2 Container Instances aan +2. Pull images vanuit ACR +3. Configureer environment variabelen +4. Stel networking in + +**Zie:** `docs/AZURE-CONTAINER-INSTANCES-DEPLOYMENT.md` (te maken) + +--- + +### Optie 3: VM met Docker Compose (Flexibel) + +**Voordelen:** +- Volledige controle +- Eenvoudige deployment met Docker Compose +- Kan lokaal getest worden + +**Geschikt voor:** Als je al een VM hebt, of volledige controle wilt + +**Kosten:** ~€20-40/maand (Basic VM) + +**Stappen:** +1. Maak Azure VM aan (Ubuntu) +2. Installeer Docker en Docker Compose +3. Login naar ACR +4. Gebruik `docker-compose.prod.acr.yml` +5. Configureer Nginx reverse proxy + +**Zie:** `docs/VM-DOCKER-COMPOSE-DEPLOYMENT.md` (te maken) + +--- + +### Optie 4: Azure Kubernetes Service (AKS) - Enterprise + +**Voordelen:** +- Enterprise-grade scaling +- High availability +- Advanced networking + +**Geschikt voor:** Grote deployments, enterprise requirements + +**Kosten:** ~€50-100+/maand (minimaal 2 nodes) + +**Niet aanbevolen voor:** Kleine teams (20 gebruikers) - overkill + +--- + +## 🔍 Stap 1: Verifieer Images in ACR + +**Controleer of de images succesvol zijn gepusht:** + +```bash +# Login naar ACR +az acr login --name zdlas + +# List repositories +az acr repository list --name zdlas --output table + +# List tags voor backend +az acr repository show-tags --name zdlas --repository zuyderland-cmdb-gui/backend --output table + +# List tags voor frontend +az acr repository show-tags --name zdlas --repository zuyderland-cmdb-gui/frontend --output table +``` + +**Verwachte output:** +``` +REPOSITORY TAG CREATED +zuyderland-cmdb-gui/backend latest ... +zuyderland-cmdb-gui/backend 88764 ... +zuyderland-cmdb-gui/frontend latest ... +zuyderland-cmdb-gui/frontend 88764 ... +``` + +--- + +## 📋 Stap 2: Update Docker Compose voor ACR + +**Update `docker-compose.prod.acr.yml` met de juiste ACR naam:** + +```yaml +services: + backend: + image: zdlas.azurecr.io/zuyderland-cmdb-gui/backend:latest + frontend: + image: zdlas.azurecr.io/zuyderland-cmdb-gui/frontend:latest +``` + +**Let op:** De huidige configuratie gebruikt `zuyderlandcmdbacr.azurecr.io` - pas dit aan naar `zdlas.azurecr.io` als dat je ACR naam is. + +--- + +## 🔐 Stap 3: Bereid Environment Variabelen Voor + +**Maak een `.env.production` bestand** (niet committen naar Git!): + +```bash +# Backend Environment Variables +NODE_ENV=production +PORT=3001 + +# Jira Configuration +JIRA_BASE_URL=https://jira.zuyderland.nl +JIRA_SCHEMA_ID=your-schema-id +JIRA_PAT=your-personal-access-token +# OF +JIRA_OAUTH_CLIENT_ID=your-client-id +JIRA_OAUTH_CLIENT_SECRET=your-client-secret + +# Session +SESSION_SECRET=your-secure-random-secret + +# AI (Optioneel) +ANTHROPIC_API_KEY=your-anthropic-key +OPENAI_API_KEY=your-openai-key + +# Database (als je PostgreSQL gebruikt) +DATABASE_URL=postgresql://user:password@host:5432/dbname + +# Frontend API URL +VITE_API_URL=https://your-backend-url.com/api +``` + +**Gebruik Azure Key Vault voor secrets in productie!** + +--- + +## 🚀 Stap 4: Kies Deployment Methode + +### Quick Start: VM met Docker Compose + +**Als je snel wilt starten:** + +1. **Maak Azure VM aan:** + ```bash + az vm create \ + --resource-group rg-cmdb-gui \ + --name vm-cmdb-gui \ + --image Ubuntu2204 \ + --size Standard_B2s \ + --admin-username azureuser \ + --generate-ssh-keys + ``` + +2. **SSH naar de VM:** + ```bash + ssh azureuser@ + ``` + +3. **Installeer Docker en Docker Compose:** + ```bash + # Docker + curl -fsSL https://get.docker.com -o get-docker.sh + sudo sh get-docker.sh + sudo usermod -aG docker $USER + + # Docker Compose + sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + ``` + +4. **Login naar ACR:** + ```bash + az acr login --name zdlas + # OF + docker login zdlas.azurecr.io -u -p + ``` + +5. **Clone repository en deploy:** + ```bash + git clone + cd zuyderland-cmdb-gui + + # Update docker-compose.prod.acr.yml met juiste ACR naam + # Maak .env.production aan + + docker-compose -f docker-compose.prod.acr.yml up -d + ``` + +--- + +## 📝 Stap 5: Configureer Nginx Reverse Proxy + +**Update `nginx/nginx.conf`** voor productie: + +- SSL/TLS certificaat configuratie +- Domain name +- Backend API proxy +- Frontend static files + +**Zie:** `nginx/nginx.conf` voor configuratie template. + +--- + +## 🔒 Stap 6: Security Checklist + +- [ ] SSL/TLS certificaat geconfigureerd +- [ ] Environment variabelen in Key Vault (niet in code) +- [ ] Firewall rules geconfigureerd +- [ ] CORS correct geconfigureerd +- [ ] Rate limiting ingeschakeld +- [ ] Health checks geconfigureerd +- [ ] Monitoring/alerting ingesteld + +--- + +## 📊 Stap 7: Monitoring Setup + +**Azure Application Insights:** +- Application performance monitoring +- Error tracking +- Usage analytics + +**Azure Monitor:** +- Container health +- Resource usage +- Alerts + +--- + +## 🎯 Aanbevolen Volgorde + +1. **Verifieer images in ACR** (Stap 1) +2. **Kies deployment optie** (Optie 1, 2, of 3) +3. **Bereid environment variabelen voor** (Stap 3) +4. **Deploy naar test environment** +5. **Test functionaliteit** +6. **Configureer SSL/TLS** +7. **Setup monitoring** +8. **Deploy naar productie** + +--- + +## 📚 Gerelateerde Documentatie + +- **Azure App Service Deployment**: `docs/AZURE-APP-SERVICE-DEPLOYMENT.md` (te maken) +- **Azure Container Instances**: `docs/AZURE-CONTAINER-INSTANCES-DEPLOYMENT.md` (te maken) +- **VM Docker Compose**: `docs/VM-DOCKER-COMPOSE-DEPLOYMENT.md` (te maken) +- **Production Deployment**: `docs/PRODUCTION-DEPLOYMENT.md` +- **Azure Deployment Summary**: `docs/AZURE-DEPLOYMENT-SUMMARY.md` + +--- + +## ❓ Vragen? + +**Veelgestelde vragen:** + +**Q: Welke deployment optie moet ik kiezen?** +A: Voor 20 gebruikers: **Azure App Service** (Optie 1) is het meest geschikt - managed service, eenvoudig, voldoende resources. + +**Q: Moet ik PostgreSQL gebruiken of kan ik SQLite houden?** +A: SQLite is prima voor 20 gebruikers. PostgreSQL is beter voor groei of als je connection pooling nodig hebt. + +**Q: Hoe configureer ik SSL?** +A: Azure App Service heeft ingebouwde SSL. Voor VM: gebruik Let's Encrypt met certbot. + +**Q: Hoe update ik de applicatie?** +A: Push naar `main` branch → Pipeline bouwt nieuwe images → Pull nieuwe images in deployment → Restart containers. + +--- + +## 🎉 Success! + +Je hebt nu: +- ✅ Docker images in ACR +- ✅ Automatische CI/CD pipeline +- ✅ Deployment configuratie klaar + +**Volgende stap:** Kies je deployment optie en volg de stappen!