Rails Deployment in the Enterprise: Transmitting a Little Experience Robert Postill.

Slides:



Advertisements
Similar presentations
Implementing Tableau Server in an Enterprise Environment
Advertisements

© Copyright 2012 STI INNSBRUCK Apache Lucene Ioan Toma based on slides from Aaron Bannert
CS 4720 Mobile Device Architecture CS 4720 – Web & Mobile Systems.
® IBM Software Group © 2010 IBM Corporation What’s New in Profiling & Code Coverage RAD V8 April 21, 2011 Kathy Chan
Enterprise Smart Clients Architecture, Patterns, Design, Best Practices Keith Elder Manager, Sr. Software Engineer Quicken Loans Blog:
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
ManageEngine TM Applications Manager 8 Monitoring Custom Applications.
Assessing Vulnerabilities ISA 4220 Server Systems Security James A. Edge Jr., CISSP, CISM, CISA, CPTE, MCSE Sr. Security Analyst Cincinnati Bell Technology.
27-Jun-15 Rails. What is Rails? Rails is a framework for building web applications This involves: Getting information from the user (client), using HTML.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Apache Jakarta Tomcat Suh, Junho. Road Map Tomcat Overview Tomcat Overview History History What is Tomcat? What is Tomcat? Servlet Container.
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
RUBY ON RAILS It’s so rad. What we’ll cover  What is Ruby?  What is RoR?  Why RoR?  Developing with RoR  Deployment  Demo  Questions.
Ruby on Rails. What is Ruby on Rails? Ruby on Rails is an open source full-stack web framework. It is an alternative to PHP/MySQL. It can render templates,
Linux Operations and Administration
Getting to Push Button Deploys Moovweb January 19, 2012.
DONE-10: Adminserver Survival Tips Brian Bowman Product Manager, Data Management Group.
SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building Assignment.
SQL Server User Group Meeting Reporting Services Tips & Tricks Presented by Jason Buck of Custom Business Solutions.
Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,
Overview: 1. Discussion of the basic architecture of a web application. 2. Discussion of the relevance of using MySQL and PHP in a web application.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
Ruby on Rails on Ubuntu Bradley Taylor Rails Machine, LLC
Wordpress with Mina Automated Deployment Solution Jonathan Gravato DIG 4104c.
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
IN THIS LESSON WE WILL REVIEW THE STRUCTURE OF THE INTERNET AND HOW BROWSERS ASSEMBLE WEBSITES BASED ON INSTRUCTIONS THEY RECEIVE FROM SERVERS. Internet.
Modern Development Technologies in SharePoint SHAREPOINT SATURDAY OMAHA APRIL, 2016.
Here are some things you can do while you wait 1.Open your omeka.net site in your browser (e.g. 2.Open.
Windows Azure and iOS Chris Risner Windows Azure Technical Evangelist Microsoft
Cloud Installation & Configuration Management. Outline  Definitions  Tools, “Comparison”  References.
Drupal Basics May 30, 2012 By Sean Fitzpatrick. Sean Fitzpatrick | Welcome We're going to talk about Drupal We're going to keep it pretty.
1 Policy Based Systems Management with Puppet Sean Dague
Know Your GlassFish Gem Jacob Kessler. Overview ● Fast, simple, easy – gem install glassfish – glassfish. ● Everything from GlassFish to serve a Ruby.
GlassFish Gem Vivek Pandey Sun Microsystems, Inc.
CGS 3066: Web Programming and Design Spring 2017
WebSphere Diego Leone.
Agenda:- DevOps Tools Chef Jenkins Puppet Apache Ant Apache Maven Logstash Docker New Relic Gradle Git.
Containers as a Service with Docker to Extend an Open Platform
Top 8 Best Programming Languages To Learn
Dr.S.Sridhar, Director, RVCT, RVCE, Bangalore
ITM352 PHP and Dynamic Web Pages: Server Side Processing 1.
Protecting Memory What is there to protect in memory?
Relational database and SQL MySQL LAMP SQL queries
Play Framework: Introduction
Outline SOAP and Web Services in relation to Distributed Objects
The Transition to Modern Office Add-in Development
Platform as a Service.
Dr.S.Sridhar, Director, RVCT, RVCE, Bangalore
Outline SOAP and Web Services in relation to Distributed Objects
Ruby, Rails, GUIs, and More
PHP / MySQL Introduction
Module 3 Building a web app.
Introduction of Week 3 Assignment Discussion
.NET Debugging for the Production Environment
Making PowerShell Useful
Lecture 1: Multi-tier Architecture Overview
Making PowerShell Useful
Database Software.
Agile testing for web API with Postman
Developing and testing enterprise Java applications
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
UFCEUS-20-2 Web Programming
Web Servers (IIS and Apache)
Mark Quirk Head of Technology Developer & Platform Group
Web Application Development Using PHP
Plug-In Architecture Pattern
Presentation transcript:

Rails Deployment in the Enterprise: Transmitting a Little Experience Robert Postill

What Can He Say About This? Who is this bloke? The end of Java as we know it The Rails you need to know The use of some cool tools Summary Questions Page # 2

Who am I? Solaris SA who crossed over to development Spent time doing Java then Rails Lots of integration projects and then greenfields development Spent a lot of time working with infrastructure departments Page # 3

Windows is badly broken Page # 4

Why Linux? Performance, you will notice the difference (so long as you don't use the Ubuntu-supplied ruby!) Because you can easily get supporting tools (e.g. Apache, Postgres, git) Because some gems require C to be compiled (bless the gcc) Because of the community Page # 5

The end of Java: How we got here When we were young we thought things could be simple: One language could be used for everything Vendors could help We could still be flexible What went wrong? The learning curve :( How expensive is this? This is so slowwww to develop Page # 6

PHP – More harmful than bird flu

The end of Java: What's happening now? Fragmentation Ruby and scripting languages Groovy (JVM variants) PHP Haskell and functional languages Polyglot solutions Web Services become a reality Page # 8

The end of Java: What did we learn? Partitioning our infrastructure Not everyone is our friend Databases are a facade for storage Blowing business logic across the platform is a recipe for disaster Turns out open source rocks :) Page # 9

Rant:Who are we employing? We need to find a question we can answer by saying “employ a small number of smart people” How do we get junior infrastructure guys to become senior guys? Why aren't there patterns for deploying applications? Why is infrastructure so driven by development? Page # 10

So sell me this rails stuff Web Development is quick – my guess is a 3x development speed improvement for a 3 month project Good patterns of development are enforced by being baked into the framework Ruby is a great object-oriented language with a lot of perl-ish goodness Jruby is an excellent gateway drug ;) REST is encouraged Page # 11

REST – I'm Excited! It's an architecture of development conceived by Roy Fielding – one of the founders of the Apache Software Foundation and the HTTP specification RESTful applications try to model themselves on the web, which means: Applications are modeled around resources You can put caches at multiple levels Page # 12

The basics of Rails: Structure Every project is contained in a directory: tmp – holds temporary files log holds logs public – static files like images, CSS and like script – commands for starting and stopping the application config – holds database credentials and performance settings mostly app – the source code lives here Page # 13

The basics of Rails: Deployment Three deployment options: Webrick – I wouldn't with yours :) Mongrel – most analogous to Tomcat, a specialised daemon written in Ruby and C mod_rails/passenger – the new kid on the block. Apache module with some cute tricks in it. My attitude is that Mongrel is the safe option for right now. However mod_rails is shaping up to be ace Page # 14

Pitfalls of Rails Speed of execution: Scaling rails is not going to work the Java way Rails and Ruby are not the answer for large batch operations Rails apps leak memory It's the best AJAX integration that I know of: We haven't had The Great AJAX Security Disaster yet but we will Clients of AJAX applications (I'm looking at you Firefox...) leak memory, lots of it. Page # 15

How slow is Ruby vs Perl? Page # 16

How slow is it? Here's Sun's Widefinder project results: Page # 17

Pitfalls of Rails Speed of execution: Scaling rails is not going to work the Java way Rails and Ruby are not the answer for large batch operations Rails apps leak memory It's the best AJAX integration that I know of: We haven't had The Great AJAX Security Disaster yet but we will Clients of AJAX applications (I'm looking at you Firefox...) leak memory, lots of it. Page # 18

Scaling Rails Rails doesn't need a bigger box it needs another instance (possibly on another box) Rails apps don't share state Databases are slow (especially remote databases) Caching assets Action, page and fragment caching Memcached Indexing engines versus RDBMS Page # 19

Securing Rails Wrapping Rails in your onion: Front Rails with Apache or something else Proxy requests (push for RESTful apps to help with this) config/database.yml stores your db credentials so protect it (maybe move it out of source control?). mod_rewrite can be dangerous Never ever use in_place editor Page # 20

Are we ever going to talk deployment? Page # 21

Deployment Architecture Page # 22

Hang on a minute! Page # 23

Deployment Architecture Page # 24

Deployment Architecture Page # 25

Deployment Tips Deploy to a common location – I like /var/webapps Push towards Postgresql/MySQL they're the most tested drivers Rails apps that use more than 150MB of mem probably need killing Budget on roughly 100MB of memory per process The log directory can get full fast, so use logrotate with a truncate strategy Cache gems on a server, all you need is Apache! Page # 26

Deployment Tools A couple of really helpful deployment aids that come right out of the ruby and rails community: Capistrano – a tool for simultaneous execution of commands on an SSH server Deprec and Sprinkle – tools that use Capistrano as their base. Puppet – a configuration management tool, so cunning you could cast it in Blackadder Page # 27

Puppet, more than just fun... Page # 28

Deployment: Puppet Page # 29 You need a machine for the puppetmaster daemon Each client has a little daemon that talks to the server Puppet works with your OS package management so you use pbuilder or erm the rpm thingy... Puppet allows you to take control of large populations of machines Puppet has files called manifests

Deployment: Puppet - Example Page # 30 class sudo { package { sudo: ensure => latest } file { "/etc/sudoers": owner => root, group => root, mode => 440, source => "puppet:///sudo/sudoers", require => Package["sudo"], }

Deployment: Puppet - Review Page # 31 Upsides: Works in a heterogeneous environment Check out the recipes... nice Puppet makes provision for config of files and apps Puppet works continuously Downsides: There's only one puppetmaster supported. The recipe syntax is not as powerful as it could bez

Deployment: Capistrano Page # 32 Capistrano is closely aligned to Rails, but its use is much broader than that Capistrano applies commands to sets of servers Capistrano also has recipes that it applies The syntax is Ruby-based You can call shell commands and inspect the results

Deployment:Capistrano - Example Page # 33 task :search_libs, :hosts => " do run "ls -x1 /usr/lib | grep -i xml" end task :as_root, :hosts => "r.postill.com" do sudo "useradd robert" end

Deployment:Capistrano - Rails Page # 34 Capistrano was basically developed to deploy rails apps like basecamp and highrise so it knows rails capify will create config/deploy.rb and Capfile in your rails project cap deploy Capistrano will take a copy of what's in your source control and push it onto the server

Deployment: Capistrano - Review Page # 35 Upsides: Knows Rails intimately Is sudo-aware Downsides: Is much more project focussed The documentation is not so good Can be difficult to debug

Touchy Feely Ahoy! Page # 36

Deployment Attitude Stop being a victim of development: Set expectations for metrics like code coverage Make a link between Continuous Integration tools (e.g. CC.rb or Hudson) and deployment. For example don't allow broken builds to be deployed Try and make the deployment an output of the build process. Page # 37

Deployment:Development Interface Get into the habit of being part of the project ceremony. Particularly in XP teams be a part of: Iteration open and close Retrospectives Showcases Stand-ups (for practitioners) Put resources into the development team, in particular: Get a System Admin and DBA in early and don't let them leave Build test environments with load balancers/proxies Page # 38

Where Next? We need to improve post deployment: Dynamic provisioning, can we scale like Amazon? SNMP integration We should assume that the One Language To Rule Them All is a bad idea Ruby needs to stomp on those memory leaks (watch for Ruby 2/1.9/Rubinius) Page # 39

So what do I need to remember? Page # 40

Summary Ruby and Rails are ace :) Try and use a simple three-tier architecture Push the REST ideas, they benefit everyone Use mongrel to host the apps and monit to control the mongrels Use Capistrano or Puppet, to push the Rails apps to production, you'd be mad not to Integrate with the development teams Page # 41

Photo credits All photos courtesy of flickr's creative commons: nathansnostalgia, broken windows, page kaymoshusband, chicken sign, page 8- big loggy missus, sleepy guy, page pt, puppet, page dunechaser, pirate attitude, page tyla75, new year resolutions, page Page # 42

Questions? Page # 43

Links Language comparisons: REST: Puppet: Capistrano: Mongrel: mod_rails/passenger: Monit: Page # 44

Contact I'll be here all week :) But just in case: Page # 45