Een on-premises toepassing opnieuw samen stellen in azureRebuild an on-premises application in Azure
In dit artikel wordt beschreven hoe het fictieve bedrijf contoso een Windows .NET-toepassing met twee lagen die wordt uitgevoerd op virtuele VMware-machines (Vm's) opnieuw opgebouwd als onderdeel van een migratie naar Azure.This article demonstrates how the fictional company Contoso rebuilds a two-tier Windows .NET application that's running on VMware virtual machines (VMs) as part of a migration to Azure. Contoso migreert de front-end-VM naar een Azure App Service web-app.Contoso migrates the front-end VM to an Azure App Service web app. Contoso bouwt de back-end van de toepassing met behulp van micro services die zijn geïmplementeerd in containers die worden beheerd door Azure Kubernetes service (AKS).Contoso builds the application back end by using microservices that are deployed to containers managed by Azure Kubernetes Service (AKS). De site communiceert met Azure Functions om functionaliteit te bieden voor foto's van huisdieren.The site interacts with Azure Functions to provide pet photo functionality.
De SmartHotel360-toepassing die in dit voor beeld wordt gebruikt, wordt vermeld onder een open-source licentie.The SmartHotel360 application used in this example is provided under an open-source license. Als u dit wilt gebruiken voor uw eigen test doeleinden, kunt u het downloaden van github.If you want to use it for your own testing purposes, you can download it from GitHub.
Commerciële drijfverenBusiness drivers
Het leidinggevend IT-team van Contoso heeft nauw samengewerkt met commerciële partners om er achter te komen wat het bedrijf met deze migratie wil bereiken:The Contoso IT leadership team has worked closely with business partners to understand what they want to achieve with this migration:
- De groei van het bedrijf stimuleren.Address business growth. Contoso is groeit en wil een gedifferentieerde ervaring bieden voor klanten op contoso websites.Contoso is growing and wants to provide differentiated experiences for customers on Contoso websites.
- Wees flexibel.Be agile. Contoso moet in staat zijn om sneller te reageren dan de wijzigingen in de Marketplace om hun succes in een wereld wijde economie mogelijk te maken.Contoso must be able to react faster than the changes in the marketplace to enable their success in a global economy.
- Tarieven.Scale. Naarmate het bedrijf succesvol groeit, moet het contoso IT-team systemen leveren die in hetzelfde tempo kunnen groeien.As the business grows successfully, the Contoso IT team must provide systems that can grow at the same pace.
- Kosten verlagen.Reduce costs. Contoso wil de licentiekosten minimaliseren.Contoso wants to minimize licensing costs.
MigratiedoelenMigration goals
Het contoso-Cloud team heeft de toepassings vereisten voor deze migratie vastgemaakt.The Contoso cloud team has pinned down application requirements for this migration. Deze vereisten zijn gebruikt om de beste migratiemethode te bepalen:These requirements were used to determine the best migration method:
- De toepassing in azure moet zo kritiek blijven als deze nu on-premises is.The application in Azure must remain as critical as it is today on-premises. Het moet naar behoren kunnen worden uitgevoerd en eenvoudig kunnen worden geschaald.It should perform well and scale easily.
- De toepassing mag geen IaaS-onderdelen (Infrastructure as a Service) gebruiken.The application shouldn't use infrastructure as a service (IaaS) components. Alles moet worden gebouwd om platform as a Service (PaaS) of serverloze services te gebruiken.Everything should be built to use platform as a service (PaaS) or serverless services.
- Toepassings builds moeten worden uitgevoerd in Cloud Services, en containers moeten zich in een persoonlijk REGI ster op ondernemings niveau in de cloud bevinden.Application builds should run in cloud services, and containers should reside in a private, enterprise-wide registry in the cloud.
- De API-service die wordt gebruikt voor huis dier-Foto's, moet nauw keurig en betrouwbaar zijn in de praktijk, omdat beslissingen die door de toepassing worden gemaakt, in hun hotels moeten worden gerespecteerd.The API service that's used for pet photos should be accurate and reliable in the real world, because decisions made by the application must be honored in their hotels. Een dier dat toegang is verleend, mag in de hotels blijven.Any pet granted access is allowed to stay at the hotels.
- Om te voldoen aan de vereisten voor een DevOps-pijp lijn, gebruikt contoso een Git-opslag plaats in azure opslag plaatsen voor broncode beheer.To meet requirements for a DevOps pipeline, Contoso will use a Git repository in Azure Repos for source code management. Automatische builds en releases worden gebruikt om code te bouwen en te implementeren op Azure App Service, Azure Functions en AKS.Automated builds and releases will be used to build code and deploy to Azure App Service, Azure Functions, and AKS.
- Er zijn afzonderlijke pijp lijnen voor continue integratie/doorlopende ontwikkeling (CI/CD) nodig voor micro Services op de back-end en voor de website aan de front-end.Separate continuous integration/continuous development (CI/CD) pipelines are needed for microservices on the back end and for the website on the front end.
- De back-end-services en de front-end-web-app hebben verschillende release cycli.The back-end services and the front-end web app have different release cycles. Om aan deze vereiste te voldoen, implementeert contoso twee verschillende pijp lijnen.To meet this requirement, Contoso will deploy two different pipelines.
- Contoso moet goedkeuring van het management krijgen voor alle implementaties van websites aan de front-end. De CI/CD-pijplijn moet hierin voorzien.Contoso needs management approval for all front-end website deployment, and the CI/CD pipeline must provide this.
Ontwerp van de oplossingSolution design
Nadat Contoso de doelstellingen en vereisten heeft vastgesteld, ontwerpt en beoordeelt het bedrijf een oplossing voor de implementatie en identificeert zij het migratieproces, waaronder de Azure-services die voor de migratie worden gebruikt.After pinning down their goals and requirements, Contoso designs and reviews a deployment solution, and identifies the migration process, including the Azure services that will be used for the migration.
Huidige toepassingCurrent application
- De SmartHotel360 on-premises toepassing wordt getierd op twee Vm's (
WEBVM
enSQLVM
).The SmartHotel360 on-premises application is tiered across two VMs (WEBVM
andSQLVM
). - De VM's bevinden zich op de VMware ESXi-host
contosohost1.contoso.com
(versie 6.5).The VMs are located on VMware ESXi hostcontosohost1.contoso.com
(version 6.5). - De VMware-omgeving wordt beheerd door vCenter Server 6.5 (
vcenter.contoso.com
), die wordt uitgevoerd op een virtuele machine.The VMware environment is managed by vCenter Server 6.5 (vcenter.contoso.com
), running on a VM. - Contoso heeft een on-premises datacenter (
contoso-datacenter
) met een on-premises domeincontroller (contosodc1
).Contoso has an on-premises datacenter (contoso-datacenter
), with an on-premises domain controller (contosodc1
). - De on-premises VM's in het Contoso-datacenter worden buiten gebruik gesteld wanneer de migratie is voltooid.The on-premises VMs in the Contoso datacenter will be decommissioned after the migration is done.
Voorgestelde architectuurProposed architecture
De front-end van de toepassing wordt geïmplementeerd als een Azure App Service web-app in de primaire Azure-regio.The front end of the application is deployed as an Azure App Service web app in the primary Azure region.
Een Azure-functie verzorgt de uploads van huisdierfoto's en de site communiceert met deze functionaliteit.An Azure function provides uploads of pet photos, and the site interacts with this functionality.
De foto van huis dier maakt gebruik van de Computer Vision-API van Azure Cognitive Services samen met Azure Cosmos DB.The pet photo function uses the Computer Vision API of Azure Cognitive Services along with Azure Cosmos DB.
De back-end van de site is gebouwd met micro Services.The back end of the site is built by using microservices. Deze micro services worden geïmplementeerd op containers die worden beheerd in AKS.These microservices will be deployed to containers that are managed in AKS.
Containers worden gebouwd met behulp van Azure DevOps en vervolgens naar Azure Container Registry gepusht.Containers will be built using Azure DevOps and then pushed to Azure Container Registry.
Voor Taan zal contoso hand matig de web-app en functie code implementeren met behulp van Visual Studio.For now, Contoso will manually deploy the web app and function code by using Visual Studio.
Contoso zal micro services implementeren met behulp van een Power shell-script dat Kubernetes opdracht regel Programma's aanroept.Contoso will deploy microservices by using a PowerShell script that calls Kubernetes command-line tools.
Afbeelding 1: scenario architectuur.Figure 1: Scenario architecture.
Beoordeling van de oplossingSolution review
Contoso evalueert het voorgestelde ontwerp door een lijst met voor- en nadelen samen te stellen.Contoso evaluates the proposed design by putting together a pros and cons list.
OverwegingConsideration | DetailsDetails |
---|---|
-ProfessionalsPros | Het gebruik van PaaS en serverloze oplossingen voor de end-to-end-implementatie vermindert de beheer tijd die contoso moet bieden.Using PaaS and serverless solutions for the end-to-end deployment significantly reduces the management time that Contoso must provide. Door overstappen op een architectuur op basis van micro Services kan Contoso de oplossing in de loop van de tijd eenvoudig uitbreiden.Moving to a microservices-based architecture allows Contoso to easily extend the solution over time. Nieuwe functionaliteit kan online worden gebracht zonder de bestaande code bases van de oplossing te onderbreken.New functionality can be brought online without disrupting any of the existing solutions' code bases. De web-app wordt geconfigureerd met meerdere exemplaren, zonder Single Point of Failure.The web app will be configured with multiple instances, with no single point of failure. Automatisch schalen wordt ingeschakeld, zodat de toepassing verschillende verkeers volumes kan verwerken.Autoscaling will be enabled so that the application can handle differing traffic volumes. Met de move to PaaS Services kunnen contoso verouderde oplossingen buiten gebruik stellen die worden uitgevoerd op het besturings systeem Windows Server 2008 R2.With the move to PaaS services, Contoso can retire out-of-date solutions that run on the Windows Server 2008 R2 operating system. Azure Cosmos DB heeft ingebouwde fout tolerantie, waarvoor geen configuratie door contoso nodig is.Azure Cosmos DB has built-in fault tolerance, which requires no configuration by Contoso. Dit betekent dat de gegevenslaag niet langer een Single Point of Failure is.This means that the data tier is no longer a single point of failover. |
NadelenCons | Containers zijn ingewikkelder dan andere migratieopties.Containers are more complex than other migration options. De leercurve kan een probleem zijn voor Contoso.The learning curve could be an issue for Contoso. Ze introduceren een nieuw niveau van complexiteit dat waarde bevat ondanks de curve.They introduce a new level of complexity that provides value in spite of the curve. Het operations-team van Contoso moet zich afdoen om Azure, containers en micro Services voor de toepassing te begrijpen en te ondersteunen.The operations team at Contoso needs to ramp up to understand and support Azure, containers, and microservices for the application. Contoso heeft DevOps niet volledig geïmplementeerd voor de hele oplossing.Contoso hasn't fully implemented DevOps for the entire solution. Contoso moet hiermee rekening houden bij de implementatie van services op AKS, Azure Functions en Azure App Service.Contoso needs to consider that for the deployment of services to AKS, Azure Functions, and Azure App Service. |
MigratieprocesMigration process
Contoso-voorzieningen Azure Container Registry, AKS en Azure Cosmos DB.Contoso provisions Azure Container Registry, AKS, and Azure Cosmos DB.
Contoso richt zich op de infra structuur voor de implementatie, met inbegrip van de Azure App Service web-app, het opslag account, de functie en de API.Contoso provisions the infrastructure for the deployment, including the Azure App Service web app, storage account, function, and API.
Nadat de infra structuur is geïmplementeerd, bouwt contoso hun micro Services-container installatie kopieën met behulp van Azure DevOps, die de installatie kopieën naar het container register pusht.After the infrastructure is in place, Contoso builds their microservices container images by using Azure DevOps, which pushes the images to the container registry.
Contoso implementeert deze micro Services op AKS met behulp van een Power shell-script.Contoso deploys these microservices to AKS by using a PowerShell script.
Ten slotte implementeert Contoso de functie en de web-app.Finally, Contoso deploys the function and web app.
Afbeelding 2: het migratie proces.Figure 2: The migration process.
Azure-servicesAzure services
ServiceService | BeschrijvingDescription | KostenCost |
---|---|---|
AKSAKS | Vereenvoudigt het beheer, de implementatie en bewerkingen van Kubernetes.Simplifies Kubernetes management, deployment, and operations. Biedt een indelingsservice voor volledig beheerde Kubernetes-containers.Provides a fully managed Kubernetes container orchestration service. | AKS is een gratis service.AKS is a free service. Betaal alleen voor de virtuele machines en de bijbehorende opslag-en netwerk bronnen die worden verbruikt.Pay for only the VMs and the associated storage and networking resources that are consumed. Meer informatie.Learn more. |
Azure FunctionsAzure Functions | Versnelt het ontwikkelproces met een gebeurtenisgestuurde, serverloze rekenervaring.Accelerates development with an event-driven, serverless compute experience. Schalen op aanvraag.Scale on demand. | Betaal alleen voor verbruikte resources.Pay only for consumed resources. Het abonnement wordt gefactureerd op basis van resourceverbruik en uitvoeringen per seconde.Plan is billed based on per-second resource consumption and executions. Meer informatie.Learn more. |
Azure Container RegistryAzure Container Registry | Slaat installatiekopieën voor alle typen containerimplementaties op.Stores images for all types of container deployments. | De kosten zijn gebaseerd op functies, opslag en gebruiks duur.Cost is based on features, storage, and usage duration. Meer informatie.Learn more. |
Azure App ServiceAzure App Service | Bouw, implementeer en schaal snel Web-, mobiele en API-apps op ondernemings niveau die op elk platform worden uitgevoerd.Quickly build, deploy, and scale enterprise-grade web, mobile, and API apps that run on any platform. | App Service plannen worden per seconde gefactureerd.App Service plans are billed on a per-second basis. Meer informatie.Learn more. |
VereistenPrerequisites
Dit is wat Contoso nodig heeft voor dit scenario:Here's what Contoso needs for this scenario:
VereistenRequirements | DetailsDetails |
---|---|
Azure-abonnementAzure subscription | |
Azure-infrastructuurAzure infrastructure | |
Vereisten voor ontwikkelaarsDeveloper prerequisites | Contoso heeft de volgende hulpprogramma's op een werkstation voor ontwikkelaars nodig:Contoso needs the following tools on a developer workstation: |
ScenariostappenScenario steps
Hier ziet u hoe Contoso de migratie uitvoert:Here's how Contoso will run the migration:
- Stap 1: AKS en Azure Container Registry inrichten.Step 1: Provision AKS and Azure Container Registry. Contoso richt zich op het beheerde AKS-cluster en het container register met behulp van Power shell.Contoso provisions the managed AKS cluster and the container registry by using PowerShell.
- Stap 2: docker-containers bouwen.Step 2: Build Docker containers. Contoso stelt doorlopende integratie (CI) in voor docker-containers door Azure DevOps te gebruiken en de containers naar het container register te pushen.Contoso sets up continuous integration (CI) for Docker containers by using Azure DevOps and pushes the containers to the container registry.
- Stap 3: de micro services van back-end implementeren.Step 3: Deploy back-end microservices. Contoso implementeert de rest van de infra structuur die wordt gebruikt door back-end-micro Services.Contoso deploys the rest of the infrastructure that will be used by back-end microservices.
- Stap 4: front-end-infra structuur implementeren.Step 4: Deploy front-end infrastructure. Contoso implementeert de front-end-infra structuur, met inbegrip van Blob Storage voor de huis dier-telefoons, Azure Cosmos DB en de Computer Vision-API.Contoso deploys the front-end infrastructure, including Blob storage for the pet phones, Azure Cosmos DB, and the Computer Vision API.
- Stap 5: de back-end migreren.Step 5: Migrate the back end. Contoso implementeert micro Services en voert deze uit op AKS om de back-end te migreren.Contoso deploys microservices and runs them on AKS to migrate the back end.
- Stap 6: de front-end publiceren.Step 6: Publish the front end. Contoso publiceert de SmartHotel360-toepassing naar Azure App Service samen met de functie-app die moet worden aangeroepen door de huisdier-service.Contoso publishes the SmartHotel360 application to Azure App Service along with the function app to be called by the pet service.
Back-endresources inrichtenProvision back-end resources
Contoso-beheerders voeren een implementatie script uit om het beheerde Kubernetes-cluster te maken met behulp van AKS en Azure Container Registry.Contoso admins run a deployment script to create the managed Kubernetes cluster by using AKS and Azure Container Registry. De instructies voor deze sectie gebruiken de SmartHotel360-back-github- opslag plaats.The instructions for this section use the SmartHotel360-Backend GitHub repository. De opslag plaats bevat alle software voor dit onderdeel van de implementatie.The repository contains all the software for this part of the deployment.
Zorg ervoor dat aan de vereisten wordt voldaanEnsure that prerequisites are met
Voordat ze worden gestart, zorgen contoso-beheerders ervoor dat alle vereiste software is geïnstalleerd op de ontwikkel computer die ze voor de implementatie gebruiken.Before they start, Contoso admins ensure that all prerequisite software is installed on the dev machine they're using for the deployment. Ze klonen de opslag plaats lokaal naar de ontwikkel computer met behulp van git:They clone the repository locally to the dev machine by using Git:
git clone https://github.com/Microsoft/SmartHotel360-Backend.git
AKS en Azure Container Registry inrichtenProvision AKS and Azure Container Registry
De contoso-beheerders richten AKS en Azure Container Registry als volgt in:The Contoso admins provision AKS and Azure Container Registry as follows:
In Visual Studio code openen ze de map en gaat u naar de
/deploy/k8s
map die het script bevatgen-aks-env.ps1
.In Visual Studio Code, they open the folder and go to the/deploy/k8s
directory, which contains the scriptgen-aks-env.ps1
.Ze voeren het script uit om het beheerde Kubernetes-cluster te maken met behulp van AKS en Azure Container Registry.They run the script to create the managed Kubernetes cluster, using AKS and Azure Container Registry.
Afbeelding 3: het beheerde Kubernetes-cluster maken.Figure 3: Creating the managed Kubernetes cluster.
Als het bestand is geopend, worden de para meters van $location bijgewerkt naar
eastus2
en wordt het bestand opgeslagen.With the file open, they update the $location parameter toeastus2
, and save the file.Afbeelding 4: het bestand wordt opgeslagen.Figure 4: Saving the file.
Ze selecteren > Geïntegreerde Terminal weer geven om de geïntegreerde Terminal te openen in Visual Studio code.They select View > Integrated terminal to open the integrated terminal in Visual Studio Code.
Afbeelding 5: de terminal in Visual Studio code.Figure 5: The terminal in Visual Studio Code.
De geïntegreerde Power shell-terminal meldt zich aan bij Azure met behulp van de
Connect-AzureRmAccount
opdracht.In the PowerShell integrated terminal, they sign into Azure using theConnect-AzureRmAccount
command. Zie aan de slag met Power shellvoor meer informatie.For more information, see Get started with PowerShell.Afbeelding 6: de geïntegreerde Power shell-terminal.Figure 6: The PowerShell integrated terminal.
Ze verifiëren de Azure CLI door de
az login
opdracht uit te voeren en de instructies te volgen voor verificatie met behulp van hun webbrowser.They authenticate the Azure CLI by running theaz login
command and following the instructions to authenticate using their web browser. Meer informatie over Aanmelden met de Azure cli.Learn more about logging in with the Azure CLI.Afbeelding 7: de Azure CLI verifiëren.Figure 7: Authenticating the Azure CLI.
De volgende opdracht wordt uitgevoerd bij het door geven van de naam van de resource groep
ContosoRG
, de naam van het AKSsmarthotel-aks-eus2
-cluster en de nieuwe register naam.They run the following command while passing the resource group name ofContosoRG
, the name of the AKS clustersmarthotel-aks-eus2
, and the new registry name..\gen-aks-env.ps1 -resourceGroupName ContosoRg -orchestratorName smarthotelakseus2 -registryName smarthotelacreus2
Afbeelding 8: uitvoeren van de opdracht.Figure 8: Running the command.
Azure maakt een andere resource groep die de resources voor het AKS-cluster bevat.Azure creates another resource group that contains the resources for the AKS cluster.
Afbeelding 9: een resource groep maken met Azure.Figure 9: Azure creating a resource group.
Nadat de implementatie is voltooid, installeert zij het
kubectl
opdracht regel programma.After the deployment is finished, they install thekubectl
command-line tool. Het hulp programma is al geïnstalleerd op de Azure Cloud Shell.The tool is already installed on the Azure Cloud Shell.az aks install-cli
Ze controleren de verbinding met het cluster door de opdracht uit te voeren
kubectl get nodes
.They verify the connection to the cluster by running thekubectl get nodes
command. Het knoop punt heeft dezelfde naam als de virtuele machine in de automatisch gemaakte resource groep.The node has the same name as the VM in the automatically created resource group.Afbeelding 10: de verbinding met het cluster wordt gecontroleerd.Figure 10: Verifying the connection to the cluster.
Ze voeren de volgende opdracht uit om het Kubernetes-dash board te starten:They run the following command to start the Kubernetes dashboard:
az aks browse --resource-group ContosoRG --name smarthotelakseus2
Er wordt een browser tabblad geopend in het dash board.A browser tab opens to the dashboard. Dit is een tunnel verbinding die gebruikmaakt van de Azure CLI.This is a tunneled connection that uses the Azure CLI.
Afbeelding 11: een verbinding met een tunnel.Figure 11: A tunneled connection.
Stap 2: de back-end-pijp lijn configurerenStep 2: Configure the back-end pipeline
Een Azure DevOps-project maken en compilerenCreate an Azure DevOps project and build
Contoso maakt een Azure DevOps-project, configureert een CI-build om de container te maken en duwt deze vervolgens naar het container register.Contoso creates an Azure DevOps project, configures a CI build to create the container, and then pushes it to the container registry. De instructies in deze sectie gebruiken de opslag plaats SmartHotel360-back-end .The instructions in this section use the SmartHotel360-Backend repository.
Van worden er
visualstudio.com
een nieuwe organisatie (contosodevops360.visualstudio.com
) gemaakt en geconfigureerd voor het gebruik van Git.Fromvisualstudio.com
, they create a new organization (contosodevops360.visualstudio.com
) and configure it to use Git.Ze maken een nieuw project (
SmartHotelBackend
) en selecteren Git voor versie beheer en Agile voor de werk stroom.They create a new project (SmartHotelBackend
), selecting Git for version control and Agile for the workflow.Afbeelding 12: een nieuw project maken.Figure 12: Creating a new project.
Ze importeren de GitHub-opslagplaats.They import the GitHub repo.
Afbeelding 13: de GitHub opslag plaats wordt geïmporteerd.Figure 13: Importing the GitHub repo.
In pijp lijnen selecteren ze een nieuwe pijp lijn met behulp van Azure opslag plaatsen Git als bron van de opslag plaats.In Pipelines, they select Build and create a new pipeline by using Azure Repos Git as a source from the repository.
Afbeelding 14: een nieuwe pijp lijn maken.Figure 14: Creating a new pipeline.
Ze selecteren een lege taak.They select Empty job.
Afbeelding 15: te beginnen met een lege taak.Figure 15: Starting with an empty job.
Ze selecteren Gehoste Linux-preview voor de build-pipeline.They select Hosted Linux Preview for the build pipeline.
Afbeelding 16: het instellen van de build-pijp lijn.Figure 16: Setting up the build pipeline.
In stap 1 voegen we een docker-taak samen stellen toe.In Step 1, they add a Docker Compose task. Met deze taak wordt de docker-compositie samengesteld.This task builds the Docker Compose.
Afbeelding 17: buil ding docker opstellen.Figure 17: Building the Docker Compose.
Ze herhalen de Docker Compose-taak en voegen nog een taak toe.They repeat and add another Docker Compose task. Hiermee worden de containers naar het container register gepusht.This one pushes the containers to the container registry.
Afbeelding 18: toevoegen van een andere docker-taak voor opstellen.Figure 18: Adding another Docker Compose task.
Ze selecteren de eerste taak voor het maken en configureren van de build met het Azure-abonnement, de autorisatie en de Container Registry.They select the first task to build and configure the build with the Azure subscription, authorization, and Container Registry.
Afbeelding 19: de build maken en configureren.Figure 19: Building and configuring the build.
Hiermee geeft u het pad van het
docker-compose.yaml
bestand op in de map src van de opslag plaats.They specify the path of thedocker-compose.yaml
file in the src folder of the repo. Ze kiezen ervoor om service-installatie kopieën te bouwen en de nieuwste tag op te zetten.They choose to build service images and include the latest tag. Wanneer de actie wordt gewijzigd in Service-installatiekopieën opbouwen, wordt de naam van de Azure DevOps-taak gewijzigd in Services automatisch opbouwen.When the action changes to Build service images, the name of the Azure DevOps task changes to Build services automatically.Afbeelding 20: de details van de taak.Figure 20: The specifics of the task.
Nu configureren ze de tweede Docker-taak (om te pushen).Now, they configure the second Docker task (to push). Ze selecteren het abonnement en het container register (
smarthotelacreus2
).They select the subscription and the container registry (smarthotelacreus2
).Afbeelding 21: de tweede docker-taak configureren.Figure 21: Configuring the second Docker task.
Ze voeren de docker-yaml- bestands naam in en selecteren push service-installatie kopieën, met inbegrip van de nieuwste tag.They enter the docker-compose.yaml file name and select Push service images, including the latest tag. Wanneer de actie wordt gewijzigd in Service-installatiekopieën pushen, wordt de naam van de Azure DevOps-taak gewijzigd in Services automatisch pushen.When the action changes to Push service images, the name of the Azure DevOps task changes to Push services automatically.
Afbeelding 22: de naam van de Azure DevOps-taak wijzigen.Figure 22: Changing the Azure DevOps task name.
Met de Azure DevOps-taken die zijn geconfigureerd, wordt de bouw pijp lijn door contoso opgeslagen en wordt het bouw proces gestart.With the Azure DevOps tasks configured, Contoso saves the build pipeline and starts the build process.
Afbeelding 23: het bouw proces wordt gestart.Figure 23: Starting the build process.
Ze selecteren de build-taak om de voortgang te controleren.They select the build job to check progress.
Afbeelding 24: de voortgang controleren.Figure 24: Checking the progress.
Nadat de build is voltooid, wordt in het container register de nieuwe opslag plaatsen weer gegeven. deze worden gevuld met de containers die worden gebruikt door de micro Services.After the build finishes, the container registry shows the new repos, which are populated with the containers used by the microservices.
Afbeelding 25: het weer geven van nieuwe opslag plaatsen nadat de build is voltooid.Figure 25: Viewing new repos after the build finishes.
De back-endinfrastructuur implementerenDeploy the back-end infrastructure
Als het AKS-cluster is gemaakt en de Docker-installatiekopieën zijn opgebouwd, implementeren Contoso-beheerders nu de rest van de infrastructuur die wordt gebruikt door back-endmicroservices.With the AKS cluster created and the Docker images built, Contoso admins now deploy the rest of the infrastructure that will be used by back-end microservices.
- In de instructies in deze sectie wordt gebruikgemaakt van de SmartHotel360-back- opslag plaats.Instructions in this section use the SmartHotel360-Backend repo.
- In de
/deploy/k8s/arm
map is er één script voor het maken van alle items.In the/deploy/k8s/arm
folder, there's a single script to create all items.
De beheerders implementeren de infra structuur als volgt:The admins deploy the infrastructure as follows:
Ze openen een opdracht prompt voor ontwikkel aars en gebruiken vervolgens de opdracht
az login
voor het Azure-abonnement.They open a developer command prompt and then use the commandaz login
for the Azure subscription.Ze gebruiken het
deploy.cmd
bestand voor het implementeren van de Azure-resources in deContosoRG
resource groep enEast US 2
regio door de volgende opdracht te typen:They use thedeploy.cmd
file to deploy the Azure resources in theContosoRG
resource group andEast US 2
region by typing the following command:.\deploy.cmd azuredeploy ContosoRG -c eastus2
Afbeelding 26: de back-end implementeren.Figure 26: Deploying the back end.
In de Azure Portal worden de connection string voor elke Data Base vastgelegd voor later gebruik.In the Azure portal, they capture the connection string for each database for later use.
Afbeelding 27: vastleggen van de connection string voor elke Data Base.Figure 27: Capturing the connection string for each database.
Back-endrelease-pijplijn makenCreate the back-end release pipeline
Contoso-beheerders gaan als volgt te werk:Now, Contoso admins do the following:
- Implementeren van de inkomende NGINX-controller om inkomend verkeer naar de services toe te staan.Deploy the NGINX ingress controller to allow inbound traffic to the services.
- Implementeren van de microservices voor het AKS-cluster.Deploy the microservices to the AKS cluster.
- Als eerste stap kunnen beheerders de verbindings reeksen bijwerken met de micro Services met behulp van Azure DevOps.As a first step, admins update the connection strings to the microservices by using Azure DevOps. Ze configureren vervolgens een nieuwe Azure DevOps release-pijp lijn voor het implementeren van de micro Services.They then configure a new Azure DevOps release pipeline to deploy the microservices.
- De instructies in deze sectie gebruiken de SmartHotel360-back- opslag plaats.The instructions in this section use the SmartHotel360-Backend repo.
- Sommige configuratie-instellingen (bijvoorbeeld Active Directory B2C) vallen niet onder dit artikel.Some of the configuration settings (for example, Active Directory B2C) aren't covered in this article. Raadpleeg de eerder genoemde SmartHotel360-Backend opslag plaats voor meer informatie over deze instellingen.For more information about these settings, review the previously mentioned SmartHotel360-Backend repo.
De beheerders maken de pijp lijn:The admins create the pipeline:
In Visual Studio werken ze het /deploy/k8s/config_local. yml -bestand bij met de database verbindings gegevens die ze eerder hebben genoteerd.In Visual Studio, they update the /deploy/k8s/config_local.yml file with the database connection information that they noted earlier.
Afbeelding 28: database verbindingen.Figure 28: Database connections.
Ze openen Azure DevOps en in het SmartHotel360-project selecteren ze + nieuwe pijp lijn in het deel venster releases .They open Azure DevOps and, in the SmartHotel360 project, they select + New pipeline on the Releases pane.
Afbeelding 29: een nieuwe pijp lijn maken.Figure 29: Creating a new pipeline.
Ze selecteren Lege taak om de pijplijn zonder sjabloon te starten.They select Empty Job to start the pipeline without a template.
Ze geven de namen van de fase en de pijplijn op.They provide the stage and pipeline names.
Afbeelding 30: de naam van het stadium.Figure 30: The stage name.
Afbeelding 31: de naam van de pijp lijn.Figure 31: The pipeline name.
Ze voegen een artefact toe.They add an artifact.
Afbeelding 32: een artefact toevoegen.Figure 32: Adding an artifact.
Ze selecteren Git als bron type en geven het project, de bron en de hoofd vertakking op voor de SmartHotel360-toepassing.They select Git as the source type and specify the project, source, and main branch for the SmartHotel360 application.
Afbeelding 33: het deel venster artefact instellingen.Figure 33: The artifact settings pane.
Ze selecteren de taakkoppeling.They select the task link.
Afbeelding 34: de koppeling naar de taak.Figure 34: The task link.
Ze voegen een nieuwe Azure PowerShell-taak toe, zodat ze een PowerShell-script in een Azure-omgeving kunnen uitvoeren.They add a new Azure PowerShell task so that they can run a PowerShell script in an Azure environment.
Afbeelding 35: een nieuwe Power shell-taak toevoegen.Figure 35: Adding a new PowerShell task.
Ze selecteren het Azure-abonnement voor de taak en selecteren het
deploy.ps1
script in de Git-opslag plaats.They select the Azure subscription for the task and select thedeploy.ps1
script from the Git repo.Afbeelding 36: het script uitvoeren.Figure 36: Running the script.
Ze voegen argumenten toe aan het script.They add arguments to the script. Met het script wordt alle clusterinhoud verwijderd (met uitzondering van inkomend en inkomende controller) en worden de microservices geïmplementeerd.The script will delete all cluster content (except ingress and ingress controller), and deploy the microservices.
Afbeelding 37: het toevoegen van argumenten aan het script.Figure 37: Adding arguments to the script.
Ze stellen de voor Keurs-Azure PowerShell versie in op de meest recente versie en slaan de pijp lijn op.They set the preferred Azure PowerShell version to the latest version, and save the pipeline.
Ze gaan terug naar het deel venster een nieuwe release maken en hand matig een nieuwe release maken.They go back to the Create a new release pane and manually create a new release.
Afbeelding 38: hand matig een nieuwe release maken.Figure 38: Manually creating a new release.
Nadat de release is gemaakt, selecteert ze deze en selecteert ze onder acties de optie implementeren.After they create the release, they select it and, under Actions, they select Deploy.
Afbeelding 39: een release implementeren.Figure 39: Deploying a release.
Wanneer de implementatie is voltooid, wordt de volgende opdracht uitgevoerd om de status van services te controleren met behulp van de Azure Cloud Shell:
kubectl get services
.When the deployment is complete, they run the following command to check the status of services, using the Azure Cloud Shell:kubectl get services
.
Stap 3: front-end-services inrichtenStep 3: Provision front-end services
Contoso-beheerders moeten de infra structuur implementeren die wordt gebruikt door de front-end-toepassingen.Contoso admins need to deploy the infrastructure that will be used by the front-end applications. Ze maken:They create:
- Een BLOB storage-container om de huisdier installatie kopieën op te slaan.A Blob storage container to store the pet images.
- Een Azure Cosmos DB-Data Base voor het opslaan van documenten met huisdier informatie.An Azure Cosmos DB database to store documents containing pet information.
- De Computer Vision-API voor de website.The Computer Vision API for the website.
Instructies voor deze sectie gebruiken de SmartHotel360-website opslag plaats.Instructions for this section use the SmartHotel360-website repo.
Blob-opslagcontainers makenCreate Blob storage containers
In de Azure Portal Open de beheerders het opslag account dat is gemaakt en selecteer vervolgens blobs.In the Azure portal, the admins open the storage account that was created, and then select Blobs.
Ze maken een nieuwe container
Pets
met de naam met het niveau Public-Access dat voor de container is ingesteld.They create a new container namedPets
with the public-access level set for the container. Gebruikers uploaden hun huisdierfoto's naar deze container.Users will upload their pet photos to this container.Afbeelding 40: een nieuwe container maken.Figure 40: Creating a new container.
Ze maken een tweede nieuwe container met de naam
settings
.They create a second new container namedsettings
. Een bestand met alle instellingen voor de front-endapp wordt in deze container geplaatst.A file with all the front-end app settings will be placed in this container.Afbeelding 41: een tweede container maken.Figure 41: Creating a second container.
Ze vastleggen de toegangs gegevens voor het opslag account in een tekst bestand voor toekomstig naslag doeleinden.They capture the access details for the storage account in a text file for future reference.
Afbeelding 42: een tekst bestand waarin toegangs gegevens worden vastgelegd.Figure 42: A text file capturing access details.
Een Azure Cosmos DB-Data Base inrichtenProvision an Azure Cosmos DB database
Contoso-beheerders richten een Azure Cosmos DB Data Base op die moet worden gebruikt voor huisdier informatie.Contoso admins provision an Azure Cosmos DB database to be used for pet information.
Ze maken een Azure Cosmos DB -data base in azure Marketplace.They create an Azure Cosmos DB database in Azure Marketplace.
Afbeelding 43: een Azure Cosmos DB-Data Base maken.Figure 43: Creating an Azure Cosmos DB database.
Hiermee geeft u een naam op
contososmarthotel
, selecteert u de SQL-API en plaatst u deze in de productie resource groepContosoRG
in de hoofd regioEast US 2
.They specify a namecontososmarthotel
, select the SQL API, and place it in the production resource groupContosoRG
in the main regionEast US 2
.Afbeelding 44: de naam van een Azure Cosmos DB Data Base.Figure 44: Naming an Azure Cosmos DB database.
Ze voegen een nieuwe verzameling toe aan de data base, met standaardcapaciteit en -doorvoer.They add a new collection to the database, with default capacity and throughput.
Afbeelding 45: een nieuwe verzameling toevoegen aan de data base.Figure 45: Adding a new collection to the database.
Ze noteren de verbindings gegevens voor de Data Base voor toekomstige referentie.They note the connection information for the database for future reference.
Afbeelding 46: de verbindings gegevens voor de data base.Figure 46: The connection information for the database.
De Computer Vision-API inrichtenProvision the Computer Vision API
Contoso-beheerders richten de Computer Vision API in.Contoso admins provision the Computer Vision API. De API wordt aangeroepen door de functie om afbeeldingen te evalueren die door gebruikers worden geüpload.The API will be called by the function, to evaluate pictures that are uploaded by users.
De beheerders maken een Computer Vision -exemplaar in azure Marketplace.The admins create a Computer Vision instance in Azure Marketplace.
Afbeelding 47: een nieuw exemplaar in azure Marketplace.Figure 47: A new instance in Azure Marketplace.
Ze richten de API (
smarthotelpets
) in de resource groep productie opContosoRG
, in de hoofd regio (East US 2
).They provision the API (smarthotelpets
) in the production resource groupContosoRG
, in the main region (East US 2
).Afbeelding 48: een API inrichten in een productie resource groep.Figure 48: Provisioning an API in a production resource group.
Ze slaan de verbindingsinstellingen voor de API op in een tekstbestand voor latere referentie.They save the connection settings for the API to a text file for later reference.
Afbeelding 49: de verbindings instellingen van een API opslaan.Figure 49: Saving an API's connection settings.
De Azure-web-app inrichtenProvision the Azure web app
Contoso-beheerders richten de web-app in met behulp van de Azure Portal.Contoso admins provision the web app by using the Azure portal.
Ze selecteren Web-app in de portal.They select Web App in the portal.
Afbeelding 50: de web-app wordt geselecteerd.Figure 50: Selecting the web app.
Ze geven een web-app-naam (
smarthotelcontoso
), voeren deze uit in Windows en plaatsen deze in de productie resource groepContosoRG
.They provide a web app name (smarthotelcontoso
), run it on Windows, and place it in the production resource groupContosoRG
. Ze maken een nieuw Application Insights-exemplaar voor toepassings bewaking.They create a new Application Insights instance for application monitoring.Afbeelding 51: de naam van de web-app.Figure 51: The web app name.
Nadat de beheerders klaar zijn, bladeren ze naar het adres van de toepassing om te controleren of deze is gemaakt.After they're done, the admins browse to the address of the application to check on whether it has been created successfully.
In de Azure Portal wordt er een faserings sleuf voor de code gemaakt.In the Azure portal, they create a staging slot for the code. De pijp lijn wordt geïmplementeerd op deze sleuf.The pipeline will be deployed to this slot. Deze aanpak zorgt ervoor dat code pas in productie wordt gezet als de beheerders een release hebben uitgevoerd.This approach ensures that code isn't put into production until the admins perform a release.
Afbeelding 52: een faserings sleuf voor een web-app toevoegen.Figure 52: Adding a web app staging slot.
De functie-app inrichtenProvision the function app
In de Azure Portal richt contoso-beheerders de functie-app in.In the Azure portal, Contoso admins provision the function app.
Ze selecteren Functie-app.They select Function App.
Afbeelding 53: de functie-app wordt geselecteerd.Figure 53: Selecting the function app.
Ze geven een naam voor de functie-app (
smarthotelpetchecker
).They provide a name for the function app (smarthotelpetchecker
). De functie-app wordt in de productie resource groep (ContosoRG
) geplaatst.They place the function app in the production resource group (ContosoRG
). Ze stellen de hosting locatie in op het verbruiks plan en plaatsen de functie-app in deEast US 2
regio.They set the hosting place to Consumption Plan, and place the function app in theEast US 2
region. Er wordt een nieuw opslag account gemaakt, samen met een Application Insights-exemplaar voor bewaking.A new storage account is created along with an Application Insights instance for monitoring.Afbeelding 54: instellingen voor de functie-app.Figure 54: Function app settings.
Nadat de functie-app is geïmplementeerd, bladeren de beheerders naar het adres om te controleren of het is gemaakt.After they've deployed the function app, the admins browse to its address to verify that it has been created successfully.
Stap 4: de front-end-pijp lijn instellenStep 4: Set up the front-end pipeline
Contoso-beheerders maken twee verschillende projecten voor de front-endsite.Contoso admins create two different projects for the front-end site.
In azure DevOps maken ze een project
SmartHotelFrontend
.In Azure DevOps, they create a projectSmartHotelFrontend
.Afbeelding 55: een front-end-project maken.Figure 55: Creating a front-end project.
Ze importeren Git-opslagplaats SmartHotel360 front-end in het nieuwe project.They import the SmartHotel360 front end Git repository into the new project.
Voor de functie-app maken ze nog een Azure DevOps-project (
SmartHotelPetChecker
) en importeren ze de petchecker Git-opslag plaats in dit project.For the function app, they create another Azure DevOps project (SmartHotelPetChecker
) and import the petchecker git repository into this project.
De web-app configurerenConfigure the web app
De web-app wordt nu door Contoso-beheerders geconfigureerd voor het gebruik van Contoso-resources.Now Contoso admins configure the web app to use Contoso resources.
De beheerders maken verbinding met het Azure DevOps-project en klonen de opslag plaats lokaal naar de ontwikkel machine.The admins connect to the Azure DevOps project and clone the repository locally to the development machine.
In Visual Studio openen ze de map om alle bestanden in de opslagplaats weer te geven.In Visual Studio, they open the folder to show all the files in the repo.
Afbeelding 56: het weer geven van alle bestanden in de opslag plaats.Figure 56: Viewing all files in the repo.
Zo nodig werken ze de wijzigingen aan de configuratie bij.They update the configuration changes as required.
- Wanneer de web-app wordt gestart, zoekt deze naar de
SettingsUrl
app-instelling.When the web app starts up, it looks for theSettingsUrl
app setting. - Deze variabele moet een URL bevatten die naar een configuratie bestand verwijst.This variable must contain a URL that points to a configuration file.
- De instelling die wordt gebruikt, is standaard een openbaar eind punt.By default, the setting that's used is a public endpoint.
- Wanneer de web-app wordt gestart, zoekt deze naar de
Ze werken het
/config-sample.json/sample.json
bestand bij.They update the/config-sample.json/sample.json
file.- Dit is het configuratie bestand voor het web wanneer het het open bare eind punt gebruikt.This is the configuration file for the web when it uses the public endpoint.
- Ze bewerken de
urls
enpets_config
secties met de waarden voor de AKS API-eind punten, opslag accounts en Azure Cosmos DB Data Base.They edit theurls
andpets_config
sections with the values for the AKS API endpoints, storage accounts, and Azure Cosmos DB database. - De URL's moeten overeenkomen met de DNS-naam van de nieuwe web-app die door Contoso wordt gemaakt.The URLs should match the DNS name of the new web app that Contoso will create.
- Voor contoso is dit
smarthotelcontoso.eastus2.cloudapp.azure.com
.For Contoso, this issmarthotelcontoso.eastus2.cloudapp.azure.com
.
Afbeelding 57: de. json-instellingen.Figure 57: The .json settings.
Nadat het bestand is bijgewerkt, wordt de naam van de beheerder gewijzigd
smarthotelsettingsurl
en wordt het geüpload naar de Blob-opslag die ze eerder hebben gemaakt.After they update the file, the admins rename itsmarthotelsettingsurl
and upload it to the Blob storage they created earlier.Afbeelding 58: het wijzigen van de naam en het uploaden van het bestand.Figure 58: Renaming and uploading the file.
Ze selecteren het bestand om de URL op te halen.They select the file to get the URL. De URL wordt door de toepassing gebruikt bij het ophalen van de configuratie bestanden.The URL is used by the application when it pulls down the configuration files.
Afbeelding 59: de URL van de toepassing.Figure 59: The application URL.
In de appsettings.Production.jsop bestand wordt de
SettingsURL
URL van het nieuwe bestand bijgewerkt.In the appsettings.Production.json file, they update theSettingsURL
to the URL of the new file.Afbeelding 60: de URL naar het nieuwe bestand bijwerken.Figure 60: Updating the URL to the new file.
De website in Azure App Service implementerenDeploy the website to Azure App Service
Contoso-beheerders kunnen de website nu publiceren.Contoso admins can now publish the website.
Ze openen Azure DevOps en in het
SmartHotelFrontend
project in builds en releases selecteren ze + nieuwe pijp lijn.They open Azure DevOps and, in theSmartHotelFrontend
project in Builds and Releases, they select + New pipeline.Ze selecteren Azure DevOps Git als een bron.They select Azure DevOps Git as a source.
Ze selecteren de ASP.Net Core-sjabloon.They select the ASP.NET Core template.
Ze beoordelen de pijp lijn en controleren of publicatie van webprojecten en zip-gepubliceerde projecten is geselecteerd.They review the pipeline and check to ensure that Publish Web Projects and Zip Published Projects are selected.
Afbeelding 61: pijplijn instellingen.Figure 61: Pipeline settings.
In Triggers kunnen ze continue integratie inschakelen en de hoofd vertakking toevoegen.In Triggers, they enable continuous integration and add the main branch. Dit zorgt ervoor dat de build-pijp lijn begint elke keer dat er voor de oplossing nieuwe code wordt toegewezen aan de hoofd vertakking.This ensures that the build pipeline starts each time the solution has new code committed to the main branch.
Afbeelding 62: continue integratie inschakelen.Figure 62: Enabling continuous integration.
Ze selecteren Opslaan en in wachtrij plaatsen om een build te starten.They select Save & Queue to start a build.
Nadat de build is voltooid, configureren ze een release pijplijn met behulp van Azure app service-implementatie.After the build finishes, they configure a release pipeline by using Azure App Service Deployment.
Ze geven de naam van een fase, fase ring.They provide a stage name, Staging.
Afbeelding 63: de naam van de omgeving.Figure 63: Naming the environment.
Ze voegen een artefact toe en selecteren de build die ze hebben geconfigureerd.They add an artifact and select the build that they've configured.
Afbeelding 64: een artefact toevoegen.Figure 64: Adding an artifact.
Ze selecteren het pictogram bliksem Schicht op het artefact en stellen vervolgens continue implementatie in op ingeschakeld.They select the lightning bolt icon on the artifact and then set continuous deployment to Enabled.
Afbeelding 65: continue implementatie inschakelen.Figure 65: Enabling continuous deployment.
In Omgeving selecteren ze 1 job, 1 taak onder Staging.In Environment, they select 1 job, 1 task under Staging.
Nadat u de naam van het abonnement en de web-app hebt geselecteerd, worden de beheerders de taak implementeren Azure app service geopend.After selecting the subscription and web app name, the admins open the Deploy Azure App Service task. De implementatie is geconfigureerd voor gebruik van de staging-implementatiesite.The deployment is configured to use the staging deployment slot. Hiermee wordt in deze site automatisch code gemaakt voor beoordeling en goedkeuring.This automatically builds code for review and approval in this slot.
Afbeelding 66: implementeren naar een sleuf.Figure 66: Deploying to a slot.
In de pijplijn voegen ze een nieuwe fase toe.In the Pipeline, they add a new stage.
Afbeelding 67: een nieuw stadium toevoegen.Figure 67: Adding a new stage.
Ze selecteren Azure app service implementatie met behulp van een sleuf en de naam van de omgevings tabel.They select Azure App Service deployment with slot and then name the environment Prod.
Ze selecteren 1 taak, 2 taken en selecteren vervolgens het abonnement, de app service-naam en de faserings sleuf.They select 1 job, 2 tasks and then select the subscription, the app service name, and the staging slot.
Afbeelding 68: de naam van de omgeving.Figure 68: Naming the environment.
Ze verwijderen Azure App Service implementeren voor site vanuit de pijplijn.They remove the Deploy Azure App Service to Slot from the pipeline. Het is er in de vorige stappen geplaatst.It was placed there by the previous steps.
Afbeelding 69: een sleuf verwijderen uit de pijp lijn.Figure 69: Removing a slot from the pipeline.
Ze slaan de pijplijn op.They save the pipeline. Op de pijplijn selecteren ze Voorwaarden na implementatie.On the pipeline, they select Post-deployment conditions.
Afbeelding 70: voor waarden na de implementatie.Figure 70: Post-deployment conditions.
Ze maken goed keuringen na de implementatie mogelijk en voegen een dev-lead toe als fiatteur.They enable Post-deployment approvals and then add a dev lead as the approver.
Afbeelding 71: een goed keurder toevoegen.Figure 71: Adding an approver.
In de build-pijp lijn starten de beheerders hand matig een build.In the build pipeline, the admins manually kick off a build. Hiermee wordt de nieuwe release-pijplijn geactiveerd, waarmee de site wordt geïmplementeerd voor de staging-site.This triggers the new release pipeline, which deploys the site to the staging slot. Voor Contoso is
https://smarthotelcontoso-staging.azurewebsites.net/
de URL voor de site.For Contoso, the URL for the slot ishttps://smarthotelcontoso-staging.azurewebsites.net/
.Wanneer de build is voltooid en de release is geïmplementeerd in de sleuf, stuurt Azure DevOps de ontwikkel leider een e-mail met een goed keuring.After the build finishes and the release is deployed to the slot, Azure DevOps emails the dev lead for approval.
De dev lead selecteert goed keuring weer geven en kan de aanvraag goed keuren of afwijzen in de Azure DevOps-Portal.The dev lead selects View approval and can approve or reject the request in the Azure DevOps portal.
Afbeelding 72: de goedkeurings aanvraag voor een vrijgave in behandeling.Figure 72: A pending release approval request.
De dev lead maakt een opmerking en keurt deze goed.The dev lead makes a comment and approves. Hiermee wordt begonnen met het wisselen van de faserings -en productie sleuven en wordt de build naar productie verplaatst.This starts swapping the staging and prod slots and moves the build into production.
Afbeelding 73: de build wordt verplaatst naar productie.Figure 73: Moving the build into production.
Het omwisselen wordt voltooid met de pijplijn.The pipeline completes the swap.
Afbeelding 74: de swap volt ooien.Figure 74: Completing the swap.
Het team controleert de prod-site om te verifiëren of de web-app in productie is op
https://smarthotelcontoso.azurewebsites.net/
.The team checks the prod slot to verify that the web app is in production athttps://smarthotelcontoso.azurewebsites.net/
.
De PetChecker-functie-app implementerenDeploy the PetChecker function app
Contoso-beheerders implementeren de toepassing door het volgende te doen:Contoso admins deploy the application by doing the following:
Ze klonen de opslagplaats lokaal op de ontwikkelcomputer door verbinding te maken met het Azure DevOps-project.They clone the repository locally to the development machine by connecting to the Azure DevOps project.
In Visual Studio openen ze de map om alle bestanden in de opslagplaats weer te geven.In Visual Studio, they open the folder to show all the files in the repo.
Ze openen de src/PetCheckerFunction/local.settings.jsin het bestand en voegen de app-instellingen voor opslag, de Azure Cosmos DB-Data Base en de computer vision-API toe.They open the src/PetCheckerFunction/local.settings.json file and add the app settings for storage, the Azure Cosmos DB database, and the Computer Vision API.
Afbeelding 75: de functie wordt geïmplementeerd.Figure 75: Deploying the function.
Ze voeren de code uit en synchroniseren deze terug naar Azure DevOps, waarbij de wijzigingen worden gepusht.They commit the code and sync it back to Azure DevOps, pushing their changes.
Ze voegen een nieuwe build-pijp lijn toe en selecteren vervolgens Azure DevOps Git voor de bron.They add a new build pipeline and then select Azure DevOps Git for the source.
Ze selecteren de ASP.NET Core (.NET Framework)-sjabloon.They select the ASP.NET Core (.NET Framework) template.
Ze accepteren de standaardwaarden voor de sjabloon.They accept the defaults for the template.
Onder Triggers selecteert u continue integratie inschakelen en selecteert u vervolgens & wachtrij opslaan om een build te starten.Under Triggers, they select Enable continuous integration and then select Save & Queue to start a build.
Nadat de build is voltooid, bouwt ze een release pijplijn op en voegen zij Azure app service implementatie toe met een sleuf.After the build succeeds, they build a release pipeline, adding Azure App Service deployment with slot.
De naam van de omgevings tabel en selecteer vervolgens het abonnement.They name the environment Prod and then select the subscription. Het app- type wordt ingesteld op functie-app en de naam van de app service als
smarthotelpetchecker
.They set the App type to Function App and the app service name assmarthotelpetchecker
.Afbeelding 76: de functie-app.Figure 76: The function app.
Ze voegen een artefact toe, bouwen.They add an artifact, Build.
Afbeelding 77: een artefact toevoegen.Figure 77: Adding an artifact.
Ze scha kelen continue implementatie activeren en selecteren vervolgens Opslaan.They enable Continuous deployment trigger and then select Save.
Ze selecteren Nieuwe build in wachtrij plaatsen om de volledige CI/CD-pijplijn uit te voeren.They select Queue new build to run the full CI/CD pipeline.
Nadat de functie is geïmplementeerd, wordt deze weer gegeven in de Azure Portal met de status wordt uitgevoerd.After the function is deployed, it appears in the Azure portal with the status Running.
Afbeelding 78: de status van de functie wordt bijgewerkt.Figure 78: Updating the function's status.
Ze bladeren naar de toepassing huisdier Checker,
http://smarthotel360public.azurewebsites.net/pets
om te controleren of deze goed werkt.They browse to the pet checker application, athttp://smarthotel360public.azurewebsites.net/pets
, to verify that it's working properly.Ze selecteren de avatar om een afbeelding te uploaden.They select the avatar to upload a picture.
Afbeelding 79: een afbeelding aan een avatar toewijzen.Figure 79: Assigning a picture to an avatar.
De eerste foto die ze willen controleren, is van een hondje.The first photo they want to check is of a small dog.
Afbeelding 80: de foto controleren.Figure 80: Checking the photo.
De toepassing retourneert een acceptatie bericht.The application returns an acceptance message.
Afbeelding 81: een acceptatie bericht.Figure 81: An acceptance message.
De implementatie controlerenReview the deployment
Met de gemigreerde resources in Azure moet Contoso de nieuwe infrastructuur nu volledig operationeel maken en beveiligen.With the migrated resources in Azure, Contoso now needs to fully operationalize and secure the new infrastructure.
BeveiligingSecurity
- Contoso moet ervoor zorgen dat de nieuwe databases veilig zijn.Contoso needs to ensure that the new databases are secure. Zie overzicht van de beveiligings mogelijkheden van Azure SQL database en SQL Managed instancevoor meer informatie.To learn more, see Overview of Azure SQL Database and SQL Managed Instance security capabilities.
- De toepassing moet worden bijgewerkt om SSL met certificaten te gebruiken.The application must be updated to use SSL with certificates. De containerinstantie moet opnieuw worden geïmplementeerd om te antwoorden op 443.The container instance should be redeployed to answer on 443.
- Contoso moet overwegen Azure Key Vault te gebruiken om geheimen te beveiligen voor hun Service Fabric toepassingen.Contoso should consider using Azure Key Vault to help protect secrets for their Service Fabric applications. Zie versleutelde geheimen beheren in service Fabric-toepassingenvoor meer informatie.To learn more, see Manage encrypted secrets in Service Fabric applications.
Back-ups en herstel na noodgevalBackups and disaster recovery
- Contoso moet de back-upvereisten voor Azure SQL databasecontroleren.Contoso needs to review backup requirements for Azure SQL Database.
- Contoso moet overwegen om SQL-failover-groepen te implementeren voor een regionale failover voor de data base.Contoso should consider implementing SQL failover groups to provide regional failover for the database.
- Contoso kan geo-replicatie gebruiken voor de Azure container Registry Premium-SKU.Contoso can use geo-replication for the Azure Container Registry Premium SKU.
- Azure Cosmos DB wordt automatisch een back-up gemaakt.Azure Cosmos DB is backed up automatically. Zie online back-ups en gegevens herstel op aanvraag in azure Cosmos DBvoor meer informatie.To learn more, see Online backup and on-demand data restore in Azure Cosmos DB.
Licenties en kostenoptimalisatieLicensing and cost optimization
- Nadat alle resources zijn geïmplementeerd, moet Contoso Azure-tags toewijzen op basis van de planning van de infrastructuur.After all resources are deployed, Contoso should assign Azure tags based on their infrastructure planning.
- Alle licenties zijn ingebouwd in de kosten van de PaaS-services die Contoso verbruikt.All licensing is built into the cost of the PaaS services that Contoso is consuming. Dit wordt in mindering gebracht op de Enterprise Agreement.This will be deducted from the Enterprise Agreement.
- Contoso schakelt Azure Cost Management en facturering in om de Azure-resources te controleren en te beheren.Contoso will enable Azure Cost Management + Billing to help monitor and manage the Azure resources.
ConclusieConclusion
In dit artikel bouwt Contoso de SmartHotel360-toepassing opnieuw in Azure.In this article, Contoso rebuilds the SmartHotel360 application in Azure. De on-premises front-endwebserver van de toepassing wordt opnieuw opgebouwd voor Azure App Service web-apps.The on-premises application front-end VM is rebuilt for Azure App Service web apps. De back-end van de toepassing wordt gemaakt met behulp van micro services die zijn geïmplementeerd in containers die worden beheerd door AKS.The application back end is built by using microservices that are deployed to containers managed by AKS. Uitgebreide functionaliteit van Contoso met een foto toepassing van huis dieren.Contoso enhanced functionality with a pet photo application.
Voorgestelde vaardighedenSuggested skills
Microsoft Learn is een nieuwe methode om te leren.Microsoft Learn is a new approach to learning. Voorbereiden op de nieuwe vaardigheden en verantwoordelijkheden die komen kijken bij cloudacceptatie valt niet mee.Readiness for the new skills and responsibilities that come with cloud adoption doesn't come easily. Microsoft Learn biedt een meer belonende benadering waarmee u uw doelen sneller kunt bereiken.Microsoft Learn provides a more rewarding approach to hands-on learning that helps you achieve your goals faster. Met Microsoft Learn kunt u punten winnen, niveaus door lopen en meer halen.With Microsoft Learn, you can earn points, rise through levels, and achieve more.
Hier volgen twee voor beelden van aangepaste leer trajecten op Microsoft Learn die worden uitgelijnd met de contoso SmartHotel360-toepassing in Azure.Here are two examples of tailored learning paths on Microsoft Learn that align with the Contoso SmartHotel360 application in Azure.
Een website implementeren in Azure met Azure app service: Door Web-apps te maken in azure, kunt u uw website eenvoudig publiceren en beheren zonder dat u met de onderliggende servers, opslag of netwerk assets hoeft te werken.Deploy a website to Azure with Azure App Service: By creating web apps in Azure, you can publish and manage your website easily without having to work with the underlying servers, storage, or network assets. In plaats daarvan kunt u zich richten op uw website functies en gebruikmaken van het robuuste Azure-platform om veilige toegang tot uw site te bieden.Instead, you can focus on your website features and rely on the robust Azure platform to help provide secure access to your site.
Afbeeldingen verwerken en classificeren met de Azure cognitieve Vision-Services: Azure Cognitive Services biedt vooraf ontwikkelde functionaliteit om computer vision-functionaliteit in uw toepassingen in te scha kelen.Process and classify images with the Azure Cognitive Vision Services: Azure Cognitive Services offers prebuilt functionality to enable computer vision functionality in your applications. Meer informatie over hoe u de Azure cognitieve Vision-Services kunt gebruiken om gezichten te detecteren, afbeeldingen te labelen en te classificeren en om objecten te identificeren.Learn how to use the Azure Cognitive Vision Services to detect faces, tag and classify images, and identify objects.