430 likes | 450 Views
Learn how to deploy and debug complex systems efficiently in this insightful video by MIT Prof. John R. Williams. Explore web servers, data stores, Firebase, AWS, and more. Enhance your architecture design skills and simplify complexities.
E N D
Web Servers, Data StoresFireBase Chat https://youtu.be/pXFMQAl6XBM
AWS-On-Ramp MIT Prof John R Williams
Complexity of Modern Systems How can we deploy at scale
Dealing with Complexity Modules/Components Abstraction
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.Brian Kernighan and P.J. Plauger, The Elements of Programming Style
Architecture Capabilities • Loosely coupled architectures • Empowered teams
Steve Jobs on Complexity<->Simplicity: http://design.activeside.net/why-designers-should-seek-complexity http://design.activeside.net/cyclic-and-linear-thinking
In Class Exercises Web Server Browser • Express Web Server • Chat App • Quote App FireBaseDataStore Web Server Browser FireBaseDataStore
Download files to your working directory from https://github.com/johntango/demoexpress
NPM Node Package Manager • Allows you to manage thousands of libraries efficiently • 9 billion downloads last week !!! • Learn fast from the best
package.json • npm init - creates file package.json • package.json – specifies how to build your app
npm init - creates file package.json select defaults Except Author License
npm install express This installs the “express” web server library and modifies package.json to include this step.
Now we are going to add ”routes” to our web serverhttp://localhost:3000/lucky ≈
For debugging its sometimes useful to use curl to hit a Web Server eg from terminal we can typecurl http://localhost:3000/input/hello/methis will create parameters
send and catch parameters Test using CURL
Using curl to POST data curl -d '{"quote":”hello-earthline", "author":”john"}' -H "Content-Type: application/json" -X POST http://localhost:3000/input In App add the following “route” app.post('/input', function(req,res){ console.log(JSON.stringify(req.body)); res.send ({ quote : req.body.quote, author : req.body.author }); });
Chat Application FireBaseDataStore
You are going to use my FireBase Data Store so copy the code opposite <script> // Initialize Firebase var config = { apiKey: "AIzaSyAVQLaGLhKu3DNssy3g7IuihPKQkuwASxY", authDomain: "chatapp-c509e.firebaseapp.com", databaseURL: "https://chatapp-c509e.firebaseio.com", projectId: "chatapp-c509e", storageBucket: "", messagingSenderId: "363342895005" }; firebase.initializeApp(config); </script>
Exercise in class - Chat App - clone from https://github.com/johntango/chatFirebase
AWS Cloud GitHub EC2 Server SSH into EC2
AWS Cloud Virtual Private Network Docker image jrwtango/expresscolor Load Balancer ECS Elastic Cloud HTTP request
AWS Cloud Virtual Private Network Docker image jrwtango/expresscolor Load Balancer ECS Elastic Cloud HTTP request
AWS Cloud Virtual Private Network SQS AWS Lambda AWS Logging
AWS Cloud Virtual Private Network Docker image jrwtango/expresscolor Load Balancer ECS Elastic Cloud HTTP request
AWS Cloud Virtual Private Network Docker image jrwtango/dynamo5 API Gateway Load Balancer ECS Elastic Cloud HTTP request