Rapid Application Development on
Google App Engine for Java
Kunal Dabir
@kdabir
github.com/kdabir
Agenda
• Introduction
• Rapid Apps – when?
• Options
• Developing on GAE/J
– Pricing
– Architecture
– What’s wrong
– Simpl...
About the Talk
• Level: Basic / Introductory
• Warning: There will be <code>
– Some Programming knowledge of Java/Html
• B...
About Me
• Programming for more than a decade
• Currently working at ThoughtWorks
• Language Enthusiast:
– Java, Groovy, R...
Quick Poll - Who all:
• Do Java web apps?
• Have used Google App Engine?
• Have heard of Groovy Language?
• Understand NoS...
Rapid App Development - When ?
• Prototyping
• Personal Pet Project
• Utility Apps
• REST API
6
Rapid App Development - When ?
• Not more than a few pages
• Data Records in thousands
• When time to market is critical
•...
Options
• Google App Engine – google
• Heroku - salesforce
• CloudFoundry - vmware/spring
• OpenShift - Redhat/jboss
• dot...
Google App Engine - Benefits
• Quick to get development started
• Easy Provisioning
• No Operations
• Horizontal (Auto) Sc...
GAE Has it all
• DataStore
• Memcache
• Blobstore
• Users API
• Channel API
• Backends
• Images API
• Logging
• Mail API
•...
At High Level
11
DataStore HRD
• One for app
• Multi tennancy
• Shared between
version
App Servers
• App Code
• Auto Scale...
Pricing
• Free to start
• Enable Paid app, get resident instance.
• A lot cheaper than competition
• 28 free instance hour...
The Java Way - What’s Wrong?
As a java web developer:
• Puzzled with OO soup, getters setters, syntactic
noises
• Framewor...
The Java Way - What’s Wrong?
• Complex Builds
– And the Builds files (verbose, xml)
• Nested directory structure of java w...
The Java Way - What’s Wrong?
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorl...
Enter Glide
• Easy Install
• No configuration, well almost
• No complicated directory structure
• Hot reload
• No Lock-in,...
Built on Awesome technoloG’s
• Google App Engine
• Groovy
• Gaelyk
• Gradle
• Git
• GitHub
17
Gaelyk Recap - Persistence
import com.google.appengine.api.users.User
import groovyx.gaelyk.datastore.*
@Entity
class Post...
Gaelyk Recap - Controller
new Post(
title: params.title,
content: params.content,
user: users.currentUser
).save()
log.inf...
Gaelyk Recap - Routing
get "/", forward: "/home.gtpl" , cache: 10.minutes
get "/docs/@doc", forward: "/_doc.groovy?docname...
Using Glide
You need to know only three commands :
$ glide run
$ glide deploy
$ glide export
21
Configuration Files
• Only three config files, All optional
__glide.groovy
Discussed in next section
__routes.grovy
The ga...
Configure Glide App
• Required to deploy app.
• Use the registered app-id
app {
name = "app-id"
version = "v1"
}
23
Layout Template
Sitemesh enabled by default
layout {
mappings = [
"/*": "/_layout.html"
]
}
24
Security
• Authentication
– Use ubiquitous Google id
– Or open Id (experimental)
– Can Allow only administrator
web {
secu...
Demo
26
Getting more mileage
• Use CDN
• Hotlink JS Libraries, CSS and Images
• Use static landing page
• Use memcache
• Cache pag...
Trade Offs
• Performance
• Slower cold start
• Learning curve
• Difference b/w Local and Live GAE server
28
Question Answers
• Questions are guaranteed in Life, Answers
aren’t
29
Resources
• Glide :
– http://glide-gae.appspot.com
• Gaelyk :
– http://gaelyk.appspot.com
• Group:
– http://groups.google....
Upcoming SlideShare
Loading in …5
×

Rapid Application Development on Google App Engine for Java

4,793 views

Published on

When you need to build and host web application as soon as possible with no cost involved and want no nonsense stuff to come in between, glide can come handy.

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,793
On SlideShare
0
From Embeds
0
Number of Embeds
608
Actions
Shares
0
Downloads
34
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Rapid Application Development on Google App Engine for Java

  1. 1. Rapid Application Development on Google App Engine for Java Kunal Dabir @kdabir github.com/kdabir
  2. 2. Agenda • Introduction • Rapid Apps – when? • Options • Developing on GAE/J – Pricing – Architecture – What’s wrong – Simpler way • Demo – Build and deploy a simple site. • Better Practices • Q & A 2
  3. 3. About the Talk • Level: Basic / Introductory • Warning: There will be <code> – Some Programming knowledge of Java/Html • Based on my own experiences: – Working in different web technologies and – Cloud hosting solutions • Takeaways : – Get your app on cloud in a snap – Learn a thing or two about GAE/J 3
  4. 4. About Me • Programming for more than a decade • Currently working at ThoughtWorks • Language Enthusiast: – Java, Groovy, Ruby, JavaScript (Node), CoffeeScript, Scala,….. • Groovy Evangelist • Co-Organizer / Speaker: Pune Java User Group • More at: kunaldabir.appspot.com 4Facts as on Sept 2013 
  5. 5. Quick Poll - Who all: • Do Java web apps? • Have used Google App Engine? • Have heard of Groovy Language? • Understand NoSQL data store? • Deployed an app ? – (cloud/shared hosting /VPS/ anywhere) • Enjoy programming? 5
  6. 6. Rapid App Development - When ? • Prototyping • Personal Pet Project • Utility Apps • REST API 6
  7. 7. Rapid App Development - When ? • Not more than a few pages • Data Records in thousands • When time to market is critical • When resources are limited 7
  8. 8. Options • Google App Engine – google • Heroku - salesforce • CloudFoundry - vmware/spring • OpenShift - Redhat/jboss • dotCloud, EngineYard, Joyent, Cloudbees .... 8
  9. 9. Google App Engine - Benefits • Quick to get development started • Easy Provisioning • No Operations • Horizontal (Auto) Scaling • Language Support : Python, Java, Go and PHP 9
  10. 10. GAE Has it all • DataStore • Memcache • Blobstore • Users API • Channel API • Backends • Images API • Logging • Mail API • Capabilities API • Multitenancy • Task Queue • Cron Jobs • URLFetch • XMPP • Static File Server 10
  11. 11. At High Level 11 DataStore HRD • One for app • Multi tennancy • Shared between version App Servers • App Code • Auto Scaled • Multi Versioned Static Web Server • CSS/JS/HTML • Fast Response • Always On
  12. 12. Pricing • Free to start • Enable Paid app, get resident instance. • A lot cheaper than competition • 28 free instance hours $0.08 / hour • https://cloud.google.com/pricing/ 12
  13. 13. The Java Way - What’s Wrong? As a java web developer: • Puzzled with OO soup, getters setters, syntactic noises • Framework hell, Mix and match. • XML noise or interspersed annotations@@@@ • Deployment ?? where ?? nothing free 13
  14. 14. The Java Way - What’s Wrong? • Complex Builds – And the Builds files (verbose, xml) • Nested directory structure of java web apps • Using the SDK directly – Or the eclipse plugin (can’t build outside IDE) • Ceremony and Boilerplate 14
  15. 15. The Java Way - What’s Wrong? import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("Hello World"); } } 15
  16. 16. Enter Glide • Easy Install • No configuration, well almost • No complicated directory structure • Hot reload • No Lock-in, export to gradle project 16
  17. 17. Built on Awesome technoloG’s • Google App Engine • Groovy • Gaelyk • Gradle • Git • GitHub 17
  18. 18. Gaelyk Recap - Persistence import com.google.appengine.api.users.User import groovyx.gaelyk.datastore.* @Entity class Post { String title String content @Indexed Date date = new Date() User user } 18
  19. 19. Gaelyk Recap - Controller new Post( title: params.title, content: params.content, user: users.currentUser ).save() log.info "Post Saved" redirect "/" 19
  20. 20. Gaelyk Recap - Routing get "/", forward: "/home.gtpl" , cache: 10.minutes get "/docs/@doc", forward: "/_doc.groovy?docname=@doc" get "/docs/", redirect: "/docs/intro" post "/create", forward: "/_create.groovy" all "/install", forward: "/install.html" 20
  21. 21. Using Glide You need to know only three commands : $ glide run $ glide deploy $ glide export 21
  22. 22. Configuration Files • Only three config files, All optional __glide.groovy Discussed in next section __routes.grovy The gaelyk routes file we just saw __build.gradle Used to customize build. Not discussed here. 22
  23. 23. Configure Glide App • Required to deploy app. • Use the registered app-id app { name = "app-id" version = "v1" } 23
  24. 24. Layout Template Sitemesh enabled by default layout { mappings = [ "/*": "/_layout.html" ] } 24
  25. 25. Security • Authentication – Use ubiquitous Google id – Or open Id (experimental) – Can Allow only administrator web { security = [ 'admin': ["/post/*"], '*': ["/view/*"] ] } 25
  26. 26. Demo 26
  27. 27. Getting more mileage • Use CDN • Hotlink JS Libraries, CSS and Images • Use static landing page • Use memcache • Cache pages • Enable PageSpeed • Multiple versions 27
  28. 28. Trade Offs • Performance • Slower cold start • Learning curve • Difference b/w Local and Live GAE server 28
  29. 29. Question Answers • Questions are guaranteed in Life, Answers aren’t 29
  30. 30. Resources • Glide : – http://glide-gae.appspot.com • Gaelyk : – http://gaelyk.appspot.com • Group: – http://groups.google.com/forum/#!forum/glide-groovy • Github: – https://github.com/kdabir/glide 30

×