Grails – from scratch to
production

How we build successful application
Tal Maayani
November 2013
Agenda
•
•
•
•
•
•

About the lecturer
Choosing the technology: Grails vs…
Common pitfalls
Development methodologies
Conti...
Choose the right technology
• Project type: self service web application with a rich back office
• Project roadmap: workfl...
Comparing between alternatives
Feature

Grails

Rails

Language

Groovy - JVM based

Ruby - Interpreter based

Approach

D...
Why we chose Grails?
• Build on known technologies that we already used
• Spring, Hibernate, Tomcat, Quartz

• Fast develo...
Common Grails pitfalls
• Writes java in groovy
experts

•
•
•
•
•

 Use outsource grails

Difficult debugging (comparing ...
Groovy Ecosystem
Spoke

Gradle

Grails

Junit

Build framework

RAD Platform

Gpars

Gaelyc

Muti-threading

Toolkit for G...
Development process
Highlights

• Holistic thinking:
• production deployment, performance, testing, interfaces

• Lean dev...
Grails Plugins

Recommendations
• Do not blind use plugins
•
•
•
•

Plugins dependencies and footprint considerations
Perf...
Plugins that we used
•
•
•
•
•
•
•
•

In house development
Spring web flow – state machine for managing flows
aws – enable...
AWS Configuration Loader Plugin
• Enable the use of external configuration file for per environment
settings
• Server name...
Liquibase Plugin
• Use when
• You are using relational DB on production
• Have a frequent schema changes

• Major function...
Liquibase Plugin – cont.
• Drawbacks (for 1.3.6 and below)
• Maintenance
• Do not use per environment configuration in dat...
Health Check
• Get report for instance health
• Access to various data sources (MySQL, Mongo, Oracle)
• Access to other co...
Working with Amazon
EC2 vs. Elastic Beanstalk

Capability

EC2

Beanstalk

Configuration
Management

Flexible, can run scr...
Continuous Integration
Using Amazon

 Dev. commits
 Build server run unit tests
 Build server deploy war to dev integra...
KPI Measurements
• Define a set of goals that measures success
• Total # of users, abandonment rate, conversion rate

• De...
Groovy & Grails - From Scratch to Production
Upcoming SlideShare
Loading in …5
×

Groovy & Grails - From Scratch to Production

2,091 views

Published on

Walk-through a true story of developing a Grails web application from the ground up. some tips and how to guides for those of you who want to start developing on Grails or are using Grails and would like to learn from other experience.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,091
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
37
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Groovy & Grails - From Scratch to Production

  1. 1. Grails – from scratch to production How we build successful application Tal Maayani November 2013
  2. 2. Agenda • • • • • • About the lecturer Choosing the technology: Grails vs… Common pitfalls Development methodologies Continuous Integration Q&A
  3. 3. Choose the right technology • Project type: self service web application with a rich back office • Project roadmap: workflow, many integrations with external vendors, analytic, payments • Timeline: start development within a short period, full power development within 3 months, production within 6 months • Budget • Available in-house skillset  Requires fast web development framework like Spring ,Play, Rails, Grails, Django
  4. 4. Comparing between alternatives Feature Grails Rails Language Groovy - JVM based Ruby - Interpreter based Approach Domain oriented Database oriented Thread support Native Poor Hardware requirements Requires more memory, and strong CPU mediocre memory and CPU Learning Curve Fast for a java developers operates in Database model Maturity Less Mature (Founded at 2008) More mature (Founded at 2004) Scalability Offer good scalability Lack scalability Libraries Offers all java based libraries No java libraries longer than Grails since Rails
  5. 5. Why we chose Grails? • Build on known technologies that we already used • Spring, Hibernate, Tomcat, Quartz • Fast development • Scaffolding , Smart reloading, Hundreds of plugins (~1000), groovy • MVC web application • Domain, GSP, Controller
  6. 6. Common Grails pitfalls • Writes java in groovy experts • • • • •  Use outsource grails Difficult debugging (comparing to java)  More logging Maintaining data model  Liquibase Groovy dynamic nature  Test everything Some plugins are unstable  Smart use of plugins Highly hardware demands  Use strong machines
  7. 7. Groovy Ecosystem Spoke Gradle Grails Junit Build framework RAD Platform Gpars Gaelyc Muti-threading Toolkit for GAE EasyB Codenarc GContract Griffon Static code Analysis Design by contract BDD Swing UI And many more …
  8. 8. Development process Highlights • Holistic thinking: • production deployment, performance, testing, interfaces • Lean development • Development of only what is required • Test on production like environment • System test as soon as possible • Learn from mistakes
  9. 9. Grails Plugins Recommendations • Do not blind use plugins • • • • Plugins dependencies and footprint considerations Performance consideration (startup overhead) Write your own set of plugins (configuration, health check, authentication, taglibs) Maintain up to date plugin • JS wrapper plugins (Jquery, bootstrap) – • Not always up to date and maintained •  sometimes it is preferable to copy the js library instead of using the plugin
  10. 10. Plugins that we used • • • • • • • • In house development Spring web flow – state machine for managing flows aws – enable use of amazon via grails service Cache, zipped resources Less-css Spring security Quartz Yammer metrics
  11. 11. AWS Configuration Loader Plugin • Enable the use of external configuration file for per environment settings • Server name, performance tuning, etc. • Receive configuration file • Local file – for development • S3 URL – when running on amazon. Use access and secret keys. • How it works? • Copy the external configuration file locally and merge config.groovy
  12. 12. Liquibase Plugin • Use when • You are using relational DB on production • Have a frequent schema changes • Major functionality • Keep record of every db schema change, use DSL to record these changes • Enforce object model & DB match (using MD5) • Allows to have business logic (in groovy) to support migrations
  13. 13. Liquibase Plugin – cont. • Drawbacks (for 1.3.6 and below) • Maintenance • Do not use per environment configuration in datasource.groovy • Extension • Allow running any sql script in change set For example: Quartz schema
  14. 14. Health Check • Get report for instance health • Access to various data sources (MySQL, Mongo, Oracle) • Access to other components • Triggered from monitoring system • Report generated ad hoc • Implemented in grails plugin • Building block per access point
  15. 15. Working with Amazon EC2 vs. Elastic Beanstalk Capability EC2 Beanstalk Configuration Management Flexible, can run scripts on instance build, deployments. Can use CM like chef or puppet Use prebuild AM with given configuration. Can use limited Yml script for customization Monitoring, Load Balancing, Auto scaling Need to configure Automatically defined Application management - Manage logs, environment configuration, versions, externalize configuration properties Stopping environment Environment can be stopped Environment cannot be stopped Deployment Custom script AWS API call
  16. 16. Continuous Integration Using Amazon  Dev. commits  Build server run unit tests  Build server deploy war to dev integration environment  Build server deploy war to amazon QA environment Build server triggered Selenium to run subsystem test against QA War is ready (PSP)
  17. 17. KPI Measurements • Define a set of goals that measures success • Total # of users, abandonment rate, conversion rate • Define measurements tools • Systematically and periodically measure • Learn from the results

×