deploying applications to cloud with google app engine
TRANSCRIPT
ABOUT ME
Alexander Zamkovyi
Java Developer @ Intro Pro
Linked[in]: ua.linkedin.com/in/invaa/
e-mail: [email protected]
GOOGLE APP ENGINE
Part of Google Cloud Platform (trusted by 4 million applications)
Platform-as-a-Service (Java, Python, PHP, Go)
264k websites (258k is active), according to builtwith.com
Coca-cola, Snapchat, Ubisoft, Rovio, BestBuy, Sony Music, ...
REASONS TO LEARN GOOGLE APP ENGINE
Highly scalable
Integration
Cost-effective
Well documented
It’s Google
PLAN
Google Cloud Endpoints
Google App Engine Development Process
Deployment and Troubleshooting
Persistence
Limitations
THE SANDBOX
Java 7 JVM in a safe "sandboxed" environment
Servlet 2.5 standard
Standard WAR directory structure
Secured "sandbox" environment isolates application for service and security
The JVM can execute any Java bytecode that operates within the sandbox
restrictions
DEMO (CLOUD ENDPOINTS)
Web frontend
Deployed: https://cloudendpointstic.appspot.com
Sources: https://github.com/GoogleCloudPlatform
DEMO (CLOUD ENDPOINTS)
Android client
Deployed:
https://play.google.com/store/apps/details?id=com.devrel.sa
mples.ttt
Sources: https://github.com/GoogleCloudPlatform
REQUIREMENTS AND PREREQUISITES
JDK 1.7 (recommended)
Apache Maven 3.1+
MySQL 5+ (for local dev server)
Google account
Application ID
IDE
GAE JAVA PROJECT STRUCTURE
You'll add your own application Java classes
to src/main/java/...
You'll configure your application using the
file src/main/webapp/WEB-INF/appengine.web.xml
You'll configure your application deployment using
the file src/main/webapp/WEB-INF/web.xml
THE JAVA DEVELOPMENT SERVER
jetty-6.1.x (built-in)
The development web server simulates the App Engine Java runtime
environment and all of its services, including the datastore
DEMO (CLOUD DATASTORE AND CLOUD SQL)
Calendar app
Features:
JPA (Cloud SQL vs Cloud Datastores)
Spring MVC
jQuery
Deployed: http://cloudcalendarservice.appspot.com/
Sources: https://github.com/invaa/CloudCalendar
AN APP ENGINE APPLICATION CANNOT
write to the filesystem. Applications must use the App Engine datastore for
storing persistent data. Reading from the filesystem is allowed, and all
application files uploaded with the application are available
respond slowly. A web request to an application must be handled within a few
seconds. Processes that take a very long time to respond are terminated to
avoid overloading the web server
make other kinds of system calls
WEB.XML FEATURES NOT SUPPORTED
App Engine supports the <load-on-startup> element for servlet declarations. However, the load actually occurs during the first request handled by the web server instance, not prior to it
Some deployment descriptor elements can take a human readable display name, description and icon for use in IDEs. App Engine doesn't use these, and ignores them
App Engine doesn't support JNDI environment variables (<env-entry>)
App Engine doesn't support EJB resources (<resource-ref>)
Notification of the destruction of servlets, servlet context, or filters is not supported
The <distributable> element is ignored
Servlet scheduling with <run-at> is not supported
JPA FEATURES NOT SUPPORTED
Owned many-to-many relationships
"Join" queries. You cannot use a field of a child entity in a filter when
performing a query on the parent kind. Note that you can test the parent's
relationship field directly in a query using a key
Aggregation queries (group by, having, sum, avg, max, min)
Polymorphic queries. You cannot perform a query of a class to get instances
of a subclass. Each class is represented by a separate entity kind in the
datastore