windows azure web sites - things they don’t teach kids in school - buildstufflt
DESCRIPTION
Microsoft has a cloud platform which runs .NET, NodeJS and PHP. All 101 talks out there will show you the same: it’s easy to deploy, it scales out on demand and it runs WordPress. Great! But what about doing real things? In this session, we’ll explore the things they don’t teach kids in school. How about trying to find out the architecture of this platform? What about the different deployment options for Windows Azure Web Sites, the development flow and some awesome things you can do with the command line tools? Did you know you can modify the automated build process? Join me in this exploration of some lesser known techniques of the platform.TRANSCRIPT
![Page 1: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/1.jpg)
Windows Azure Web SitesThings they don’t teach kids in schoolMaarten Balliauw@maartenballiauw
![Page 2: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/2.jpg)
Who am I? Maarten Balliauw Technical Evangelist, JetBrains AZUG Focus on web ASP.NET MVC, Windows Azure, SignalR, ... MVP Windows Azure & ASPInsider Big passion: Windows Azure http://blog.maartenballiauw.be @maartenballiauw Shameless self promotion: Pro NuGet - http://amzn.to/pronuget2
![Page 3: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/3.jpg)
Saturday, March 29, 2014 http://global.windowsazurebootcamp.com
90+ locations last year, this year let’s go for a 100!
![Page 4: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/4.jpg)
96Locations
Possibly the largest community event ever
7432Attendees
194Sessions
154Speakers
74MVP’s
![Page 5: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/5.jpg)
Agenda Windows Azure Web Sites Architecture Project Kudu Kudu kung-fu Application log streaming Managing settings Staging and Production Multi-tier deployments Customizing deployments Running batch files / background processes (*)
Alt+Shift+Up
![Page 6: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/6.jpg)
Windows Azure Web Sites
![Page 7: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/7.jpg)
Start Simplestart free, scale up and out as you go, friction-free and without the headaches
Your waywith asp.net, php or node.js, develop on Windows, OSX or Linux
Go Livedeploy live in seconds,
easily monitor performance, rapidly diagnose and fix issues
Web Sites in Seconds
![Page 8: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/8.jpg)
dem
o
Windows AzureWeb Sites
![Page 9: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/9.jpg)
Architecture
![Page 10: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/10.jpg)
Load balancer Layers 1st layer: Windows Azure load balancer 2nd layer: IIS + ARR
ARR (disclaimer: not ) “Reverse proxy” Verifies hosting database (plans, quotas, …) Negotiates best node to run your site on Site not used much? Put it on a highly loaded machine
![Page 11: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/11.jpg)
Web servers %SYSTEM32%\inetsrv\config\applicationHost.config is taken out of the loop SQL Azure No refreshing of all app pools when file is saved
Storage “File share” hosted on other machines Using “WA drive” on blob storage
Dynamic website activation service Verifies runtime database (plans, quotas, …) Site not used for a while? Remove it from the server
![Page 12: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/12.jpg)
Web Sites are not in IIS. They only are when a request comes
in!
![Page 13: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/13.jpg)
Azure LB
Runtime DB
Storage Controller
IIS ARR(LB)
Web Worker
Other databases
1
2
3
4
5
5
5
5
1st request (cold site)
![Page 14: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/14.jpg)
Storage Controller
IIS ARR(LB)
Web Worker
Other database
s
1 2
3
3
3
3
xth request (hot site)
Azure LB
![Page 15: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/15.jpg)
Your app not being used for a while?
![Page 16: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/16.jpg)
Provisioning, publishing, metering Provisioning and publishing Storage and database != launching a website on web farm
Metering By web servers once a site is loaded Reported back to runtime database
![Page 17: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/17.jpg)
Runtime DB
Azure LB
Storage Controller
IIS ARR(LB)
Web Worker
X-DriveDeployment Server
Other databa
ses
SQL Azure
Blob storage
Windows Azure Worker Role
Provisioning / API Frontend
Metering
DWAS
Site (W3WP.exe)Site (W3WP.exe)Site (W3WP.exe)
Provisioning, publishing, metering
![Page 19: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/19.jpg)
Need more proof?Windows Azure Pack(http://www.microsoft.com/en-us/server-cloud/windows-azure-pack.aspx)Or:http://blog.maartenballiauw.be/post/2012/07/24/Hands-on-Windows-Azure-Services-for-Windows.aspx
![Page 20: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/20.jpg)
Project Kudu
![Page 21: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/21.jpg)
Project Kudu “The engine behind git deployments on Windows Azure” Open source (www.github.com/projectkudu/kudu) Provides git deployments Provides builds Provides sandboxing Provides hosting
![Page 22: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/22.jpg)
dem
o
Project Kudu
![Page 23: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/23.jpg)
Pointers from the Kudu repository Website extensions (analytics?) Job runner / “worker role” “KuduCalf” (A Kudu is an Antelope. Its baby is a calf. A Kudu Calf is deployed
from Kudu.)
![Page 24: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/24.jpg)
Kudu kung-fu
![Page 25: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/25.jpg)
dem
o
Application log streaming
![Page 26: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/26.jpg)
Log streaming All logs from the LogFiles/Application folder Or configure it when querying: azure log tail <site> -p http Settings DIAGNOSTICS_LASTRESORTFILE -> file to log to when diagnostics
go wrong DIAGNOSTICS_LOGGINGSETTINGSFILE -> settings file (json) DIAGNOSTICS_TEXTTRACELOGDIRECTORY -> default folder DIAGNOSTICS_TEXTTRACEMAXLOGFILESIZEBYTES-> log rotation
(bytes) DIAGNOSTICS_TEXTTRACEMAXLOGFOLDERSIZEBYTES -> max log
size (bytes)
![Page 27: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/27.jpg)
dem
o
Managing settingsand secrets!
![Page 28: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/28.jpg)
dem
o
Staging and production
![Page 29: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/29.jpg)
dem
o
Multi-tierDeploying a specific project file
![Page 30: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/30.jpg)
Multi-tier remarks… One .deployment file per branch [config]project=MultiTier.WebApi/MultiTier.WebApi.csproj
How do I deploy all tiers in a separate website? .deployment file per branch and every tier in a branch or customize the build How do I deploy all tiers in the same website? No .deployment file, just use virtual directories
![Page 31: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/31.jpg)
Customizing the build process Check https://github.com/projectkudu/kudu/wiki/Deployment-hooks .deployment file [config]command=<whatever command>
Write in batch file, bash script, PHP, JavaScript, …
![Page 32: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/32.jpg)
dem
o
Customizing deploymentsAn introduction
![Page 33: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/33.jpg)
What can I do in scripts? A lot :-) (but not too much… there’s a sandbox) Environment variables: DEPLOYMENT_SOURCE DEPLOYMENT_TARGET DEPLOYMENT_TEMP WEBROOT_PATH MSBUILD_PATH + everything you feed it through the management portal
![Page 34: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/34.jpg)
dem
o
Customizing deploymentsSample deployment script
![Page 35: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/35.jpg)
Great… but why? We’ve seen the multi-tier scenario We can download stuff (NuGet package restore, pull in external Git repos before build)
We can run stuff (msbuild, nuget.exe, curl, php, node, …)
![Page 36: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/36.jpg)
dem
o
Customizing deploymentsWhat about running unit tests?
![Page 37: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/37.jpg)
dem
oRunning background processes (workers)Note: only in Kudu at this time!
![Page 38: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/38.jpg)
Need. Moar!
![Page 39: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/39.jpg)
Moar out of the box REST API https://github.com/projectkudu/kudu/wiki/REST-API
Creating a custom handlerhttp://www.windowsazure.com/en-us/develop/python/tutorials/web-sites-with-django/
![Page 40: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/40.jpg)
Need. MOAR!!!
![Page 41: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/41.jpg)
A private Kudu build in web sites?
![Page 42: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/42.jpg)
Build and FTP the artifacts/debug/KuduService to your website Add USE_PRIVATE_KUDU=1 app setting Enjoy the ride! (but don’t call support, you’re on your own)
See http://blog.davidebbo.com/2012/06/developing-kudu-locally-and-on-azure.html
A private Kudu build in web sites?
![Page 43: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/43.jpg)
Conclusion
![Page 44: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/44.jpg)
Key takeaways Windows Azure Web Sites are high density Hosted on Cloud Services Kudu is our best friend Settings and secrets Muliple environments Multiple tiers Build customization Unit tests Worker roles Kudu-in-Kudu
![Page 45: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/45.jpg)
Thank you!
http://blog.maartenballiauw.be
@maartenballiauwhttp://amzn.to/pronuget
![Page 46: Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT](https://reader034.vdocuments.site/reader034/viewer/2022052409/540e535c8d7f728d7e8b4c98/html5/thumbnails/46.jpg)