Brewing Beer with Windows Azure - ASPConf

Post on 19-May-2015

1.644 views 2 download

Tags:

description

Inspired by one of the Windows Azure gods (Wade Wegner), Maarten decided to order a homebrewing starter kit. Being a total cloud fanboy, he decided to hook those delicious creations to the cloud. Join Maarten and discover how you can connect a variety of devices (like *duino) and USB temperature sensors to Windows Azure to monitor brewing and fermentation temperatures. He'll show you how to do distributed brewing in this fun yet practical session on an interesting use case for the cloud: beer.

Transcript of Brewing Beer with Windows Azure - ASPConf

Brewing Beerwith Windows Azure

Maarten Balliauw@maartenballiauw

http://jabbr.net/#/rooms/aspconf-room4

Who am I?

• Maarten Balliauw• www.realdolmen.com • Focus on web– ASP.NET MVC, Windows Azure, SignalR, ...– MVP Windows Azure & ASPInsider

• http://blog.maartenballiauw.be • @maartenballiauw

Antwerp, Belgium

Who am I?

• Maarten Balliauw• www.realdolmen.com • Focus on web– ASP.NET MVC, Windows Azure, SignalR, ...– MVP Windows Azure & ASPInsider

• http://blog.maartenballiauw.be • @maartenballiauw

Shameless commercial plug

• Pro NuGet:http://amzn.to/pronuget

• MyGet - NuGet-as-a-Service: http://www.myget.org

Agenda

• Brewing beer• BrewBuddy• Windows Azure Websites• Service Bus & Access Control Service

(ACS)• We need an API• Q&A

http://jabbr.net/#/rooms/aspconf-room4

Brewing BeerTurn water into beer

How it started…

How it started…

• MVP Summit 2011–Wade Wegner talks about his

homebrewing hobby

• MVP Summit 2012–Wade Wegner talks about his

homebrewing hobby

• Convinced!

The process

• Get your kegs clean• Add & boil ingredients• Pour in keg• Add yeast• Rinse

The process

Wait for fermentation to complete

The process

• Pour into another keg• Rinse• Wait another week• Bottling time!

Difficult part…

Wait at least 6 weeks for it to age

Maarten…

What does this haveto do with Windows Azure?

www.BrewBuddy.netAzurifying the home brewer

BrewBuddy

• View public recipes• Manage your own recipes• Manage your own brews• Monitor brew fermentation

demoSocial brewing at a glance

BrewBuddy

ArchitecturePublic websiteWindows Azure Web Sites

DatabaseSQL Azure database

Sensor data processingWindows Azure Worker Role

Sensor dataService Bus topic

SensorWhatever…

Windows Azure Web Sites

Scale-fast has just become more interesting

Windows Azure Web Sites

Build with ASP.NET, Node.js or PHP Deploy in seconds with FTP, Git or

TFS Start for free, scale up as your

traffic grows

1SHARED INSTANCES

:-)

shared

Windows Azure Web Sites

2SHARED INSTANCES

:-)

:-)

shared

Windows Azure Web Sites

SHARED INSTANCES

:-)

1RESERVED INSTANCE

:-):-)

0reserved

Windows Azure Web Sites

2RESERVED INSTANCE

:-)

RESERVED INSTANCE

:-)

reserved

Windows Azure Web Sites

2RESERVED INSTANCE

:-)

RESERVED INSTANCE

:-):-)

:-) :-)

:-)

:-) :-)

reserved

Windows Azure Web Sites

A perfect ramp-up!

• Start small–Web Sites are cheap–Scale to 3 reserved instances

• Grow big!–Hosted Service – PaaS–Scale at will

demoCreating a new web site in seconds

Windows Azure Web Sites

Service Bus& Access Control Service

Connecting sensors

Windows Azure Service Bus

• 2 features–Relay–Queues, Topics, Subscriptions

Windows Azure Service Bus Relay

Client Service

relay

Topics and subscriptions

SensorBackendWorker

Characteristics

• Workers can scale independently• Workers can fail independently• Sensors connect to service bus

directly–No layer in between–Cheaper

What about authN / authZ?

• Access Control Service to the rescue!

• SB authenticates clients over ACS

• ACS provides “Send” claim to sensor

• Claims can be granted/revoked easily

demoClaims for authZ on Service Bus

Access Control Service

ArchitecturePublic websiteWindows Azure Web Sites

DatabaseSQL Azure database

Sensor data processingWindows Azure Worker Role

Sensor managementAccess Control Service

Sensor dataService Bus topic

SensorWhatever…

How do you link a sensor?

• Every sensor has its sensor ID• Add it as an identity to ACS• Grant a “Send” claim

demoRegistering a sensor with Access Control Service

Linking a sensor to a brew

We need an API<french>Make everyone API!</french>

What is an API?

• Software-to-Software interface• Contract between software and

developers– Functionalities, constraints (technical / legal)

Programming instructions and standards

• Open services to other software developers (public or private)

Do we need one?

• Reach to scale• Smartphone generation• BYOD with 3 screens: phone, tablet and

computer• Flexibility in providing content• You have data to share• Integration

Build Richer AppsReach More Clients

ASP.NET Web API• Part of ASP.NET MVC 4• Framework to build HTTP Services (REST)• Solid features

– Modern HTTP programming model– Content negotiation (e.g. Xml, json, ...)– Query composition (OData query support)– Model binding and validation (conversion to .NET objects)– Routes– Filters (e.g. Validation, exception handling, ...)– And more!

demoLet’s craft a quick API

ASP.NET Web API

What about authN / authZ?

• API access through OAuth2• Access Control Service to the rescue!• Client authorized in BrewBuddy.net• Access/refresh tokens through ACS

What about authN / authZ?

Access Control ServiceAccess/Refresh Token

API Consumerclient_id and client_secret

BrewBuddy.netInitial authorization (yes/no)API implementation

authorize

register delegationaccess/refresh token

access API

demoOAuth2 delegation

Access Control Service for API’s

Install-Package WindowsAzure.Acs.Oauth2 -IncludePrerelease

Takeaways

Keep in mind…

• Web Sites start cheap / scale fast• Combine/grow at will (IaaS, PaaS,

SaaS)• Service bus for asynchrony and scale• Access Control for devices• Web API & Access Control

Related sessionsToday• 3:30-5pm UTC

– Test-First and Functional-First with Web API (room 3)

• 8-9:30pm UTC– Ask the Experts (SignalR, MVC, Web API) (live video)

• 9:30-11pm UTC– Azure SDK (room 1)– Introduction to the ASP.NET Web API (room 2)

Tomorrow• 3:30-5pm UTC

– From Zero to Hero: Windows Azure Web Sites and TFS Preview (room 3)– Advanced ASP.NET Web API (room 5)

• 9:30-11pm UTC– The Lightweight Approach to Building Web Based APIs with .Net

Q&A

Thanks!Brewing Beer with Windows Azure

@maartenballiauw

http://bit.ly/Mrx0tH