# Next Steps - ACR Created! ๐ŸŽ‰ Je Azure Container Registry is aangemaakt! Volg deze stappen om Docker images automatisch te bouwen en te pushen. ## ๐Ÿ“‹ Checklist - [ ] Stap 1: Verifieer ACR naam - [ ] Stap 2: Update pipeline variabelen (als nodig) - [ ] Stap 3: Service Connection aanmaken in Azure DevOps - [ ] Stap 4: Pipeline aanmaken en runnen - [ ] Stap 5: Verifieer images in ACR --- ## ๐Ÿ” Stap 1: Verifieer ACR Naam **Vind je ACR naam:** **Via Azure Portal:** 1. Ga naar je Container Registry 2. Klik op **"Overview"** 3. Noteer de **"Login server"** (bijv. `zuyderlandcmdbacr.azurecr.io`) 4. De naam vรณรณr `.azurecr.io` is je ACR naam (bijv. `zuyderlandcmdbacr`) **Via Azure CLI:** ```bash az acr list --query "[].{Name:name, LoginServer:loginServer}" -o table ``` **Noteer je ACR naam!** (bijv. `zuyderlandcmdbacr`) --- ## ๐Ÿ”ง Stap 2: Update Pipeline Variabelen **Check of `azure-pipelines.yml` de juiste ACR naam heeft:** 1. **Open** `azure-pipelines.yml` 2. **Controleer regel 17:** ```yaml acrName: 'zuyderlandcmdbacr' # โ† Pas aan naar jouw ACR naam ``` 3. **Als je ACR naam anders is**, pas het aan: ```yaml acrName: 'jouw-acr-naam-hier' ``` 4. **Commit en push** (als je het hebt aangepast): ```bash git add azure-pipelines.yml git commit -m "Update ACR name in pipeline" git push origin main ``` **โœ… Als de naam al klopt, ga door naar Stap 3!** --- ## ๐Ÿ”— Stap 3: Service Connection Aanmaken in Azure DevOps Deze connection geeft Azure DevOps toegang tot je ACR. ### Stappen: 1. **Ga naar je Azure DevOps project** - Open je project in Azure DevOps 2. **Ga naar Project Settings** - Klik op **โš™๏ธ Project Settings** (onderaan links in het menu) 3. **Open Service Connections** - Scroll naar **"Pipelines"** sectie - Klik op **"Service connections"** 4. **Maak nieuwe connection** - Klik op **"New service connection"** (of **"Create service connection"**) - Kies **"Docker Registry"** - Klik **"Next"** 5. **Selecteer Azure Container Registry** - Kies **"Azure Container Registry"** - Klik **"Next"** 6. **Configureer connection** - **Authentication type**: Kies **"Service Principal"** โญ (aanbevolen) - Dit is de standaard en meest betrouwbare optie - Azure DevOps maakt automatisch een Service Principal aan - **Azure subscription**: Selecteer je Azure subscription - **Azure container registry**: Selecteer je ACR uit de dropdown (bijv. `zdlas`) - **Service connection name**: `zuyderland-cmdb-acr-connection` - โš ๏ธ **Belangrijk**: Deze naam moet overeenkomen met `dockerRegistryServiceConnection` in `azure-pipelines.yml`! - **Description**: Optioneel (bijv. "ACR for CMDB GUI production") 7. **Save** - Klik **"Save"** (of **"Verify and save"**) - Azure DevOps test automatisch de connection - Azure DevOps maakt automatisch een Service Principal aan met de juiste permissions **๐Ÿ’ก Waarom Service Principal?** - โœ… Werkt perfect met Azure DevOps Services (cloud) - โœ… Eenvoudig - Azure DevOps doet alles automatisch - โœ… Betrouwbaar - Meest ondersteunde optie - โœ… Veilig - Credentials worden veilig beheerd ๐Ÿ“š Zie `docs/AZURE-SERVICE-CONNECTION-AUTH.md` voor details over alle authentication types. **โœ… Service connection is aangemaakt!** **Troubleshooting:** - **"Loading Registries..." blijft hangen?** - โœ… Refresh de pagina (F5) - โœ… Check of je de juiste subscription hebt geselecteerd - โœ… Wacht 10-30 seconden (kan even duren) - โœ… **Workaround**: Gebruik "Others" optie (zie hieronder) - Als verificatie faalt, check of je toegang hebt tot de ACR in Azure Portal **๐Ÿ”ง Workaround: Als dropdown niet werkt, gebruik "Others" optie:** 1. Kies **"Docker Registry"** โ†’ **"Others"** (in plaats van "Azure Container Registry") 2. Vul handmatig in: - **Docker Registry**: `zdlas.azurecr.io` - **Docker ID**: (haal op met `az acr credential show --name zdlas`) - **Docker Password**: (haal op met `az acr credential show --name zdlas`) 3. **Service connection name**: `zuyderland-cmdb-acr-connection` 4. Save **Haal credentials op:** ```bash az login az acr credential show --name zdlas # Gebruik "username" en "passwords[0].value" ``` ๐Ÿ“š Zie `docs/AZURE-SERVICE-CONNECTION-TROUBLESHOOTING.md` voor uitgebreide troubleshooting. --- ## ๐ŸŽฏ Stap 4: Pipeline Aanmaken en Run ### Stappen: 1. **Ga naar Pipelines** - Klik op **"Pipelines"** (links in het menu) 2. **Create New Pipeline** - Klik op **"New pipeline"** of **"Create Pipeline"** 3. **Selecteer Repository** - Kies **"Azure Repos Git"** (of waar je code staat) - Selecteer je repository: **"Zuyderland CMDB GUI"** (of jouw repo naam) 4. **Kies YAML File** - Kies **"Existing Azure Pipelines YAML file"** - Selecteer: - **Branch**: `main` (of jouw default branch) - **Path**: `/azure-pipelines.yml` 5. **Review Configuration** - Azure DevOps toont de pipeline configuratie - Controleer of alles klopt 6. **Run Pipeline** - Klik **"Run"** om de pipeline te starten - De pipeline start automatisch met het bouwen van de images **โœ… Pipeline is gestart!** ### Wat gebeurt er nu? De pipeline zal: 1. โœ… Code uitchecken 2. โœ… Backend Docker image bouwen 3. โœ… Frontend Docker image bouwen 4. โœ… Images naar Azure Container Registry pushen **Verwachte tijd:** ~5-10 minuten (afhankelijk van build tijd) --- ## โœ… Stap 5: Verifieer Images in ACR ### In Azure Portal: 1. **Ga naar je Container Registry** - Open Azure Portal - Ga naar je Container Registry (`zuyderlandcmdbacr`) 2. **Bekijk Repositories** - Klik op **"Repositories"** (links in het menu) - Je zou moeten zien: - `zuyderland-cmdb-gui/backend` - `zuyderland-cmdb-gui/frontend` 3. **Bekijk Tags** - Klik op een repository (bijv. `zuyderland-cmdb-gui/backend`) - Je zou tags moeten zien: - `latest` - `123` (of build ID nummer) **โœ… Images zijn succesvol gebouwd en gepusht!** ### Via Azure CLI: ```bash # Lijst repositories az acr repository list --name zuyderlandcmdbacr # Lijst tags voor backend az acr repository show-tags --name zuyderlandcmdbacr --repository zuyderland-cmdb-gui/backend --orderby time_desc # Lijst tags voor frontend az acr repository show-tags --name zuyderlandcmdbacr --repository zuyderland-cmdb-gui/frontend --orderby time_desc ``` ### In Azure DevOps: 1. **Ga naar je Pipeline** - Klik op **"Pipelines"** - Klik op je pipeline run 2. **Bekijk Logs** - Klik op een job (bijv. "Build Docker Images") - Bekijk de logs per stap - Bij success zie je: ``` Backend Image: zuyderlandcmdbacr.azurecr.io/zuyderland-cmdb-gui/backend:123 Frontend Image: zuyderlandcmdbacr.azurecr.io/zuyderland-cmdb-gui/frontend:123 ``` --- ## ๐Ÿšจ Troubleshooting ### Pipeline Fails: "Service connection not found" **Oplossing:** - Controleer of de service connection naam in `azure-pipelines.yml` (regel 19) overeenkomt met de naam in Azure DevOps - Ga naar Project Settings โ†’ Service connections en verifieer de naam - Pas `dockerRegistryServiceConnection` aan in `azure-pipelines.yml` als nodig ### Pipeline Fails: "ACR not found" **Oplossing:** - Controleer of de `acrName` variabele correct is in `azure-pipelines.yml` (regel 17) - Verifieer dat de ACR bestaat: `az acr list` - Check of je de juiste subscription hebt geselecteerd in de service connection ### Pipeline Fails: "Permission denied" **Oplossing:** - Controleer of de service connection de juiste permissions heeft - Verifieer dat je Azure subscription toegang heeft tot de ACR - Check of de service connection is geverifieerd (groen vinkje in Azure DevOps) - Probeer de service connection opnieuw aan te maken ### Images worden niet gepusht **Oplossing:** - Check de pipeline logs voor specifieke errors - Verifieer dat de Docker build succesvol is - Controleer of de ACR admin-enabled is (voor development) - Check of de service connection correct is geconfigureerd ### Build Fails: "Dockerfile not found" **Oplossing:** - Verifieer dat `backend/Dockerfile.prod` en `frontend/Dockerfile.prod` bestaan - Check of de paths correct zijn in `azure-pipelines.yml` - Controleer of de files zijn gecommit en gepusht naar de repository --- ## ๐ŸŽ‰ Success! Als alles goed is gegaan, heb je nu: - โœ… Azure Container Registry aangemaakt - โœ… Service Connection geconfigureerd - โœ… Pipeline aangemaakt en gerund - โœ… Docker images gebouwd en gepusht naar ACR **Je images zijn nu beschikbaar op:** - Backend: `zuyderlandcmdbacr.azurecr.io/zuyderland-cmdb-gui/backend:latest` - Frontend: `zuyderlandcmdbacr.azurecr.io/zuyderland-cmdb-gui/frontend:latest` --- ## ๐Ÿš€ Volgende Stappen Nu je images in ACR staan, kun je ze deployen naar: 1. **Azure Container Instances (ACI)** - Eenvoudig, snel 2. **Azure App Service (Container)** - Managed service 3. **Azure Kubernetes Service (AKS)** - Voor complexere setups 4. **VM met Docker Compose** - Volledige controle Zie `docs/AZURE-DEPLOYMENT-SUMMARY.md` voor deployment opties. --- ## ๐Ÿ“š Meer Informatie - **Quick Start Guide**: `docs/AZURE-ACR-QUICKSTART.md` - **Azure DevOps Setup**: `docs/AZURE-DEVOPS-SETUP.md` - **Container Registry Guide**: `docs/AZURE-CONTAINER-REGISTRY.md` - **Deployment Options**: `docs/AZURE-DEPLOYMENT-SUMMARY.md` --- ## ๐Ÿ’ก Tips 1. **Automatische Triggers**: De pipeline triggert automatisch bij elke push naar `main` branch 2. **Version Tags**: Gebruik git tags (bijv. `v1.0.0`) voor versie-specifieke builds 3. **Monitor Costs**: Check Azure Portal regelmatig voor storage gebruik 4. **Cleanup**: Overweeg oude images te verwijderen om kosten te besparen --- **Veel succes! ๐Ÿš€**