Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying Grails in the Cloud

Deploying Grails in the Cloud

Deploying Grails applications in Java PaaS providers
GR8Conf US 2013

Ken Liu

July 22, 2013
Tweet

More Decks by Ken Liu

Other Decks in Programming

Transcript

  1. About me Web development with Java since JDK 1.0.2 (applets,

    anyone?) Groovy and Grails since 2009 Lead developer for IEEE Spectrum Always been a closet fan of dynamic languages (starting with Perl)
  2. About IEEE / IEEE Spectrum Institute of Electrical and Electronics

    Engineers Widely known for standards - 802.3, 802.11 World’s largest technology professional association - 400,000 engineers in 160 countries Publishes nearly a third of the world’s technical literature in EE/CS IEEE Spectrum http://spectrum.ieee.org - 100% Grails
  3. Agenda Cloud hosting and PaaS Overview of JVM PaaS providers

    Deploying Grails in the cloud Demo: AWS Elastic Beanstalk Cloud application architecture
  4. Agenda Cloud hosting and PaaS Overview of JVM PaaS providers

    Deploying Grails in the cloud Demo: AWS Elastic Beanstalk Cloud application architecture
  5. Why deploy in the Cloud? Quick startup Elastic scalability Financial

    benefits Pay per use for one-off / periodic loads Reduced long-term financial commitment CapEx vs. OpEx
  6. Why deploy in the Cloud? Data center reliability / uptime

    Global data centers Treat hardware / infrastructure resources like software Consolidated service provisioning - using APIs Empowered business units / bypass traditional IT
  7. Cloud service models SaaS - Software as a Service PaaS

    - Platform as a Service IaaS - Infrastructure as a Service More automated, delegated, managed, inflexible Salesforce, Google Apps, iCloud Amazon EC2, Rackspace, Joyent GAE, Heroku, Amazon Beanstalk
  8. What is PaaS? Pre-configured application stack(s) Middleware layer running on

    top of IaaS Infrastructure automation, rapid deployment Abstraction layer for cloud interoperability Platform-specific APIs / services
  9. Why PaaS? Focus on application development, not infrastructure Much simpler

    process for provisioning services / resources (compared to IaaS) One-off use cases Experiment with services without upfront commitment Pre-configured integration with other services
  10. Typical PaaS features Ease of use Easily/quickly create new environments

    from scratch Automated DNS Load balancing Scaling/autoscaling Application monitoring Hosted DB SSL support Support for multiple stacks/languages Log file management Limited customization
  11. Why developers love PaaS Bypass IT headaches Deployment / app

    version management Remote log viewing and debugging Multiple environment creation / configuration Command-line tools and API access Integrated CI / build Integrated monitoring
  12. Evaluating PaaS providers: key differentiators Ease of use / web

    console Developer tools Billing / pricing model Choice of IaaS providers Business maturity Breadth of additional services Support / prof. svcs ALM / source control SLAs Backups / storage mgt.
  13. Agenda Cloud hosting and PaaS Overview of JVM PaaS providers

    Deploying Grails in the cloud Demo: AWS Elastic Beanstalk Cloud application architecture
  14. Overview of PaaS providers Java support (JDK + Tomcat /

    Jetty) Grails support? Compare / contrast different approaches to PaaS
  15. Google App Engine First well-known Java PaaS offering Nice tooling

    - Eclipse integration Useful set of proprietary APIs (image processing, email, memcache, task queue) Integration with other Google services - Google Accounts, Cloud SQL, Cloud Storage, App Engine Datastore (NoSQL)
  16. Google App Engine Explicit constraints for scalability restricted Java API,

    slow startup limitations standard Java Threads not allowed, prevents use of libraries like Quartz Grails app-engine plugin abandoned, doesn't support Grails 2.0 (broken) Gaelyk - lightweight alternative
  17. Pivotal Cloud Foundry Open source PaaS platform, run your own

    cloud Multi language, multi-cloud Pivotal backing, and of course SpringSource Eclipse / STS integration v2 recently launched with paid service Platform implemented / extended by other vendors
  18. Heroku Best known for Ruby on Rails hosting Beta support

    for Grails Customization via buildpacks Only 2 container types: “Dyno” and “2X Dyno” Runs on top of Amazon EC2 Git-based deployment mechanism
  19. CloudBees Most Java friendly - veterans of Sun/Oracle and JBoss

    Focused solely on Java platform/JVM languages and frameworks Can target multiple IaaS, but AWS is primary First-class support for Grails DEV@cloud (hosted Jenkins), Continuous Deployment? Add-on marketplace, like Heroku
  20. AWS Elastic Beanstalk Still technically in “beta”, meaning no specific

    SLAs No additional cost All other AWS services are available to application (e.g. RDS, SES, CloudFront, etc.) Integrates with AWS security infrastructure (IAM, Security Groups, etc.) and other services (e.g. VPC, CloudWatch)
  21. AWS Elastic Beanstalk Can “hack” image used to create instances

    AWS may already be in use at your company Big AWS ecosystem - such as Rightscale, Scalr Default, “easy” choice - “no one ever got fired for buying IBM”
  22. Agenda Cloud hosting and PaaS Overview of JVM PaaS providers

    Deploying Grails in the cloud Demo: AWS Elastic Beanstalk Cloud application architecture
  23. Supporting Grails Most environments that will support Java should work

    Supports Java and a web container (Tomcat or Jetty) Which JDK implementation? (OpenJDK vs. Oracle JDK) Application memory footprint Grails build support (maven/Gradle/grails wrapper)
  24. General steps for deploying Grails Create “application” target in cloud

    provider Provision services (e.g. DB) & bind to “application” Configure JVM parameters (heap, permgen) Configure Grails application: Datasource, logging, etc. Build WAR locally, push to cloud via API (or upload) Profit!
  25. Grails cloud plugins cloud-support plugin (base plugin) AWS (not Elastic

    Beanstalk) - wraps AWS APIs Heroku Cloud Foundry CloudBees Google App Engine (deprecated)
  26. Grails cloud plugins Automate / simplify Grails application configuration -

    automatic binding of service details Wrap or provide Grails equivalent CLI commands Wrap / simplify API layer with groovy
  27. Agenda Cloud hosting and PaaS Overview of JVM PaaS providers

    Deploying Grails in the cloud Demo: AWS Elastic Beanstalk Cloud application architecture
  28. EB Host Manager Update application package (e.g. WAR) Aggregate events

    and metrics for later retrieval Generate instance-level events Monitor the application log files for critical errors Monitor the application server Rotate your application’s log files and publish them to Amazon S3
  29. Agenda Cloud hosting and PaaS Overview of JVM PaaS providers

    Deploying Grails in the cloud Demo: AWS Elastic Beanstalk Cloud application architecture
  30. Cloud application architecture Design to scale horizontally and with autoscaling

    Local storage is “ephemeral” - don't store to local disk, use “cloud storage”, ala S3 Don't treat cloud servers like data center - make your servers “disposable” Expect / plan for variations in service quality (e.g. Netflix Chaos Monkey)
  31. Non-technical challenges IT acceptance / FUD Ops support - take

    for granted IT datacenter support May actually be more costly than traditional colocation How to handle billing / managing costs? Learning curve - many new unfamiliar services with different characteristics Need for governance / auditing
  32. Final Recommendations Avoid / minimize vendor lock-in Set up automatic

    deployment from your CI Consider using PaaS only for Dev/QA but keep deploying to existing PROD environments Be aware of application architecture differences Carefully select cloud provider and run pilot project before migrating critical applications
  33. Additional Resources Java Paas Shootout http://ibm.co/gxWXSF Which Freaking PaaS Should

    I Use? http://bit.ly/ Rp53UF Why Platform as a Service will rule the world http:// ibm.co/gxWXSF