51
Building a scalable web application by combining modern front-end stuff and Azure services Chris Klug @ZeroKoll http://chris.59north.com [email protected]

Building a scalable web application by combining modern front-end stuff and Azure services

Embed Size (px)

Citation preview

Page 1: Building a scalable web application by combining modern front-end stuff and Azure services

Building a scalable web application by combining modern front-end stuff and Azure services

Chris Klug@ZeroKoll

http://[email protected]

Page 2: Building a scalable web application by combining modern front-end stuff and Azure services

Who am I?

Page 3: Building a scalable web application by combining modern front-end stuff and Azure services

I

Page 4: Building a scalable web application by combining modern front-end stuff and Azure services

”We need some help to build a morescalable solution than what we got”

- client

Page 5: Building a scalable web application by combining modern front-end stuff and Azure services

x 500.000

Page 6: Building a scalable web application by combining modern front-end stuff and Azure services

The application

Page 7: Building a scalable web application by combining modern front-end stuff and Azure services

Teachers Students Admin Gov AuthN

& Data

Page 8: Building a scalable web application by combining modern front-end stuff and Azure services

Challenge 1:

Authentication

Page 9: Building a scalable web application by combining modern front-end stuff and Azure services

Teachers

Students

Admin

Gov AuthN

?

Gov 2

Gov 3

Gov 4

Page 10: Building a scalable web application by combining modern front-end stuff and Azure services

Teachers

Students

Admin

Gov AuthNSTS

WS-Fe

dera

tion

Cust

om

Pro

toco

l

Page 11: Building a scalable web application by combining modern front-end stuff and Azure services

Challenge 2:

Data storage

Page 12: Building a scalable web application by combining modern front-end stuff and Azure services

admin.xyz.com teacher.xyz.com student.xyz.com

SQL

Page 13: Building a scalable web application by combining modern front-end stuff and Azure services

Ehhh…no…

Page 14: Building a scalable web application by combining modern front-end stuff and Azure services

admin teacher student

Master Shard 1 Shard 2 Shard n

Page 15: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 1:

Cross-shard queries

Page 16: Building a scalable web application by combining modern front-end stuff and Azure services

teacher

ShardsAzure Search

Page 17: Building a scalable web application by combining modern front-end stuff and Azure services

SQL vs Storage

Page 18: Building a scalable web application by combining modern front-end stuff and Azure services

admin teacher student

Master Shard Blob Storage

Search

Page 19: Building a scalable web application by combining modern front-end stuff and Azure services

admin teacher student

Master Shard Shard Master

Search

Page 20: Building a scalable web application by combining modern front-end stuff and Azure services

= +

Service Bus Worker Roles

Page 21: Building a scalable web application by combining modern front-end stuff and Azure services

teacher

1. M

ake C

han

ge

5. Transform Data

to JSON

Page 22: Building a scalable web application by combining modern front-end stuff and Azure services

Challenge 3:

The curveball

Page 23: Building a scalable web application by combining modern front-end stuff and Azure services

”You know how we said we wanted to host the solution in Azure…well…”

- client

Page 24: Building a scalable web application by combining modern front-end stuff and Azure services
Page 25: Building a scalable web application by combining modern front-end stuff and Azure services

”Our own private cloud is being built aswe speak, and it uses Azure Pack, so we’re all good!”

- client

Page 26: Building a scalable web application by combining modern front-end stuff and Azure services

Look ma, two ducks!!!

Page 27: Building a scalable web application by combining modern front-end stuff and Azure services

admin teacher student

Master Shard Shard Master

Clien

t’s

Data

cen

ter

Azu

re

+

Page 28: Building a scalable web application by combining modern front-end stuff and Azure services

Azure Pack

Worker Roles ≠ Microsoft Azure

Worker Roles

Page 29: Building a scalable web application by combining modern front-end stuff and Azure services

admin teacher student

Master Shard Shard Master

Clien

t’s

Data

cen

ter

Azu

re

+

Page 30: Building a scalable web application by combining modern front-end stuff and Azure services

Challenge 4:

Application structure

Page 31: Building a scalable web application by combining modern front-end stuff and Azure services

SQL

NHibernate

Domain

MVC Web Api

HTML, CSS, JS (AngularJS)

Page 32: Building a scalable web application by combining modern front-end stuff and Azure services

Blob StorageMVC Web Api

HTML, CSS, JS (AngularJS)

Unicorns

Page 33: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 1:

Bootstrapping the SPA

Page 34: Building a scalable web application by combining modern front-end stuff and Azure services

// In header of SPA HTML page

var app = {};

app.configuration = {

myServiceProviderConfig: {

value:’key’

}

};

// In module registration JavaScript file

angular.module(’myModule’,[’myOtherModule’])

.provider(’myService’, function() {

// implementation

})

.config([’myServiceProvider ’,function(myServiceProvider) {

myServiceProvider.configure(app.configuration.myServiceProviderConfig);

}]);

Page 35: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 2:

Handling SAS for storage

Page 36: Building a scalable web application by combining modern front-end stuff and Azure services

angular.module(’appModule’,[])

.service(’http’, [’$http’, function($http) {

// ”override” implementation to add and refresh SAS to requests

return {

get: function(path) {

var sas = getSas(); // cached or refreshed from server

var url = _baseUrl + path + ’?’ + sas;

return $http.get(url);

}

// more functions

};

}]);

Page 37: Building a scalable web application by combining modern front-end stuff and Azure services

angular.module(’clientModule’,[])

.service(’courseRepo’, [’http’, function(http)

{

return {

getCourseById: function(id) {

return http.get(’/course/’ + id);

}

// more functions

};

}]);

Page 38: Building a scalable web application by combining modern front-end stuff and Azure services

Challenge 5:

Front-end build pipeline

Page 39: Building a scalable web application by combining modern front-end stuff and Azure services

LESS CSS Bundle Minify

JS Test Bundle Minify

Page 40: Building a scalable web application by combining modern front-end stuff and Azure services

”That can be done using a custombuild task in our TFS build pipeline!”

- me

Page 41: Building a scalable web application by combining modern front-end stuff and Azure services
Page 42: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 1:

Development vs Production

Page 43: Building a scalable web application by combining modern front-end stuff and Azure services

Development

• Individual

JavaScript

files

• LESS +

less.js

UAT (Test)

• Bundled &

minified

JavaScripts

• Bundled &

minified

CSS

Production

• Bundled &

minified

JavaScripts

from CDN

• Bundled &

minified

CSS from

CDN

Page 44: Building a scalable web application by combining modern front-end stuff and Azure services

public static void RegisterBundles(BundleCollection bundles)

{

var scripts = new ScriptBundle("~/scripts", ResolveCdnPath("/scripts.min.js"));

scripts.IncludeDirectory("/scripts", "*.js");

bundles.Add(scripts);

var styles = new Bundle(”~/styles” , ResolveCdnPath("/styles.min.css"));

styles.IncludeDirectory("/styles"), "*.less");

bundles.Add(styles);

}

protected string ResolveCdnPath(string path)

{

if (!settings.UseCdn) return path;

return string.Format(”{0}{1}?v={2}", settings.CdnBaseUrl, path, settings.CdnFileVersion);

}

Page 45: Building a scalable web application by combining modern front-end stuff and Azure services

Bonus Challenge:

“The Overlay”

Page 46: Building a scalable web application by combining modern front-end stuff and Azure services

Youtube.comMySite.se

Homework.nu

Page 47: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 1:

Http vs Https

Page 48: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 2:

Cookies over Http

Page 49: Building a scalable web application by combining modern front-end stuff and Azure services

Sub challenge 3:

Hosting

Page 50: Building a scalable web application by combining modern front-end stuff and Azure services

Did we overdo it?

”It's not how far you go, it's how go you far”

Page 51: Building a scalable web application by combining modern front-end stuff and Azure services

Thank you for listening!

Chris Klug@ZeroKoll

http://[email protected]