service artefacts modelmodel config *.cscfg config *.cscfgserviceserviceserviceservice*.cspkg*.cspkg...

36
Platform Application Lifecycle Name Title Microsoft Corporation

Upload: amie-byrd

Post on 23-Dec-2015

226 views

Category:

Documents


1 download

TRANSCRIPT

Platform Application Lifecycle

NameTitleMicrosoft Corporation

Deployment

Two Independent Environments

StagingProduction

Production Staging

Stages of Service Deployment

Development Fabric

Role Role

Development Storage

Stage 1: Local

development and testing

Development Fabric

Role Role

Windows Azure Storage Service

Stage 2: Test in mixed

mode with hosted data

Windows Azure Fabric

Role

Windows Azure Storage Service

Role

Stage 3: Test in Staging on Windows Azure

Fabric

Stage 4: VIP Swap to Production

Service Artefacts

Model

Upload to Windows

AzureWindows

Azure Fabric

Controller

Packaging & Deployment

Config*.cscfg

Web Role

Worker Role

LB

ServiceService

*.cspkg

Visual Studio Tools for Windows Azure now supports one-click deployment.

Aimed at rapid build/deploy/test/fix scenarios.

Deploying a Cloud Service from Visual Studio

Publish to either Production or StagingPackage only or Deploy to Windows AzureThree things needed

Windows Azure subscriptionWindows Azure hosted serviceWindows Azure storage account

Uses x509 certificate authentication

Geo-Location & Affinity Groups

AffinitizedGroups services with dependent resourcesEnsures geo-locationin single datacentreCan specify sub-region also (Recommended)

Un-AffinitizedWindows Azure chooses sub-region (Not Recommended)

Affinity and Geo-Location Settings are Immutable

Specific Geo-located

Explicitly define sub-region on service by service basis

Guest OS VersioningWindows Azure Runs on Base OS

Base OS revised regularlyBest practice is to specify OS versionGet latest version by default – using version ‘*’ gets auto-updatesUse osVersion attributeTo determine version in the cloud view config data in cloud

<ServiceConfiguration serviceName="CloudService1“ osVersion="WA-GUEST-OS-1.2_201003-01“>

Releases posted here: http://msdn.microsoft.com/ee924680

Release Changes

WA-GUEST-OS-1.0_200912-01 Patches

WA-GUEST-OS-1.1_201001-01 Patches

WA-GUEST-OS-1.2_201003-01 PatchesURL Rewriting and Compression.NET 4.0 RC

WA-GUEST-OS-1.3_201004-01 Patches, .NET 4, URL Rewrite 2

Windows Azure Service Management API

REST basedUses X509 client certificates for client authentication

o Hosted Serviceso View, Create, Delete

Deploymento Swap Deploymento Modify configurationo Scale Up/Scale Upo Upgrade deploymento Walk Upgrade Domain

o Storage Accountso List Accountso Get Account

Propertieso Get Account Keyso Regenerate Keys

o Certificateso Listo Addo Geto Delete

o Affinity Groupso Listo Get Properties

o System Infoo Get OS Version

Tools

Windows Azure Tools for Visual Studio v1.2CSPackCSRunCSManagePowershell Cmdlets

Windows Azure Tools for Visual Studio

Project TemplatesUser Interface ExtensionsStorage Explorer (v1.2)Server Explorer (v1.2)Integrated DeploymentIntelliTrace Debugging

Windows Azure Compute Explorer

View & Monitor deployments from Visual StudioNot possible to Start or Stop role instancesUses x509 Certificate AuthenticationRefreshes automatically by querying Windows Azure at regular intervals

Windows Azure Storage Explorer

An extension to the Visual Studio Server ExplorerView data from Windows Azure StorageDownload Asynchronously Blob data cached locally

CSPack.exe

Part of the Windows Azure SDKCommand line tool; called by VS.NET toolsPackages your service for deploymentExplicitly name & set location of Service Package

cspack HelloFabric\ServiceDefinition.csdef /role:HelloFabric_WebRole; HelloFabric_WebRole /out:HelloFabric.cspkg

cspack HelloCloudService.csdef/role:HelloCloudServiceWebRole; HelloCloudService/generateConfigurationFile:HelloCloudService.cscfg/out:HelloCloudServicePackage/copyOnly

Package for Cloud

Deployment

Package for Dev Fabric

Deployment

CSRun.exe

Command line tool; called by VS.NET toolsDeploys Service to Development Fabric Manages Running ServiceDump the logs of deployed instancesControl the state of the Development fabricControl Development Storage Service

csrun myservice.csx myservice.cscfg /launchbrowser

csrun /devfabric: shutdowncsrun /devfabric: clean

csrun /devstore: start

Run + Open Browser

Stop & Clear persistent state

e.g. LocalStorage

Start Dev Storage

X.509 Certificates

Management Service uses certificates for authenticationSelf-signedAny valid X.509 v3 with key length >= 2048 bits

makecert -r -pe -a sha1 -n CN=AzureMgmt -ss My -sky exchange "AzureMgmt.cer"

Creates a new self-signed certificate, writes it to the "AzureMgmt.cer" file in the current directory and saves it to the CurrentUser\My certificate store.

Preparing to use Management API

Make / Acquire CertificatePay attention to ValidFrom,Local date could differ from Server

Prepare the Windows Azure AccountUpload certificate to Windows Azure accountAssociate up to 5 certificates per account

Retrieve Thumbprint IdRetrieve Subscription IdManipulate Services

By explicit service name or;Enumerate services using management API

Managing Certificates

Subscription Id and Service Name

CSManage.exe

Wrapper for the Service Management APIManage credentials for Storage AccountsDelete running ServicesView configuration of DeploymentsPut subscription id and certificate thumbprint in csmanage.exe.config

http://tinyurl.com/azuresamplescsmanage /update-deployment /hosted-service :<service> /slot:staging /status:suspended

csmanage /delete-deployment /hosted-service :<service>

/slot:staging

csmanage /create-deployment /hosted-service:<service>

/slot:production /name:<name>/label:<label>/package:$(BlobStorageEndpoint)packages/

ServicePackage.cspkg/config:$(SolutionDir)\

ServiceConfiguration.cscfg

csmanage /update-deployment /hosted-service:<service>

/slot:staging /status:running

Suspend a named staging

deployment

Delete a named staging

deployment

Create a new deployment

into production using a

package in Blob storage

Run a named staging

deployment

PowerShell Cmdlets

Wrap the Service Management APIWith pipelining the output from one command can be used as input to the next

http://tinyurl.com/azurecmdlets

$cert = Get-Item cert:\CurrentUser\My\D6BE55AC439FEA8CBEBAFF432BDC0780F1BD00CF $sub = "CCCEA07B-1E9A-5133-8476-3818E2165063" $servicename = 'myazureservice' $package = "c:\publish\MyAzureService.cspkg" $config = "c:\publish\ServiceConfiguration.cscfg"

Add-PSSnapin AzureManagementToolsSnapIn

Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub | Get-Deployment -Slot Production | Set-DeploymentStatus 'Running' | Get-OperationStatus -WaitToComplete

Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub | Get-Deployment -Slot Production | Set-DeploymentConfiguration

{$_.RolesConfiguration["WebUx"].InstanceCount += 1}

Setup some variables incl.

certificate thumbprint

Add Azure Snapin

get serviceget production slot

set status to runningwait for async operation to finish

Scale out production by 1

instance.

Automating Your Deployment

Setting up the ServiceMSBuild CSPack.exeUpload Package to StorageCSManage.exe / PowerShell Cmdlet

DeployRun

TestCSManage.exe / PowerShell Cmdlet

SuspendDeleteMS Build Script Example: http://tinyurl.com/Azure-MSBuild

Minimizing Downtime

Fault & Upgrade Domains

Fault DomainsRepresent groups of resources anticipated to fail together

i.e. Same rack, same server

Fabric spreads instances across fault domainsDefault of 2

Upgrade DomainsRepresents groups of resources that will be upgraded togetherSpecified by upgradeDomainCount in ServiceDefinitionDefault of 5

Fabric splits Upgrade Domains across Fault Domains and Across Roles

Web Role

Example Service Model for Upgrade

Web Role

Four Instances

Web RoleWorker Role

Four Instances

Fault and Upgrade Domains

Rack

Web Role

VM

VM

Worker RoleVM

VM

Fault Domain

Rack

Web Role

VM

VM

Worker RoleVM

VM

Fault Domain

U/G Domain #1

U/G Domain #2

U/G Domain #1

U/G Domain #2

VIP Swap

Swap Virtual IPs between the two slotsProduction becomes StagingStaging becomes Production

Allows to quickly swap environments.Essential for when service model has changed

Exception: Changing public endpoints requires delete deployment

No downtime incurred.Developer Portal & Service Management API.Maintains the same external IP address

For the Best User ExperienceInvest in warming up the same number of instances in Staging before swapping in to

Production

VIP Swap Upgrade

Rack

Web Role

VM

VM

Worker Role

Rack

Web Role

VM

VM

Worker Role

Load Balancer:

Prod

Stage

VM VM

VM VM

VM

VM

VM

VM

VM

VM

VM

VM

Prod

Stage

In-Place Upgrade

Performs a rolling upgrade on live service.Leverages Upgrade DomainsService Model must be unchangedDeveloper Portal & Service Management APIAutomatic or ManualOperating System PatchesAlways assume you will have old and new

versions of your service running side by side. Write version aware code!

In-Place Upgrade

Load Balancer:

Prod

Rack

Web Role

VM

VM

Worker RoleVM

VM

Rack

Web Role

VM

VM

Worker RoleVM

VM

#1

#2

#1

#2

Debugging

Debugging a Service in Development

Debugging only supported in Development FabricVisual Studio attaches to all instances when debugger startsCan edit configuration whilst debuggingManaged Debugger by DefaultNative Code Debugging is supported

IntelliTrace

Intended for Debug Scenarios OnlyRequires .NET 4 & Visual Studio 2010 UltimateMust be enabled when publishing serviceChild processes cannot be IntelliTrace debuggedLogs are collected to a file in file system on VMLogs downloaded via Server Explorer in Visual StudioReplay events in Visual Studio

Intellitrace

NameTitleGroup

demo

Summary

DeploymentCode -> Package -> Upload -> DeployService Management ApiWindows Azure ToolsAutomating the entire lifecycle

Minimizing DowntimeFault and Upgrade DomainsIn Place Upgrade vs VIP Swap

DebuggingDevelopment FabricIntelliTrace

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.