2012-03-20 - Getting started with Node.js and MongoDB on MS Azure

  • 3,795 views
Uploaded on

This talk concentrates on Microsoft's cloud platform, called Azure. Johannes gives an introduction to the new platform and speaks about its possibilities and limitations. By utilizing the Windows …

This talk concentrates on Microsoft's cloud platform, called Azure. Johannes gives an introduction to the new platform and speaks about its possibilities and limitations. By utilizing the Windows Azure SDK for Node.js he is going to demonstrate a simple JavaScript-driven browser game that bases on Node.js and MongoDB.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,795
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
36
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Getting started with Node.js and MongoDB on MS Azure ®20.03.2012Dipl.-Inf. (FH) Johannes Hoppe
  • 2. 01Hello
  • 3. Johannes HoppeIT-Consultant & Web Developer www.johanneshoppe.de
  • 4. JavaScript?
  • 5. As a server sidelanguage?
  • 6. Executed insidea database?
  • 7. For a hardware-accelerated3D game?
  • 8. Hosted onWINDOWS?
  • 9. Yes!.of course
  • 10. Live Demosolartournament.org
  • 11. solartournament.org
  • 12. 02SDK for Node.js
  • 13. platform Cloud PaaS / IaaS Visual Studio 2010Targets .NET, but also and now officially:Java, PHP, Node.js… MongoDB
  • 14. Event-driven Asynchronous I/OJavaScript Google V8 engineServer-side MIT License
  • 15. www.windowsazure.com/en-us/develop/nodejs/
  • 16. What you get› node.exe› iisnode (native IIS module)› NPM for Windows (package manager)› […]
  • 17. Live Demo / Windows PowerShell› New-AzureService helloworld› Add-AzureNodeWebRole› Start-AzureEmulator -launch
  • 18. server.jsvar http = require(http);http.createServer(function (req, res) { res.writeHead(200, {Content-Type: text/plain}); res.end(Hello world!);}).listen(process.env.PORT);
  • 19. Azure SDK for Node.jsTroubleshooter
  • 20. Tricky Emulator› Webinstaller: Decide for IIS Express› Start PowerShell with Admin Rights
  • 21. Tricky Emulator› Check the Windows Event log› Last resort: start node.exe manually
  • 22. Deployment / Windows PowerShell› Get-AzurePublishSettings› Import-AzurePublishSettings filename.publishSettings› Publish-AzureService -name UniqueName -location "North Europe" -launch
  • 23. Node.js Web ApplicationTutorial:http://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/
  • 24. Roles & Storage Windows Azure Compute Web Role Worker Role VM Role Windows Azure SQL Azure Storage Table / Queue / Blob
  • 25. Azure Storage Explorerhttp://azurestorageexplorer.codeplex.com/Supports blobs, queues and tables
  • 26. 03MongoDB
  • 27. “Microsoft has been working with 10gento provide MongoDB databaseintegration for Windows Azure,including deployment packaging,documentation, and code samples.”MSDN, December 2011: http://msdn.microsoft.com/en-us/library/gg441573.aspx
  • 28. http://downloads.mongodb.org/azure/AzureMongoDeploymentCmdlets.msi
  • 29. PowerShell› Only once: Get-AzureMongoDBBinaries› Add-AzureMongoWorkerRole› Join-AzureNodeRoleToMongoRole WebRole1› npm install mongodb
  • 30. node-mongodb-native// the normal wayvar mongoServer = new MongoServer("localhost", 27017, {});mongoDb = new MongoDb(MONGO_DATABASE, mongoServer, { native_parser: false });mongoDb.open(function () { });
  • 31. On Azurevar azureMongoEndpoints = new AzureMongoEndpoint(ReplicaSetRole, MongodPort);azureMongoEndpoints.on(topologyChange, function () { if (mongoDb != null) { mongoDb.close(); mongoDb = null; } var mongoAzureServer = azureMongoEndpoints.getMongoDBServerConfig(); mongoDb = new MongoDb(MONGO_DATABASE, mongoAzureServer, { native_parser: false }); mongoDb.open(function () { });});azureMongoEndpoints.on(error, function (error) { throw error; }); }
  • 32. Node.js Web Applicationwith Storage on MongoDBTutorial:https://www.windowsazure.com/en-us/develop/nodejs/tutorials/web-app-with-mongodb/
  • 33. 04Conclusion
  • 34. Node.js on Azure?› Stable, works like expected› Often fiddling on the startup scripts› Installation binaries: slow upload (a general Azure problem)› Thumbs up to iisnode
  • 35. MongoDB on Azure?› Development version (2.1.1-pre-) of MongoDB› Not recommended for production.› No Sharding!› Works stable for me
  • 36. Questions?
  • 37. Thank you! blog.johanneshoppe.de
  • 38. Next Speaking Engagements› 12.04.2012 – .NET UG Niederrhein: AOP / .NET› 10.05.2012 – .NET UG Karlsruhe: NoSQL / .NET› 14.05.2012 – .NET Developer Conference (DDC) .Nürnberg: NoSQL / .NET (2 talks)
  • 39. Picture creditswave © THesIMPLIFY – Fotolia.comStressed businessman © Selecstock – Fotolia.comAusgewählter Ordner © Spectral-Design – Fotolia.comWarnhinweis-Schild © Sascha Tiebel – Fotolia.comListe abhaken © Dirk Schumann – Fotolia.com