Section 5.4. Software Deployment

5.4. Software Deployment

Every operating system has different ways to deploy software, even different versions of the same operating system. Some have a choice between source build and package management. Commercial systems have restrictions on what is an approved software package and version and installing anything else means you don't get support.

Because of this, it's not really possible for us to explain how to install the software on your system. We'll give you the main components that belong on each machine, and leave it to you to make sure they get installed correctly.[6] We'll also include some common problems people run into when they install each component.

[6] One interesting thing to try in a heterogenous environment is the NetBSD pkgsrc. Their source builds work on nearly any POSIX system and don't interfere with your package system. You can get the exact same software installed on all systems even if they are different, and most of the software is current.

5.4.1. web1 (Apache)

  • Apache 2.2.x You need this more recent version of Apache so you can get the new faster and more capable mod_proxy_balancer. There was a defect in the 2.2.2 version of Apache that caused the proxy code to fail in some cases, so make sure your version is either higher numbered or doesn't have this problem. Our example in Section 4 uses 2.2.3.

  • Apache 2.0.x (alternative) Some operations departments do not allow the latest bleeding edge. The problem is that Apache versions before 2.2.x had a slow mod_proxy, which didn't support multiple backends. The alternative is to install Apache 2.0.x on the web1 machine, and then Balance on the app1 machine.

Once Apache is installed you'll want to make sure it's part of your system's boot process, that you can start/stop it, and that it's accessible on port 80. If you need SSL, then take the time to learn how to configure this and get your certificate as well. We won't be covering SSL configuration in this short cut.

5.4.2. app1 (Mongrel)

  • Ruby Make sure you include all tools necessary to build C extensions. For example, Debian requires build-essentials and several Ruby-related libraries.

  • RubyGems Some systems are now including this, but most people seem to install RubyGems from source download. You can get it from RubyForge

  • Rails This is pretty easy with RubyGems, but systems are now also installing it through the package management.

  • Mongrel You of course need Mongrel, and there are also some systems that package it, so you may be in luck.

  • libmysqlclient You'll need to install whatever your OS calls the MySQL client libraries. Many times it's easier to just install MySQL (disk is cheap).

  • mysql gem You'll need the Ruby library from RubyGems to talk to MySQL, which also means you'll need the client libraries on the app1 box. This is best installed using gem install mysql rather than your package system.

  • balance (alternative) If you are forced to use Apache 2.0.x, then you'll need to put balance on this machine. Balance simply takes TCP/IP connections to one port and proxies them to a set of backend ports. It's fast and relatively easy to set up.

This is in addition to any software you need to get your Rails application working. My recommendation is that you install only the bare minimum to get a simple test Rails application working. Only after everything is configured and running well should you install your main application.

We typically install Ruby using the OS package system and then RubyGems if it is available. After that we install everything else using gem install. Depending on your purity you may try to install everything through your system's packages or mix it up like we do.

5.4.3. db1 (MySQL)

Obviously you'll want to install MySQL on the db1 machine and configure it properly. Hopefully you've been using MySQL this whole time and doing an install is second nature to you. It might be difficult to configure MySQL for production without some prior knowledge, but ask around for a consultant to help you out. There are also a few good books you can use as a reference.

We have to confess, though, that we usually install Webmin or phpMyAdmin to manage the MySQL server. System administrators who are die-hard script junkies hate these tools, but they encapsulate many system management best practices and can help someone who has limited system administration experience. Consider installing Webmin if you need to administer a machine and don't have much time to monkey around with configuration files. An additional advantage of Webmin is that you can cluster your management and manage a fairly large group of machines from one primary machine.

5.4.4. All Boxes

  • Ruby If you are looking to do Capistrano management of all three boxes, then you'll need Ruby on all three. Capistrano is super good stuff, so you'll want to make this leap very soon.

Mongrel. Serving, Deploying, and Extending Your Ruby Applications
Mongrel. Serving, Deploying, and Extending Your Ruby Applications
ISBN: 9812836357
Year: 2006
Pages: 48 © 2008-2017.
If you may any questions please contact us: