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.
5. Start Simple
start free, scale up and out
as you go, friction-free
and without the headaches
Your way
with asp.net, php or
node.js, develop on
Windows, OSX or
Linux
Go Live
deploy live in seconds,
easily monitor
performance, rapidly
diagnose and
fix issues
online IDE
Web Sites in Seconds
8. Azure Web Sites use Azure
Cloud Services + load balancer
Load-balanced Layer 7 reverse proxy
Actual infrastructure
Blob storage
Your web site is on here (GRS)
SQL Azure
Your web site config + metering is on here
9. Web Sites are not always in IIS.
They only are when requests come!
13. Need some
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
15. 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
21. 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)
25. 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
or add an environment variable
How do I deploy all tiers in the same website?
No .deployment file, just use virtual directories
26. 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, …
27. 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
KUDU_SYNC_CMD
+ everything you feed it through the management portal
29. Great… but why?
Deploy an advanced 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, …)
33. Web Jobs
There is lots more!
http://www.asp.net/aspnet/overvi
ew/developing-apps-with-
windows-azure/azure-webjobs-
recommended-resources
Web Jobs SDK - react to what
happens in blob, table, queue
Run jobs continuously
Run jobs scheduled
Run jobs at interval
Run jobs on demand (manual / API)
class Program {
static void Main(string[] args) {
JobHost host = new JobHost();
host.RunAndBlock();
}
public static void SquishNewlyUploadedPNGs(
[BlobInput("input/{name}")] Stream input,
[BlobOutput("output/{name}")] Stream output) {
var quantizer = new WuQuantizer();
using (var bitmap = new Bitmap(input)) {
using (var quantized = quantizer.QuantizeImage(bitmap)) {
quantized.Save(output, ImageFormat.Png);
}
}
}
}
36. Key takeaways
Azure Web Sites are hosted on Azure, high density
Based on Project Kudu
Kudu kung-fu
Application log streaming
Managing settings
Staging and Production
Multi-tier deployments
Customizing deployments
Running “jobs” (batch files / background processes)
Visual Studio Online
Quick overview demo:Create a siteDeploy something (git? index.php? explain options!)Run over configRun over scaling
Show GitHub websiteGo through commits and see if there is something interesting (e.g. KuduCalf)Go through GitHub organization and see if there is anything interestingMention you can run this one on your machine & customize it and even replace the engine on Azure with that customized engine
KuduExec?Now what can we do with Kudu… Go to the .scm website every web site has and show some of the features (env/console/process explorer/extensions/…)
Show logging applicationExplain nothing special configuredEnable through portalShow stream: azure site log tailstackedlogging(other options are download)Configure verbosity
Create an application and use ConfigurationManager.AppSettings["MyKey"] tospecify a ‘dev’ variable or somethingShow environment variable printingUpdate setting in portalFTP into the system and note that the web.config is UNTOUCHED!We can use this for storing secrets
Menion the way to do it with STANDARD modeShow Hg repository in which I have created two branches: the default one and a “staging” oneConfigure one production websiteConfigure one staging websiteExplain hostnames, scaling, configuration and so on
Explain solution structure: two web projectsCreate .deployment fileAdd:[config]project = MultiTier.WebApi/MultiTier.WebApi.csproj
Too long for slides!Run azure site deploymentscript --basicOr azure site deploymentscript –aspWAPRun through script
Explain unit test projectDeploy with successDeploy with failure