SlideShare a Scribd company logo
Designing the Call of Cthulhu app with Google App Engine Presented by Chris Bunch at UCSB CS 189A / 172 : Capstone Project / Software Engineering February 10, 2010 http://cs.ucsb.edu/~cgb
Motivation I am what you would call a “nerd” Plays nerdy board games Would like to upload stats from games and analyze them Could do other cool things as well
Specifically
Arkham Horror Lots of variables that can be analyzed Co-op game: all v. the board Mix and match expansions Many different winning / losing conditions But fundamentally boils down to: Save the world from total destruction
App Requirements Must be able to upload game data Should be able to predict a win or loss given some preliminary info Can experiment with prediction algorithms Should be able to summarize game data
App Requirements Allows users to log in to upload their data Allows users to share data with each other Handles users in a sane fashion Harder than it sounds Display a top score list for users to view Game provides scoring metric
Enter the Cloud Why go the cloud route? Simple answer: You likely don’t have your own hardware to host this app on, so just use somebody else’s But cloud computing is confusing and not well defined yet, so...
Defining Cloud Computing Three layers, each building on the last Infrastructure: Programmer gets a virtual machine and / or reliable storage Most control of environment Must scale manually Amazon EC2, Eucalyptus
Defining Cloud Computing Three layers, each building on the last Platform: Programmer gets a scalable API Less control of environment Scaling done automatically Google App Engine, Microsoft Azure
Defining Cloud Computing Three layers, each building on the last Software: Programmer gets to “skin” an existing app No control of environment Scaling done automatically SalesForce, GMail
My Choice Clearly I want the platform! Platform: Scalable API = great! Less control of environment = ok Programability depends on APIs offered  Have personal exp. w/ Google App Engine
What is Google App Engine? Scalable web framework first offered in 2008 Users program apps in: Python Java Unofficially: JRuby, Groovy, JavaScript
Sandboxed Environment Requests limited to 30 seconds Only white-listed libraries can be used Anything non-trivial is quota-ed No reading / writing to the filesystem Web communication over HTTP(S) only
Datastore API A giant hash table Primitives: Get, put, delete - same as regular HT Query, count - new operations Transactions supported (row-level only)
Datastore API GQL queries offered - subset of SQL Select statement, no JOINs Tip: Queries are the most expensive operation, use sparingly If possible, perform it asynchronously
Memcache API Equivalent to memcached Provides access to low latency LRU cache Roughly 100x faster than Datastore But unreliable - remember it’s a cache! Exposes get, set, delete operations Exposes atomic increment / decrement
URL Fetch API Equivalent to curl Used to grab web content from other sites Only allows for HTTP(S) data to be read Can also be done asynchronously Typically grabs images or mashup data
Mail API Equivalent to sendmail Can send or receive mail asynchronously Can also add attachments Not all types allowed - no .doc, .xls, or .ppt in Python SDK
XMPP API Equivalent to jabber Send and receive instant messages to appname.appspotchat.com App can’t join group chat yet Use as a notifier or alternate UI to app
Images API Equivalent to python-imaging Exposes image rotation, flipping, cropping, and histogram Image is stored internally as a blob, then retrieved and manipulated
Users API Equivalent to Google Accounts Provides for simple authentication Allows app to force login or admin on certain pages Also exposes URL to optionally login to
Blobstore API Allows for large file uploads (<50 MB) Users can upload videos, datasets, or large music files for later retrieval Upload must be done via form post
Cron API Equivalent to cron User specifies how often a web page should be accessed (e.g., daily, every Monday) Task is then run in the background Useful for running expensive data analysis
Task Queue API Spawns a new thread in the background But still must visit your app Configuration file specifies queues Useful for short to medium length tasks
To summarize: Many, many APIs available for what we need to do! Use Datastore to store / retrieve user data Use Users to authenticate users Gets around a lot of boilerplate authentication code
To summarize: Use Mail to e-mail users if their score is beat Use XMPP to allow users to add new data Use Cron to run compute-intensive code in the background
To summarize: Think about paid functionality: Maybe use Blobstore to allow users to upload videos explaining gameplay Handle greater traffic if site becomes popular
Let’s Get to Business Data Modeling Upload Stats Page Game Stats Page Game Prediction Page
Data Modeling class Game(db.Model): player = db.UserProperty() goo = db.StringProperty() comments = dbStringProperty(multiline=True) date = db.DateTimeProperty(auto_now_add=True)
Data Modeling num_of_players = db.IntegerProperty() won_game = db.BooleanProperty() doom_counters = db.IntegerProperty() terror_level = db.IntegerProperty() expansions_used = dbListProperty(str)
Uploading Stats class AddGames(webapp.RequestHandler): def get(self): user = users.get_current_user() if user: # means they’re logged in # write html form for getting data else: self.redirect(users.create_login_url(self.request.uri))
Uploading Stats def post(self): new_goo = self.request.get(‘goo’) # validate goo, make sure data type is right game = Game() game.goo = new_goo game.put()
Game Stats games = db.GqlQuery (“SELECT * FROM Game ORDER BY date desc”) for game in games: # find the goo w/ highest player win percentage # can also just display the info here
Game Prediction def get(self): # user specifies the game they will play def post(self): # calculate how likely they are to win # right now we only care about the goo
Routing application = webapp.WSGIApplication([ (‘/upload’, AddGames), (‘/stats’, GameStats), (‘/predict’, PredictGame)])
Thankfully Most requirements have very little state shared between URLs (all saved in DB) Thus each class is one of two forms: get / post: Grab data from user and do something with it get: Just display or synthesize some data
Rendering Web Pages Two main options available: self.response.out.write(“Hello World!”) self.response.out.write(template.render(‘index.html’, {‘my_title: ‘baz’, ‘data’: some_variable})) Use the second for any non-trivial app
Rendering Web Pages Now in your index.html: <title> {{ my_title }} </title> <div> {{ data }} </div>
Tips for Your Programs Separate out your code into files as needed app.yaml specifies this: handlers: - url: /one script: one.py - url: /two/(.*)/(.*) script: /two//.py
Tips for Your Programs Make pages with sensitive data ‘secure’ All access done over HTTPS Optional - HTTP and HTTPS work Never - HTTPS redirects to HTTP Always - HTTP redirects to HTTPS
Tips for Your Programs Specify static files in app.yaml - url: /images static_dir: static/images Can also tag ‘secure’ if desired
Tips for Your Programs Be creative! The webapp framework supports: get, post, head, options, put, delete, trace Map user pages to ~name?
Summary Google App Engine is more than flexible enough to handle your web app desires And it’s only getting better! More than enough possibilities to create a web app: you just need a good idea!
 

More Related Content

What's hot

Tech Talk on Autoscaling in Apache Stratos
Tech Talk on Autoscaling in Apache StratosTech Talk on Autoscaling in Apache Stratos
Tech Talk on Autoscaling in Apache Stratos
Vishanth Bala
 
AWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine images
AWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine imagesAWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine images
AWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine images
Amazon Web Services
 
StreamSQL Feature Store (Apache Pulsar Summit)
StreamSQL Feature Store (Apache Pulsar Summit)StreamSQL Feature Store (Apache Pulsar Summit)
StreamSQL Feature Store (Apache Pulsar Summit)
Simba Khadder
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon Web Services
 
Chatbots with Serverless
Chatbots with ServerlessChatbots with Serverless
Chatbots with Serverless
Srushith Repakula
 
Serverless Summit - Quiz
Serverless Summit - QuizServerless Summit - Quiz
Serverless Summit - Quiz
CodeOps Technologies LLP
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
Amazon Web Services
 
DevOpsCon Cloud Workshop
DevOpsCon Cloud Workshop DevOpsCon Cloud Workshop
DevOpsCon Cloud Workshop
Sascha Möllering
 
AWS Lambda from the Trenches
AWS Lambda from the TrenchesAWS Lambda from the Trenches
AWS Lambda from the Trenches
Yan Cui
 
Sas 2015 event_driven
Sas 2015 event_drivenSas 2015 event_driven
Sas 2015 event_driven
Sascha Möllering
 
Heterogeneous Workflows With Spark At Netflix
Heterogeneous Workflows With Spark At NetflixHeterogeneous Workflows With Spark At Netflix
Heterogeneous Workflows With Spark At Netflix
Jen Aman
 
Serverless Architectures on AWS Lambda
Serverless Architectures on AWS LambdaServerless Architectures on AWS Lambda
Serverless Architectures on AWS Lambda
Serhat Can
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
Amazon Web Services
 
Docker in the Cloud
Docker in the CloudDocker in the Cloud
Docker in the Cloud
Sascha Möllering
 
eCAP Developer Walkthru
eCAP Developer WalkthrueCAP Developer Walkthru
eCAP Developer Walkthru
Robert Patt-Corner
 
Journey towards serverless infrastructure
Journey towards serverless infrastructureJourney towards serverless infrastructure
Journey towards serverless infrastructure
Ville Seppänen
 
Building a PaaS with Docker and AWS
Building a PaaS with Docker and AWSBuilding a PaaS with Docker and AWS
Building a PaaS with Docker and AWS
Amazon Web Services
 
AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
Amazon Web Services
 
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
Amazon Web Services
 
Introducing Kubernetes
Introducing Kubernetes Introducing Kubernetes
Introducing Kubernetes
VikRam S
 

What's hot (20)

Tech Talk on Autoscaling in Apache Stratos
Tech Talk on Autoscaling in Apache StratosTech Talk on Autoscaling in Apache Stratos
Tech Talk on Autoscaling in Apache Stratos
 
AWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine images
AWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine imagesAWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine images
AWS Webcast - Customizing AWS ops works with chef 11 and Amazon machine images
 
StreamSQL Feature Store (Apache Pulsar Summit)
StreamSQL Feature Store (Apache Pulsar Summit)StreamSQL Feature Store (Apache Pulsar Summit)
StreamSQL Feature Store (Apache Pulsar Summit)
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
 
Chatbots with Serverless
Chatbots with ServerlessChatbots with Serverless
Chatbots with Serverless
 
Serverless Summit - Quiz
Serverless Summit - QuizServerless Summit - Quiz
Serverless Summit - Quiz
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
 
DevOpsCon Cloud Workshop
DevOpsCon Cloud Workshop DevOpsCon Cloud Workshop
DevOpsCon Cloud Workshop
 
AWS Lambda from the Trenches
AWS Lambda from the TrenchesAWS Lambda from the Trenches
AWS Lambda from the Trenches
 
Sas 2015 event_driven
Sas 2015 event_drivenSas 2015 event_driven
Sas 2015 event_driven
 
Heterogeneous Workflows With Spark At Netflix
Heterogeneous Workflows With Spark At NetflixHeterogeneous Workflows With Spark At Netflix
Heterogeneous Workflows With Spark At Netflix
 
Serverless Architectures on AWS Lambda
Serverless Architectures on AWS LambdaServerless Architectures on AWS Lambda
Serverless Architectures on AWS Lambda
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Docker in the Cloud
Docker in the CloudDocker in the Cloud
Docker in the Cloud
 
eCAP Developer Walkthru
eCAP Developer WalkthrueCAP Developer Walkthru
eCAP Developer Walkthru
 
Journey towards serverless infrastructure
Journey towards serverless infrastructureJourney towards serverless infrastructure
Journey towards serverless infrastructure
 
Building a PaaS with Docker and AWS
Building a PaaS with Docker and AWSBuilding a PaaS with Docker and AWS
Building a PaaS with Docker and AWS
 
AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
 
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...Give your little scripts big wings:  Using cron in the cloud with Amazon Simp...
Give your little scripts big wings: Using cron in the cloud with Amazon Simp...
 
Introducing Kubernetes
Introducing Kubernetes Introducing Kubernetes
Introducing Kubernetes
 

Viewers also liked

Automating Application over OpenStack using Workflows
Automating Application over OpenStack using WorkflowsAutomating Application over OpenStack using Workflows
Automating Application over OpenStack using Workflows
Yaron Parasol
 
Task flow
Task flowTask flow
Task flow
Vishal Yadav
 
Mistral OpenStack Meetup Feb 5
Mistral OpenStack Meetup Feb 5Mistral OpenStack Meetup Feb 5
Mistral OpenStack Meetup Feb 5
Renat Akhmerov
 
OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...
OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...
OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...
Michael Fork
 
OpenStack networking
OpenStack networkingOpenStack networking
OpenStack networking
Sim Janghoon
 
Open stack networking vlan, gre
Open stack networking   vlan, greOpen stack networking   vlan, gre
Open stack networking vlan, gre
Sim Janghoon
 
Introduction openstack horizon
Introduction openstack horizonIntroduction openstack horizon
Introduction openstack horizon
Jim Yeh
 
OpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoOpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using Django
David Lapsley
 
Openstack Neutron and SDN
Openstack Neutron and SDNOpenstack Neutron and SDN
Openstack Neutron and SDN
inakipascual
 
NFV for beginners
NFV for beginnersNFV for beginners
NFV for beginners
Dave Neary
 
Openstack Basic with Neutron
Openstack Basic with NeutronOpenstack Basic with Neutron
Openstack Basic with Neutron
KwonSun Bae
 
Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...
Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...
Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...
OpenShift Origin
 
OpenStack Neutron Tutorial
OpenStack Neutron TutorialOpenStack Neutron Tutorial
OpenStack Neutron Tutorial
mestery
 
Introduction to OpenFlow, SDN and NFV
Introduction to OpenFlow, SDN and NFVIntroduction to OpenFlow, SDN and NFV
Introduction to OpenFlow, SDN and NFV
Kingston Smiler
 
Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)
rjain51
 

Viewers also liked (15)

Automating Application over OpenStack using Workflows
Automating Application over OpenStack using WorkflowsAutomating Application over OpenStack using Workflows
Automating Application over OpenStack using Workflows
 
Task flow
Task flowTask flow
Task flow
 
Mistral OpenStack Meetup Feb 5
Mistral OpenStack Meetup Feb 5Mistral OpenStack Meetup Feb 5
Mistral OpenStack Meetup Feb 5
 
OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...
OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...
OpenStack Atlanta Summit - Build an OpenStack Cluster Before Lunch, Scale Glo...
 
OpenStack networking
OpenStack networkingOpenStack networking
OpenStack networking
 
Open stack networking vlan, gre
Open stack networking   vlan, greOpen stack networking   vlan, gre
Open stack networking vlan, gre
 
Introduction openstack horizon
Introduction openstack horizonIntroduction openstack horizon
Introduction openstack horizon
 
OpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoOpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using Django
 
Openstack Neutron and SDN
Openstack Neutron and SDNOpenstack Neutron and SDN
Openstack Neutron and SDN
 
NFV for beginners
NFV for beginnersNFV for beginners
NFV for beginners
 
Openstack Basic with Neutron
Openstack Basic with NeutronOpenstack Basic with Neutron
Openstack Basic with Neutron
 
Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...
Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...
Deploying & Scaling OpenShift on OpenStack using Heat - OpenStack Seattle Mee...
 
OpenStack Neutron Tutorial
OpenStack Neutron TutorialOpenStack Neutron Tutorial
OpenStack Neutron Tutorial
 
Introduction to OpenFlow, SDN and NFV
Introduction to OpenFlow, SDN and NFVIntroduction to OpenFlow, SDN and NFV
Introduction to OpenFlow, SDN and NFV
 
Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)
 

Similar to Designing the Call of Cthulhu app with Google App Engine

Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
Tony Frame
 
Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)
Clarence Ngoh
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
Brian Lyttle
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
Lars Vogel
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
Chris Schalk
 
Google cloud platform
Google cloud platformGoogle cloud platform
Google cloud platform
rajdeep
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
guest1af57e
 
Play framework
Play frameworkPlay framework
Play framework
sambaochung
 
Serverless ML Workshop with Hopsworks at PyData Seattle
Serverless ML Workshop with Hopsworks at PyData SeattleServerless ML Workshop with Hopsworks at PyData Seattle
Serverless ML Workshop with Hopsworks at PyData Seattle
Jim Dowling
 
Google App Engine: An Introduction
Google App Engine: An IntroductionGoogle App Engine: An Introduction
Google App Engine: An Introduction
Abu Ashraf Masnun
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mind
BeMyApp
 
Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2
Matthew McCullough
 
Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)
Clarence Ngoh
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
Francesco Marchitelli
 
What's new in android jakarta gdg (2015-08-26)
What's new in android   jakarta gdg (2015-08-26)What's new in android   jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)
Google
 
Google Gears
Google GearsGoogle Gears
Google Gears
silenceIT Inc.
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
Tahir Akram
 
JS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstackJS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstack
JSFestUA
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
wesley chun
 

Similar to Designing the Call of Cthulhu app with Google App Engine (20)

Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
 
Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
 
Google cloud platform
Google cloud platformGoogle cloud platform
Google cloud platform
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
 
Play framework
Play frameworkPlay framework
Play framework
 
Serverless ML Workshop with Hopsworks at PyData Seattle
Serverless ML Workshop with Hopsworks at PyData SeattleServerless ML Workshop with Hopsworks at PyData Seattle
Serverless ML Workshop with Hopsworks at PyData Seattle
 
Google App Engine: An Introduction
Google App Engine: An IntroductionGoogle App Engine: An Introduction
Google App Engine: An Introduction
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mind
 
Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2
 
Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
 
What's new in android jakarta gdg (2015-08-26)
What's new in android   jakarta gdg (2015-08-26)What's new in android   jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)
 
Google Gears
Google GearsGoogle Gears
Google Gears
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
 
JS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstackJS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstack
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 

Recently uploaded

20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
Matthew Sinclair
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
Toru Tamaki
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
Matthew Sinclair
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
ScyllaDB
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
Stephanie Beckett
 
Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
ScyllaDB
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
RaminGhanbari2
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 

Recently uploaded (20)

20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
 
Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 

Designing the Call of Cthulhu app with Google App Engine

  • 1. Designing the Call of Cthulhu app with Google App Engine Presented by Chris Bunch at UCSB CS 189A / 172 : Capstone Project / Software Engineering February 10, 2010 http://cs.ucsb.edu/~cgb
  • 2. Motivation I am what you would call a “nerd” Plays nerdy board games Would like to upload stats from games and analyze them Could do other cool things as well
  • 4. Arkham Horror Lots of variables that can be analyzed Co-op game: all v. the board Mix and match expansions Many different winning / losing conditions But fundamentally boils down to: Save the world from total destruction
  • 5. App Requirements Must be able to upload game data Should be able to predict a win or loss given some preliminary info Can experiment with prediction algorithms Should be able to summarize game data
  • 6. App Requirements Allows users to log in to upload their data Allows users to share data with each other Handles users in a sane fashion Harder than it sounds Display a top score list for users to view Game provides scoring metric
  • 7. Enter the Cloud Why go the cloud route? Simple answer: You likely don’t have your own hardware to host this app on, so just use somebody else’s But cloud computing is confusing and not well defined yet, so...
  • 8. Defining Cloud Computing Three layers, each building on the last Infrastructure: Programmer gets a virtual machine and / or reliable storage Most control of environment Must scale manually Amazon EC2, Eucalyptus
  • 9. Defining Cloud Computing Three layers, each building on the last Platform: Programmer gets a scalable API Less control of environment Scaling done automatically Google App Engine, Microsoft Azure
  • 10. Defining Cloud Computing Three layers, each building on the last Software: Programmer gets to “skin” an existing app No control of environment Scaling done automatically SalesForce, GMail
  • 11. My Choice Clearly I want the platform! Platform: Scalable API = great! Less control of environment = ok Programability depends on APIs offered Have personal exp. w/ Google App Engine
  • 12. What is Google App Engine? Scalable web framework first offered in 2008 Users program apps in: Python Java Unofficially: JRuby, Groovy, JavaScript
  • 13. Sandboxed Environment Requests limited to 30 seconds Only white-listed libraries can be used Anything non-trivial is quota-ed No reading / writing to the filesystem Web communication over HTTP(S) only
  • 14. Datastore API A giant hash table Primitives: Get, put, delete - same as regular HT Query, count - new operations Transactions supported (row-level only)
  • 15. Datastore API GQL queries offered - subset of SQL Select statement, no JOINs Tip: Queries are the most expensive operation, use sparingly If possible, perform it asynchronously
  • 16. Memcache API Equivalent to memcached Provides access to low latency LRU cache Roughly 100x faster than Datastore But unreliable - remember it’s a cache! Exposes get, set, delete operations Exposes atomic increment / decrement
  • 17. URL Fetch API Equivalent to curl Used to grab web content from other sites Only allows for HTTP(S) data to be read Can also be done asynchronously Typically grabs images or mashup data
  • 18. Mail API Equivalent to sendmail Can send or receive mail asynchronously Can also add attachments Not all types allowed - no .doc, .xls, or .ppt in Python SDK
  • 19. XMPP API Equivalent to jabber Send and receive instant messages to appname.appspotchat.com App can’t join group chat yet Use as a notifier or alternate UI to app
  • 20. Images API Equivalent to python-imaging Exposes image rotation, flipping, cropping, and histogram Image is stored internally as a blob, then retrieved and manipulated
  • 21. Users API Equivalent to Google Accounts Provides for simple authentication Allows app to force login or admin on certain pages Also exposes URL to optionally login to
  • 22. Blobstore API Allows for large file uploads (<50 MB) Users can upload videos, datasets, or large music files for later retrieval Upload must be done via form post
  • 23. Cron API Equivalent to cron User specifies how often a web page should be accessed (e.g., daily, every Monday) Task is then run in the background Useful for running expensive data analysis
  • 24. Task Queue API Spawns a new thread in the background But still must visit your app Configuration file specifies queues Useful for short to medium length tasks
  • 25. To summarize: Many, many APIs available for what we need to do! Use Datastore to store / retrieve user data Use Users to authenticate users Gets around a lot of boilerplate authentication code
  • 26. To summarize: Use Mail to e-mail users if their score is beat Use XMPP to allow users to add new data Use Cron to run compute-intensive code in the background
  • 27. To summarize: Think about paid functionality: Maybe use Blobstore to allow users to upload videos explaining gameplay Handle greater traffic if site becomes popular
  • 28. Let’s Get to Business Data Modeling Upload Stats Page Game Stats Page Game Prediction Page
  • 29. Data Modeling class Game(db.Model): player = db.UserProperty() goo = db.StringProperty() comments = dbStringProperty(multiline=True) date = db.DateTimeProperty(auto_now_add=True)
  • 30. Data Modeling num_of_players = db.IntegerProperty() won_game = db.BooleanProperty() doom_counters = db.IntegerProperty() terror_level = db.IntegerProperty() expansions_used = dbListProperty(str)
  • 31. Uploading Stats class AddGames(webapp.RequestHandler): def get(self): user = users.get_current_user() if user: # means they’re logged in # write html form for getting data else: self.redirect(users.create_login_url(self.request.uri))
  • 32. Uploading Stats def post(self): new_goo = self.request.get(‘goo’) # validate goo, make sure data type is right game = Game() game.goo = new_goo game.put()
  • 33. Game Stats games = db.GqlQuery (“SELECT * FROM Game ORDER BY date desc”) for game in games: # find the goo w/ highest player win percentage # can also just display the info here
  • 34. Game Prediction def get(self): # user specifies the game they will play def post(self): # calculate how likely they are to win # right now we only care about the goo
  • 35. Routing application = webapp.WSGIApplication([ (‘/upload’, AddGames), (‘/stats’, GameStats), (‘/predict’, PredictGame)])
  • 36. Thankfully Most requirements have very little state shared between URLs (all saved in DB) Thus each class is one of two forms: get / post: Grab data from user and do something with it get: Just display or synthesize some data
  • 37. Rendering Web Pages Two main options available: self.response.out.write(“Hello World!”) self.response.out.write(template.render(‘index.html’, {‘my_title: ‘baz’, ‘data’: some_variable})) Use the second for any non-trivial app
  • 38. Rendering Web Pages Now in your index.html: <title> {{ my_title }} </title> <div> {{ data }} </div>
  • 39. Tips for Your Programs Separate out your code into files as needed app.yaml specifies this: handlers: - url: /one script: one.py - url: /two/(.*)/(.*) script: /two//.py
  • 40. Tips for Your Programs Make pages with sensitive data ‘secure’ All access done over HTTPS Optional - HTTP and HTTPS work Never - HTTPS redirects to HTTP Always - HTTP redirects to HTTPS
  • 41. Tips for Your Programs Specify static files in app.yaml - url: /images static_dir: static/images Can also tag ‘secure’ if desired
  • 42. Tips for Your Programs Be creative! The webapp framework supports: get, post, head, options, put, delete, trace Map user pages to ~name?
  • 43. Summary Google App Engine is more than flexible enough to handle your web app desires And it’s only getting better! More than enough possibilities to create a web app: you just need a good idea!
  • 44.