free ebooks ==> www.ebook777.com www.it-ebooks.info WWW.EBOOK777.COM free ebooks ==> www.ebook777.com www.it-ebooks.info WWW.EBOOK777.COM free ebooks ==> www.ebook777.com What Readers Are Saying About Deploying Rails Deploying Rails will help you transform your deployment process from brittle chaos into something organized, understandable, and repeatable ➤ Trek Glowacki Independent developer Covering such a wide range of useful topics such as deployment, configuration management, and monitoring, in addition to using industry-standard tools following professionally founded best practices, makes this book an indispensable resource for any Rails developer ➤ Mitchell Hashimoto Lead developer, Vagrant Targeted for the developer, Deploying Rails presents, in a clear and easily understandable manner, a bevy of some of the less intuitive techniques it has taken me years to assemble as a professional If you build Rails apps and have ever asked, “Where/how I deploy this?” this book is for you ➤ James Retterer Senior software engineer, Getty Images www.it-ebooks.info WWW.EBOOK777.COM free ebooks ==> www.ebook777.com Deploying Rails Automate, Deploy, Scale, Maintain, and Sleep at Night Anthony Burns Tom Copeland The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina www.it-ebooks.info WWW.EBOOK777.COM free ebooks ==> www.ebook777.com Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trademarks of The Pragmatic Programmers, LLC Every precaution was taken in the preparation of this book However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com The team that produced this book includes: Brian Hogan (editor) Potomac Indexing, LLC (indexer) Kim Wimpsett (copyeditor) David Kelly (typesetter) Janet Furlow (producer) Juliet Benda (rights) Ellie Callahan (support) Copyright © 2012 Pragmatic Programmers, LLC All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher Printed in the United States of America ISBN-13: 978-1-93435-695-1 Encoded using the finest acid-free high-entropy binary digits Book version: P1.0—July, 2012 www.it-ebooks.info WWW.EBOOK777.COM free ebooks ==> www.ebook777.com Contents Preface D l df W ! B k ix Acknowledgments xv Introduction 1.1 Where Do We Host Our Rails Application? 1.2 Building Effective Teams with DevOps 1.3 Learning with MassiveApp 1 Getting Started with Vagrant 2.1 Installing VirtualBox and Vagrant 2.2 Configuring Networks and Multiple Virtual Machines 2.3 Running Multiple VMs 2.4 Where to Go Next 2.5 Conclusion 2.6 For Future Reference 10 18 21 24 25 25 Rails 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 b on Puppet Understanding Puppet Setting Up Puppet Installing Apache with Puppet Configuring MySQL with Puppet Creating the MassiveApp Rails Directory Tree Writing a Passenger Module Managing Multiple Hosts with Puppet Updating the Base Box Where to Go Next Conclusion For Future Reference www.it-ebooks.info WWW.EBOOK777.COM k 27 27 28 33 44 47 50 54 55 56 58 59 m free ebooks ==> www.ebook777.coContents • vi D l df W ! B k Basic Capistrano 4.1 Setting Up Capistrano 4.2 Making It Work 4.3 Setting Up the Deploy 4.4 Pushing a Release 4.5 Exploring Roles, Tasks, and Hooks 4.6 Conclusion 61 62 65 68 69 76 80 Advanced Capistrano 5.1 Deploying Faster by Creating Symlinks in Bulk 5.2 Uploading and Downloading Files 5.3 Restricting Tasks with Roles 5.4 Deploying to Multiple Environments with Multistage 5.5 Capturing and Streaming Remote Command Output 5.6 Running Commands with the Capistrano Shell 5.7 Conclusion 81 81 83 85 87 88 90 93 Monitoring with Nagios 6.1 A MassiveApp to Monitor 6.2 Writing a Nagios Puppet Module 6.3 Monitoring Concepts in Nagios 6.4 Monitoring Local Resources 6.5 Monitoring Services 6.6 Monitoring Applications 6.7 Where to Go Next 6.8 Conclusion 6.9 For Future Reference 95 96 98 105 106 110 121 125 126 127 Collecting Metrics with Ganglia 7.1 Setting Up a Metrics VM 7.2 Writing a Ganglia Puppet Module 7.3 Using Ganglia Plugins 7.4 Gathering Metrics with a Custom Gmetric Plugin 7.5 Producing Metrics with Ruby 7.6 Where to Go Next 7.7 Conclusion 7.8 For Future Reference 129 130 131 140 143 146 148 149 150 Maintaining the Application 8.1 Managing Logs 8.2 Archiving Application Data 153 153 158 b www.it-ebooks.info WWW.EBOOK777.COM k ebooks ==> www.ebook777.com free vii • Contents 8.3 8.4 D l df W ! B k Organizing Backups and Configuring MySQL Failover Making Downtime Better Running Rubies with RVM 9.1 Installing RVM 9.2 Serving Applications with Passenger Standalone 9.3 Using Systemwide RVM 9.4 Watching Passenger Standalone with Monit 9.5 Contrasting Gemsets and Bundler 9.6 Conclusion 160 169 173 174 177 180 182 184 184 10 Special Topics 10.1 Managing Crontab with Whenever 10.2 Backing Up Everything 10.3 Using Ruby Enterprise Edition 10.4 Securing sshd 10.5 Conclusion 185 185 188 193 196 197 A1 A Capistrano Case Study A1.1 Requires and Variables A1.2 Hooks and Tasks 199 199 201 A2 Running on Unicorn and nginx A2.1 Installing and Configuring nginx A2.2 Running MassiveApp on Unicorn A2.3 Deploying to nginx and Unicorn A2.4 Where to Go Next 205 206 208 209 210 Bibliography 213 Index 215 b www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Preface Ruby on Rails has taken the web application development world by storm Those of us who have been writing web apps for a few years remember the good ol’ days when the leading contenders for web programming languages were PHP and Java, with Perl, Smalltalk, and even C++ as fringe choices Either PHP or Java could get the job done, but millions of lines of legacy code attest to the difficulty of using either of those languages to deliver solid web applications that are easy to evolve But Ruby on Rails changed all that Now thousands of developers around the world are writing and delivering high-quality web applications on a regular basis Lots of people are programming in Ruby And there are plenty of books, screencasts, and tutorials for almost every aspect of bringing a Rails application into being We say “almost every aspect” because there’s one crucial area in which Rails applications are not necessarily a joy; that area is deployment The most elegant Rails application can be crippled by runtime environment issues that make adding new servers an adventure, unexpected downtime a regularity, scaling a difficult task, and frustration a constant Good tools exist for deploying, running, monitoring, and measuring Rails applications, but pulling them together into a coherent whole is no small effort In a sense, we as Rails developers are spoiled Since Rails has such excellent conventions and practices, we expect deploying and running a Rails application to be a similarly smooth and easy path And while there are a few standard components for which most Rails developers will reach when rolling out a new application, there are still plenty of choices to make and decisions that can affect an application’s stability And that’s why we’ve written this book After several years of full-time consulting for companies that were writing and fielding Rails applications, we’ve learned a few things about running busy Rails applications in production environments Throughout this book we’ll explore various aspects of deploying D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k t t di x free ebooks ==> www.ebook777.com • Preface Rails applications, and we’ll review and apply the practices and tools that helped us keep our consulting clients happy by making their Rails applications reliable, predictable, and, generally speaking, successful When you finish reading this book, you’ll have a firm grasp on what’s needed to deploy your application and keep it running You’ll also pick up valuable techniques and principles for constructing a production environment that watches for impending problems and alerts you before things go wrong Who Should Read This Book? This book is for Rails developers who, while comfortable with coding in Ruby and using Rails conventions and best practices, may be less sure of how to get a completed Rails application deployed and running on a server Just as you learned the Rails conventions for structuring an application’s code using REST and MVC, you’ll now learn how to keep your application faithfully serving hits, how to know when your application needs more capacity, and how to add new resources in a repeatable and efficient manner so you can get back to adding features and fixing bugs This book is also for system administrators who are running a Rails application in production for the first time or for those who have a Rails application or two up and running but would like to improve the runtime environment You probably already have solid monitoring and metrics systems; this book will help you monitor and measure the important parts of your Rails applications In addition, you may be familiar with Puppet, the open source system provisioning tool If so, by the end of this book you’ll have a firm grasp on using Puppet, and you’ll have a solid set of Puppet manifests Even if you’re already using Puppet, you may pick up a trick or two from the manifests that we’ve compiled Finally, this book is for project managers who are overseeing a project where the primary deliverable is a Rails application that performs some business functionality You can use the major sections in this book as a checklist There’s a chapter on monitoring; what kind of monitoring is being done on your application, and what kind of situations might occur where would you like to trigger some sort of alert? There’s a chapter on metrics; what kind of charts and graphs would best tell you how the application is meeting the business’s needs? If your application has some basic story for each chapter in this book, you’ll know that you’re covering the fundamentals of a solid Rails application environment D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k t t di 208 free ebooks ==> www.ebook777.com • Appendix Running on Unicorn and nginx proxy_pass http://massiveapp; } } That’s our nginx configuration A quick sudo /etc/init.d/nginx restart, and nginx is ready to go Now we’ll look at the changes necessary to run MassiveApp on Unicorn A2.2 Running MassiveApp on Unicorn Getting Unicorn running requires that we make a few changes to the MassiveApp codebase to accommodate it; to summarize, we’ll be referencing Unicorn in the Gemfile, adding a Unicorn configuration file, and modifying the Capistrano configuration We cloned the MassiveApp Git repository in Section 1.3, Learning with MassiveApp, on page 7, so we’ll move into that directory $ cd ~/deployingrails/massiveapp/ We’ve built a with_unicorn branch containing all the changes in this chapter If you’d like to use that branch, just check it out with git checkout track with_unicorn; if not, just add the changes as we describe them Unicorn is delivered as a RubyGem, so we’ll add an entry to the Gemfile gem 'unicorn' We’ll need to run bundle to get that gem installed, of course Next, we need to tell Unicorn how to run MassiveApp; that configuration goes in config/unicorn.rb The Unicorn project has excellent notes4 on this configuration file, but most of the settings are just telling Unicorn where MassiveApp lives, where to log, and so forth One interesting part is the before_fork hook, which is called for each worker and allows new workers to shut down old workers unicornnginx/config/unicorn.rb worker_processes working_directory "/var/massiveapp/current" # available in 0.94.0+ listen "/tmp/.sock", :backlog => 64 timeout 30 pid "/var/massiveapp/shared/pids/unicorn.pid" stderr_path "/var/massiveapp/shared/log/unicorn.stderr.log" stdout_path "/var/massiveapp/shared/log/unicorn.stdout.log" preload_app true GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_fork |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! D l df W ! B https://github.com/defunkt/unicorn/blob/master/examples/unicorn.conf.rb k b www.it-ebooks.info WWW.EBOOK777.COM k t t di k777.com free ebooks ==> www.eboo Deploying to nginx and Unicorn • 209 old_pid = "#{server.config[:pid]}.oldbin" if old_pid != server.pid begin sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU Process.kill(sig, File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH end end end after_fork |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end That’s it for application-specific configuration Now we’ll configure Capistrano to deploy Unicorn A2.3 Deploying to nginx and Unicorn We’ve set up nginx to pass requests to MassiveApp, and we’ve configured MassiveApp to run inside Unicorn Now we’ll modify our Capistrano configuration to deploy MassiveApp to Unicorn rather than Passenger We’ll add just one line to config/deploy.rb set :bundle_cmd, "/usr/local/bin/bundle" More significantly, we’ll delete the Passenger-related task definitions; deploy:start, deploy:stop, and deploy:restart can all be removed With those gone, we can add replacement tasks in lib/deploy/unicorn.rb The new deploy:start task runs Unicorn in the context of MassiveApp and ensures it uses the configuration we added in the previous section The deploy:stop task uses the process ID to kill the Unicorn master process Lastly, the deploy:restart task sends a USR2 signal to Unicorn; when combined with the before_fork that we added to config/unicorn.rb, this enables a zero downtime deployment unicornnginx/lib/deploy/unicorn.rb set :unicorn_config, "#{current_path}/config/unicorn.rb" set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" namespace :deploy task :start, :roles => :app, :except => { :no_release => true } run "cd #{current_path} \ && #{bundle_cmd} exec unicorn -c #{unicorn_config} -E #{rails_env} -D" end task :stop, :roles => :app, :except => { :no_release => true } run "#{try_sudo} kill `cat #{unicorn_pid}`" end D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k t t di 210 free ebooks ==> www.ebook777.com • Appendix Running on Unicorn and nginx task :restart, :roles => :app, :except => { :no_release => true } run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`" end end With those changes in place, we can plunge ahead and deploy MassiveApp We’ll assume that the VM has been provisioned with the Puppet scripts that we’ve prepped in previous chapters, so we can get MassiveApps in place by running the usual tasks $ cap deploy:setup «lots of output» $ cap deploy:cold «lots of output» * executing `deploy:start' * executing "cd /var/massiveapp/current && /usr/local/bin/bundle exec unicorn -c /var/massiveapp/current/config/unicorn.rb -E production -D" servers: ["localhost"] [localhost] executing command [localhost] sh -c 'cd /var/massiveapp/current && /usr/local/bin/bundle exec unicorn -c /var/massiveapp/current/config/unicorn.rb -E production -D' command finished in 1954ms Now we can browse to localhost:4567 and see MassiveApp up and running Subsequent deploys will have slightly different output because they’ll use our deploy:restart task $ cap deploy «lots of output» * executing "kill -s USR2 `cat /var/massiveapp/current/tmp/pids/unicorn.pid`" servers: ["localhost"] [localhost] executing command [localhost] sh -c 'kill -s USR2 `cat /var/massiveapp/current/tmp/pids/unicorn.pid`' command finished in 5ms And there we have it—an end-to-end deployment using Unicorn and nginx A2.4 Where to Go Next In Section 9.2, Serving Applications with Passenger Standalone, on page 177, we discussed Passenger Standalone and how it uses a combination of nginx and Passenger to serve applications We applied it in the context of running multiple Ruby versions on a server, but using nginx as a front-end server for any Rails application is a useful option Even a somewhat old-school cluster D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k t t di 7.com free ebooks ==> www.ebook77Where to Go Next • 211 of Mongrel instances could be placed behind an nginx process to improve performance and scalability Once a team has some collective knowledge of how to operate and tune nginx, it’s worth a look around to see whether there are other places where it can be employed For example, we’ve seen nginx used effectively as a front-end server in place of a more traditional HTTP load balancer like haproxy.5 In this scenario, an nginx upstream can be pointed to any number of back-end application servers Each back-end server can be configured with a weight to send more traffic to the more capable servers, a maximum number of failures can be set before a server is taken out of the loop, and various other useful loadbalancing parameters are available nginx can even serve as an SSL decryption layer to offload the SSL handshake computations from application servers The combination of nginx and Unicorn is an interesting alternative to Apache and Passenger It’s certainly worth a look if you don’t have a lot of experience with Apache or if you’re running into any Apache/Passenger-related problems D l df W ! B k http://haproxy.1wt.eu/ b www.it-ebooks.info WWW.EBOOK777.COM k t t di free ebooks ==> www.ebook777.com Bibliography D l df W ! B k [Bar08] Wolfgang Barth Nagios: System and Network Monitoring No Starch Press, San Francisco, CA, 2nd, 2008 [Koc08] Wojciech Kocjan Learning Nagios 3.0 Packt Publishing, Birmingham, UK, 2008 b www.it-ebooks.info WWW.EBOOK777.COM k t t di free ebooks ==> www.ebook777.com Index D l df W ! B k A B Amazon EC2, 3, Apache configuration files, 36– 38, 41–43 configuring for Ganglia, 133 configuring for Nagios, 100–101 configuring for Passenger, 51–53, 60 configuring for REE, 194 htpasswd, 100 installing with Puppet, 33–44, 59 log rotation, 154–155 piped log rotation, 155– 156 Apache Tomcat, 202 application failover, 161, 165– 166 application hosting, 1–5 application maintenance data archiving, 158–160 data backups, 160–161, 167–168, 188–192 data loss, 168–169 database migrations, 74 downtime, 169–171 log management, 153– 158 release deployment, 75, 210 application metrics, 143–148 application monitoring, 121– 124, 128 automation philosophy, 6–7 Backup utility automating backups, 192 copying to remote server, 190–191 encrypting backups, 191– 192 installing, 188 MySQL database backups, 188–190 base boxes (Vagrant), 16–18 Bundler installing Capistrano, 63 installing with Puppet, 49 and mysql2 gem, 64 vs RVM gemsets, 184 b C Capfile, 64 capify, 64 Capistrano application failover, 166 Capistrano shell, 90–93 Capistrano::CLI, 78 $CAPISTRANO:HOST$, 84 capture method, 89 command-line utility, 63 copy strategy, 66–67 creating deployment configurations, 65–67 database migrations, 74 deployment hooks, 77–79 file uploads/downloads, 83–85 hooks from Whenever utility, 186 JRuby case study, 199– 203 multistage deployment, 87–88 pushing a release, 69–75 put method, 84 recipes, 64 remote commands, 88–93 roles, 66, 77, 79–80, 85– 86 setting up, 62–65 ssh key pairs, 62, 200 ssh port forwarding, 66 stream method, 90 subdirectory setup, 68– 69 symlinks in bulk, 81–83 tasks, 67, 76–77 timestamped filenames, 71 Unicorn deployment, 209 variables, 65–67 wiki, 77 Chef, 29 cloud hosting, 3–4 config.vm.customize, 19, 25 config/deploy.rb, 65–67 copy_exclude, 201 cron jobs data archiving, 159–160 log rotation, 158 managing with Whenever, 185–188 metrics gathering, 142– 143 D data archiving, 158–160 data backups, 160–161, 167– 168, 188–192 data loss, 168–169 database, see MySQL deploy, 75 www.it-ebooks.info WWW.EBOOK777.COM k ebooks ==> www.ebook777.com free 216 • Index deploy:cold, 69–75 L deploy:setup, 68–69 load balancing, 211 log management, 153–158 deploy:symlink override, 81–83 DevOps, 5–7 downtime planning, 169–171 E Engine Yard, F facter utility, 30 failover, 161, 165–166 G Ganglia Apache configuration, 133 clusters, 134, 139 configuration files, 134– 137 custom metrics with Ruby, 146–148 integration with Nagios, 148 plugins, 140–146 Puppet module for, 131– 140 reasons for selecting, 129 remote host monitoring, 138–143 Vagrant setup for, 130– 131 web interface, 137–138 Ganglia plugin repository, 140 gmetad daemon, 132–133, 135, 151 gmetric scripts, 140–146, 151 gmond daemon, 131, 133, 135, 139, 150 H Heroku, 2–3 hooks (Capistrano), 77–79, 201–202 hosting alternatives buying servers, cloud hosting, 3–4 outsourcing, 1–3 renting servers, J JRuby application deployment, 199–203 D l df W ! B k b M manifests (Puppet), 27 Apache example, 33–44, 59 MySQL example, 44–47 MassiveApp, see also application maintenance; application metrics; application monitoring deploying with Capistrano, 64–67, 69–75 Git repositories, setup, 47–50 metaparameters, 42 modules (Puppet), 38–41 Mongrel, 205, 211 Monit, 182–184 monitoring concepts, 95, 105–106 monitoring vs metrics, 129 multistage deployment, 87–88 Murder deployment tool, 80 MySQL archiving records, 159– 160 configuring with Puppet, 44–47 database backups, 167– 168, 188–192 failover setup, 162–165 gmetric scripts for, 141 native extension and Bundler, 64 replication slaves, 162– 165 restoring data, 168–169 mysqldump, 167–168 N Nagios Apache configuration, 100–101 browser interface, 102, 125 checking Passenger, 117– 121 checking Rails, 128 checks, 100 concepts and terminology, 105–106 configuration files, 107– 108 defining new commands, 121 file management with Puppet, 108–109 immediate checks, 102– 105 inheritance, 107 integration with Ganglia, 148 monitoring applications, 121–124, 128 monitoring database backups, 168 monitoring local resources, 106–110 monitoring Nagios server, 107 monitoring remote services, 110–121 notification strategies, 125 NRPE plugin, 112–115 object definitions, 107– 108, 127–128 Puppet module for, 98– 105 reasons for choosing, 95– 96 Vagrant setup for, 96–97 Nagios Exchange, 126 nginx, 205–211 configuring, 206–208 installing, 206 for load balancing, 211 nonblocking architecture, 205 and Passenger Standalone, 177, 179 nodes (Puppet), 54 NRPE installing, 112–115 monitoring application servers, 115–116 monitoring memcached, 116–117 monitoring Passenger, 117–121 O Oracle VirtualBox, see VirtualBox P Pacemaker, 161 Passenger installing with Puppet, 50–54 www.it-ebooks.info WWW.EBOOK777.COM k m free ebooks ==> www.ebook777.coIndex • 217 monitoring with Nagios, 117–121 Standalone monitoring and restarting, 182– 184 Standalone setup, 177– 180 performance Capistrano overhead, 82 load balancing, 211 nginx nonblocking architecture, 205 Ruby Enterprise Edition, 193–196 server metrics, 129, 131– 138 shared hosting, Unicorn vs Passenger, 205 VM, Pingdom, 107 port forwarding, 15, 20, 43, 177 public key authentication, 15, 62, 196–197 Puppet apply subcommand, 32 vs Chef, 29 classes, 39 command-line utility, 32 configuration language, 57 dependencies, 41 describe subcommand, 34, 42 environments, 57 file management, 36–38 flow control, 57 help, 32 installing, 30–32 manifests, 27 meta option, 42 metaparameters, 42 modules, 38–41 multiple hosts, 54 nodes, 54 noop option, 37 package management, 34–35 pre-install setup, 28 resource declarations, 34–36 Ruby gems, 49 stages, 57 subcommands, 32 verbose option, 33 Puppet Dashboard, 57 D l df W ! B k b PuppetForge, 58 PuppetMaster, 57 shared hosting, 1–2 ssh and Capistrano overhead, 82 key pairs, 15, 62, 196– 197 monitoring, 110–112 port forwarding, 66 securing sshd, 196–197 ssh_options, 200 R Rackspace Cloud, 3, Rails application log rotation, 156–158 building directory tree in Puppet, 47–49 checking, with Nagios, 128 precompiling static assets, 73 Rake db:create vs Puppet, 45 monitoring application data thresholds, 122– 123, 128 Redis, 85 release deployment, 75, 210 rmc wrapper, 182 roles (Capistrano) defining, 79, 85–86 predefined, 66, 80 ROLES environment variable, 80, 86 in tasks, 77, 80, 85–86, 199 Rubinius, 181 Ruby custom metrics for Ganglia, 146–148 installing gems in Puppet, 49 multiple versions, 175– 177 multiple versions in Passenger, 177–180 updating in Vagrant base box, 16–18 Ruby Enterprise Edition (REE) installing, 193–194 tuning, 195–196 RVM (Ruby enVironment Manager), 173 installing, 174 systemwide installation, 180–182 usage, 174–177 rvmrc files, 176–177 S server metrics, 129, 131–138 server monitoring, 95–121 T Trinidad, 202 U Ubuntu, 12 Unicorn, 205–211 configuring, 208–209 installing, 208 V Vagrant box index, 12 bridged networking, 24 configuring networks, 19– 20 creating a VM, 12–15 customizing VMs, 16–19, 25 Ganglia setup, 130–131 installing, 11 managing VMs, 15 multiple VMs, 21–24 MySQL failover setup, 162 Nagios setup, 96–97 port forwarding, 15, 20, 43 including Puppet, 55–56 setting VirtualBox options, 19 sharing folders, 20 ssh key pairs, 15 virtual private servers, VirtualBox guest additions, 14 installing, 10 setting options in Vagrant, 19 VM naming, 22 VM outsourcing, 3–4, VM tools, 10–24 W Whenever, 185–188 automating backups, 192 www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Go Beyond with Rails and JRuby There’s so much new to learn with Rails and deploying on the Java VM These titles will get you up to speed on the latest Thousands of developers have used the first edition of Rails Recipes to solve the hard problems Now, five years later, it’s time for the Rails 3.1 edition of this trusted collection of solutions, completely revised by Rails master Chad Fowler Chad Fowler (350 pages) ISBN: 9781934356777 $35 http://pragprog.com/titles/rr2 Deploy using the JVM’s high performance while building your apps in the language you love JRuby is a fast, scalable, and powerful JVM language with all the benefits of a traditional Ruby environment See how to consolidate the many moving parts of an MRIbased Ruby deployment onto a single JVM process You’ll learn how to port a Rails application to JRuby, get it into production, and keep it running Joe Kutner (224 pages) ISBN: 9781934356975 $33 http://pragprog.com/titles/jkdepj D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Welcome to the New Web You need a better JavaScript and more expressive CSS and HTML today Start here CoffeeScript is JavaScript done right It provides all of JavaScript’s functionality wrapped in a cleaner, more succinct syntax In the first book on this exciting new language, CoffeeScript guru Trevor Burnham shows you how to hold onto all the power and flexibility of JavaScript while writing clearer, cleaner, and safer code Trevor Burnham (160 pages) ISBN: 9781934356784 $29 http://pragprog.com/titles/tbcoffee CSS is fundamental to the web, but it’s a basic language and lacks many features Sass is just like CSS, but with a whole lot of extra power so you can get more done, more quickly Build better web pages today with Pragmatic Guide to Sass These concise, easy-to-digest tips and techniques are the shortcuts experienced CSS developers need to start developing in Sass today Hampton Catlin and Michael Lintorn Catlin (128 pages) ISBN: 9781934356845 $25 http://pragprog.com/titles/pg_sass D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Pragmatic Guide Series Get started quickly, with a minimum of fuss and hand-holding The Pragmatic Guide Series features convenient, task-oriented two-page spreads You’ll find what you need fast, and get on with your work Need to learn how to wrap your head around Git, but don’t need a lot of hand holding? Grab this book if you’re new to Git, not to the world of programming Git tasks displayed on two-page spreads provide all the context you need, without the extra fluff NEW: Part of the new Pragmatic Guide series Travis Swicegood (160 pages) ISBN: 9781934356722 $25 http://pragprog.com/titles/pg_git JavaScript is everywhere It’s a key component of today’s Web—a powerful, dynamic language with a rich ecosystem of professional-grade development tools, infrastructures, frameworks, and toolkits This book will get you up to speed quickly and painlessly with the 35 key JavaScript tasks you need to know NEW: Part of the new Pragmatic Guide series Christophe Porteneuve (160 pages) ISBN: 9781934356678 $25 http://pragprog.com/titles/pg_js D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Testing is only the beginning Start with Test Driven Development, Domain Driven Design, and Acceptance Test Driven Planning in Ruby Then add Cucumber and friends for the ultimate in Ruby and Rails development Behaviour-Driven Development (BDD) gives you the best of Test Driven Development, Domain Driven Design, and Acceptance Test Driven Planning techniques, so you can create better software with self-documenting, executable tests that bring users and developers together with a common language Get the most out of BDD in Ruby with The RSpec Book, written by the lead developer of RSpec, David Chelimsky David Chelimsky, Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North (448 pages) ISBN: 9781934356371 $38.95 http://pragprog.com/titles/achbd Your customers want rock-solid, bug-free software that does exactly what they expect it to Yet they can’t always articulate their ideas clearly enough for you to turn them into code The Cucumber Book dives straight into the core of the problem: communication between people Cucumber saves the day; it’s a testing, communication, and requirements tool – all rolled into one Matt Wynne and Aslak Hellesøy (250 pages) ISBN: 9781934356807 $30 http://pragprog.com/titles/hwcuc D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Advanced Ruby and Rails What used to be the realm of experts is fast becoming the stuff of day-to-day development Jump to the head of the class in Ruby and Rails Rails is a huge step forward You can now easily extend the framework, change its behavior, and replace whole components to bend it to your will, all without messy hacks This pioneering book is the first resource that deep dives into the new Rails APIs and shows you how to use them to write better web applications and make your day-to-day work with Rails more productive José Valim (184 pages) ISBN: 9781934356739 $33 http://pragprog.com/titles/jvrails As a Ruby programmer, you already know how much fun it is Now see how to unleash its power, digging under the surface and exploring the language’s most advanced features: a collection of techniques and tricks known as metaprogramming Once the domain of expert Rubyists, metaprogramming is now accessible to programmers of all levels—from beginner to expert Metaprogramming Ruby explains metaprogramming concepts in a down-to-earth style and arms you with a practical toolbox that will help you write great Ruby code Paolo Perrotta (296 pages) ISBN: 9781934356470 $32.95 http://pragprog.com/titles/ppmetr D l df W ! B k b www.it-ebooks.info WWW.EBOOK777.COM k free ebooks ==> www.ebook777.com Learn a New Language This Year Want to be a better programmer? Each new programming language you learn teaches you something new about computing Come see what you’re missing in new languages and the latest crop of NoSQL databases You should learn a programming language every year, as recommended by The Pragmatic Programmer But if one per year is good, how about Seven Languages in Seven Weeks? In this book you’ll get a hands-on tour of Clojure, Haskell, Io, Prolog, Scala, Erlang, and Ruby Whether or not your favorite language is on that list, you’ll broaden your perspective of programming by examining these languages side-by-side You’ll learn something new from each, and best of all, you’ll learn how to learn a language quickly Bruce A Tate (328 pages) ISBN: 9781934356593 $34.95 http://pragprog.com/titles/btlang Data is getting bigger and more complex by the day, and so are your choices in handling it From traditional RDBMS to newer NoSQL approaches, Seven Databases in Seven Weeks takes you on a tour of some of the hottest open source databases today In the tradition of Bruce A Tate’s Seven Languages in Seven Weeks, this book goes beyond a basic tutorial to explore the essential concepts at the core of each technology Eric Redmond and Jim Wilson (330 pages) ISBN: 9781934356920 $35 http://pragprog.com/titles/rwdata www.it-ebooks.info WWW.EBOOK777.COM free ebooks ==> www.ebook777.com The Pragmatic Bookshelf The Pragmatic Bookshelf features books written by developers for developers The titles continue the well-known Pragmatic Programmer style and continue to garner awards and rave reviews As development gets more and more difficult, the Pragmatic Programmers will be there with more titles and products to help you stay on top of your game Visit Us Online This Book’s Home Page http://pragprog.com/titles/cbdepra Source code from this book, errata, and other resources Come give us feedback, too! Register for Updates http://pragprog.com/updates Be notified when updates and new books become available Join the Community http://pragprog.com/community Read our weblogs, join our online discussions, participate in our mailing list, interact with our wiki, and benefit from the experience of other Pragmatic Programmers New and Noteworthy http://pragprog.com/news Check out the latest pragmatic developments, new titles and other offerings Buy the Book If you liked this eBook, perhaps you'd like to have a paper copy of the book It's available for purchase at our store: http://pragprog.com/titles/cbdepra Contact Us Online Orders: http://pragprog.com/catalog Customer Service: support@pragprog.com International Rights: translations@pragprog.com Academic Use: academic@pragprog.com Write for Us: http://pragprog.com/write-for-us Or Call: +1 800-699-7764 www.it-ebooks.info WWW.EBOOK777.COM ... we’ll create a deployingrails directory and move into it $ mkdir ~/deployingrails $ cd ~/deployingrails Now we can clone both repositories $ git clone git://github.com/deployingrails/massiveapp.git... for deploying, running, monitoring, and measuring Rails applications, but pulling them together into a coherent whole is no small effort In a sense, we as Rails developers are spoiled Since Rails. .. that we think would be interesting to folks who are deploying Rails applications You can also follow us on Twitter at http://twitter.com/ deployingrails/ The code examples in this book are organized