Click here to load reader
Oct 19, 2014
PowerPoint Presentation
Akshay [email protected]
Ground Rules
Disturb EveryoneNot by phone ringsNot by local talksBy more information and questions
2
@akshaymathu
Lets Know Each Other
Do you code?OS?Language?Used GAE?Why are you attending?
3
@akshaymathu
Akshay Mathur
Founding Team Member ofShopSocially (Enabling social for retailers)AirTight Neworks (Global leader of WIPS)15+ years in IT industryCurrently Principal Architect at ShopSociallyMostly worked with StartupsFrom Conceptualization to StabilizationAt different functions i.e. development, testing, releaseWith multiple technologies
@akshaymathu
4
What shall we learn
Why GAE (Google App Engine)?General advantages of IaaS (Infrastructure as a Service)PaaS (Platform as a Service)Using GAE SDKAvailable Services from GoogleFilling the GapIncluding third party librariesCreating MVC structureAvailable boilerplate code for quick start
@akshaymathu
5
Why GAE
Application PaaS maintained by GoogleSame platform that powers Google ApplicationsFamiliar technologiesPython, PHP, Java, GoReadymade additional servicesStorage, Email, Chat, Task queue etc.No (or very low) initial costFree quotas
@akshaymathu
6
@akshaymathu
7
IaaS
Move your local/data center servers to cloudDont worry about hardwareScale up/down as neededSimplified logistics for IT adminsPay only for used infrastructure
Custom hardware is not available
@akshaymathu
8
PaaS: Advantages
Move your application environment on cloudFocus only on your applicationDont worry for upgradesEasy to scaleEasy to administerGet all benefits of IaaSControl in developers hand
@akshaymathu
9
@akshaymathu
10
PaaS: Limitations
No control over machinesNo access to file systemNo sshNo native software installationUse only the provided softwareUpgrade with the providerLimitation on usage of network stackNo sniffing of trafficLimited use of ports
@akshaymathu
11
Getting Started
Hello world!
Why Python
Because we love it GAE says:
@akshaymathu
13
Getting Started
Install Python Download and install GAE SDKConfigure app.yamlWrite codeTest locally as GAE appDeploy
@akshaymathu
14
Runtime configuration: app.yaml
@akshaymathu
15
Code: main.py
@akshaymathu
16
Deploy
@akshaymathu
17
18
@akshaymathu
Gearing up for Bigger App
Creating the basic Structure
Included Libraries
Webapp2, Django, Ssl, PIL, Pycrypto, Setuptools, Webob, Yaml, MySQLdb
Endpoints: Libraries for building APIs in an App Engine application.Jinja2: A modern and designer friendly templating language for Python.Lxml: A Pythonic binding for the C libraries libxml2 and libxslt.Markupsafe: A XML/HTML/XHTML markup safe string for Python.Matplotlib: A 2D plotting library which produces publication-quality figures.Numpy: A general-purpose library for array-processing.Protorpc: A framework for implementing HTTP-based remote procedure call (RPC) services.PyAMF: A library that provides (AMF) Action Message Format functionality.
@akshaymathu
20
Available Services
@akshaymathu
21
Data Storage
DatastoreA schemaless object datastore providing robust, scalable storage for your web application, a rich data modeling API, and a SQL-like query language called GQL.BlobstoreAllows your application to serve large data objects, such as video or image files, that are too large for storage in the Datastore service.MemcacheA distributed, in-memory data cache that can be used to greatly improve application performance.LogsProvides programmatic access to application and request logs from within your application.
@akshaymathu
22
Communications
ChannelCreates a persistent connection between your application and Google servers, so you can send messages to JavaScript clients in real time without "polling."MailSends email messages on behalf of administrators and users with Google Accounts, and receives mail at various addresses.URL FetchUses Google's networking infrastructure to efficiently issue HTTP and HTTPS requests to URLs on the web.XMPPEnables an application to send and receive chat messages to and from any XMPP-compatible chat messaging service.
@akshaymathu
23
Process Management
Task QueueAllows applications to perform work outside of a user request, and organize that work into small, discrete units, called "tasks," to be executed later.Scheduled TasksAllows applications to configure regularly scheduled tasks that operate at defined times or regular intervals.
@akshaymathu
24
Computation
BackendsInstances of your application that are exempt from request deadlines and have access to more memory and CPU resources.ImagesManipulates, combines, and enhances images, converts images between formats, and queries image metadata such as height and frequency of colors.
@akshaymathu
25
App configuration and management
App IdentityGives code access to the application identity; provides framework to assert this identity over OAuth.CapabilitiesProvides detection of outages and scheduled maintenance for specific APIs and services, so that your application may bypass them or inform your users.SSL for Custom DomainsAllows applications to be served via both HTTPS and HTTP via a custom domain instead of an appspot.com address.RemoteLets external applications transparently access App Engine services. For example, you can use Remote API to access a production datastore from an app running on your local machine.MultitenancyMakes it easy to compartmentalize your data to serve many client organizations from a single instance of your application.Traffic SplittingAllows you to roll out features for your app slowly over a period of time, and do A/B Testing. Traffic Splitting works by splitting incoming requests to different versions of your app.UsersAllows applications to sign in users with Google Accounts or OpenID, and address these users with unique identifiers.
@akshaymathu
26
Third-party Services
SendGrid (Email)Use SendGrid's library to send emails from your app and you can see statistics on opens, clicks, unsubscribes, spam reports and more.Twilio (SMS/Voice)Enables your application to make and receive phone calls, send and receive text messages, and make VoIP calls from any phone, tablet, or browser.
@akshaymathu
27
Preview Features
Google Cloud EndpointsEnables automatic generation of APIs, making it easier to create a web backend for web clients and mobile clients such as Android or Apple's iOS.Google Cloud SQLA fully-managed web service that allows you to create, configure, and use relational databases that live in Google's cloud.Google Cloud Storage Client LibraryLets your application read files from and write files to buckets in Google Cloud Storage, with with internal error handling and retry logic.ModulesLets developers factor large applications into logical components that can share stateful services and communicate in a secure fashion.SocketsEnables support for outbound sockets using the language-specific, built-in libraries.
@akshaymathu
28
Experimental Features
MapReduceAn optimized adaptation of the MapReduce computing model for efficient distributed computing over large data sets.OAuthUsing Google Accounts and the OAuth API, any App Engine application can be an OAuth consumer.OpenIDAn open technology used for authenticating users across various web services.PageSpeedA family of tools that automatically optimizes the performance of your application.Task Queue REST APIEnables the use of an App Engine task queue over REST.Task Queue TaggingLeases up to a specified number of tasks with the same tag from the queue for a specified period of time.
@akshaymathu
29
Search
SearchAllows your application to perform Google-like searches over structured data such as: plain text, HTML, atom, numbers, dates, and geographic locations.Prospective SearchA querying service that allows your application to match search queries against real-time data streams.
@akshaymathu
30
Filling the Gap
Including other librariesPlace them within your appOnly pure Python libs can be usedCreating MVC structureCreate your own directory structureAdjust path for supporting it
@akshaymathu
31
MVC Structure
@akshaymathu
32
New Code: main.py
@akshaymathu
33
Global Configuration: config.py
@akshaymathu
34
Route List
@akshaymathu
35
Controller
@akshaymathu
36
Base Controller
@akshaymathu
37
Third Party Libs
@akshaymathu
38
Static Files
@akshaymathu
39
40
@akshaymathu
Dive Deeper
Get the app working
Scheduled Tasks: cron.yaml
@akshaymathu
42
Datastore
NoSQL database is available in free quotaSQL database (Google Cloud SQL) is also available
@akshaymathu
43
Data Manipulation
Functions.get_by_id().all()
.put()db.delete()
@akshaymathu
44
GQL.gql()People.gql("where email_addr = :1 and passwd = :2", username, get_password_hash(passwd))gql_query()gql_query(select * from people where email_addr = :1 and passwd = :2", username, get_password_hash(passwd))
Task Queue