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.
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. 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. 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. 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. Rapid App Development - When ?
• Prototyping
• Personal Pet Project
• Utility Apps
• REST API
6
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
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. 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. 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. 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. 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. 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. 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. Enter Glide
• Easy Install
• No configuration, well almost
• No complicated directory structure
• Hot reload
• No Lock-in, export to gradle project
16
17. Built on Awesome technoloG’s
• Google App Engine
• Groovy
• Gaelyk
• Gradle
• Git
• GitHub
17
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
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. Using Glide
You need to know only three commands :
$ glide run
$ glide deploy
$ glide export
21
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. Configure Glide App
• Required to deploy app.
• Use the registered app-id
app {
name = "app-id"
version = "v1"
}
23
25. Security
• Authentication
– Use ubiquitous Google id
– Or open Id (experimental)
– Can Allow only administrator
web {
security = [
'admin': ["/post/*"],
'*': ["/view/*"]
]
}
25