Home arrow Ruby-on-Rails arrow Installing the Database for Application Deployment
RUBY-ON-RAILS

Installing the Database for Application Deployment


In this second part of a multi-part article series, you'll learn how to install various parts of an application in preparation for deploying it online. This article is excerpted from chapter 12 of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).

Author Info:
By: Apress Publishing
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
August 06, 2010
TABLE OF CONTENTS:
  1. · Installing the Database for Application Deployment
  2. · Module Configuration
  3. · Log File Configuration
  4. · Mime-Type Configuration

print this article
SEARCH DEVARTICLES

Installing the Database for Application Deployment
(Page 1 of 4 )

Installing the Database Server (MySQL) 

In the case of Emporium, the database server is running a single instance of MySQL (http://www.mysql.com). MySQL is claimed to be the world’s most popular open source database. It is a safe choice that is used by many high-traffic websites, including craigslist.com, which serves millions of classified ads a day from a MySQL cluster.

The communication between Ruby on Rails and the database is done through a native MySQL database driver.

You need to install MySQL and the MySQL driver (native) on the production server. We explained how to install these in Chapter 1.

Configuring LightTPD

Configuring LightTPD is straightforward. You can use the template (doc/lighttpd.conf) that is distributed along with the source and customize it to meet your needs.

The configuration file for Emporium’s production environment is shown in Listing 12-1. Save this configuration in$EMPORIUM_PATH/config/lighttpd_production.conf,
w
here$EMPORIUM_PATHis the path to your application.

Listing 12-1. LightTPD Configuration File

server.modules = (
  "mod_rewrite",
  "mod_access",
  "mod_fastcgi",
  "mod_compress",
  "mod_accesslog" )

# Deny access to potentially dangerous files url.access-deny             = ( "~", ".inc" )

# Deny access to URLs matching the specified regexp
# In this case subversion files
$HTTP["url"] =~ "/\.svn/" {
 
url.access-deny = ( "" )
}

# Enable HTTPS/SSL
$SERVER["socket"] == "0.0.0.0:443" {
    ssl.engine = "enable"
    ssl.pemfile = "/u/apps/emporium/current/config/server.pem"
}

# Listen on all network interfaces on port 80
server.port         = 80
server.bind         = "0.0.0.0"
server.pid-file     = "/var/run/lighttpd.pid"

server.document-root        = "/u/apps/emporium/current/public"
server.indexfiles           = ( "index.html", "dispatch.fcgi" )
server.error-handler-404    =  "/dispatch.fcgi"
server.errorlog             = "/var/log/lighttpd/lighttpd_error.log"
server.tag                  =
"Emporium Server 1.0"

server.username            = "lighttpd" server.groupname           = "lighttpd"

accesslog.filename          = "/var/log/lighttpd/lighttpd_access.log"

# Four FastCGI processes running locally
fastcgi.server = ( ".fcgi" =>
    ( "emporium-7000" => ( "host" => "127.0.0.1", "port" => 7000 ) ), 
    ( "emporium-7001" => ( "host" => "127.0.0.1", "port" => 7001 ) ),
    ( "emporium-7002" => ( "host" => "127.0.0.1", "port" => 7002 ) ),
    ( "emporium-7002" => ( "host" => "127.0.0.1", "port" => 7002 ) )
)
include "mimetypes.conf"

The syntax of the configuration file uses the following format:

option = value

Options are usually grouped into modules, such asserver.portandaccesslog.filename. Supported value formats include strings, integers, booleans, arrays, and others.


Note  For more information about the LightTPD configuration file, see the wiki entries on the supported configuration syntax and options, located athttp://trac.lighttpd.net/trac/wiki/Docs%3AConfigurationandhttp://trac.lighttpd.net/trac/wiki/Docs%3AConfigurationOptions, respectively.


Let’s have a closer look at each section of the configuration file.


blog comments powered by Disqus
RUBY-ON-RAILS ARTICLES

- Ruby-on-Rails Faces Second Security Flaw in ...
- Ruby 2.0 Prepped for February 2013 Release
- Why LinkedIn Switched from Ruby on Rails
- Adding Style with Action Pack
- Handling HTML in Templates with Action Pack
- Filters, Controllers and Helpers in Action P...
- Action Pack and Controller Filters
- Action Pack Categories and Events
- Logging Out, Events and Templates with Actio...
- Action Pack Sessions and Architecture
- More on Action Pack Partial Templates
- Action Pack Partial Templates
- Displaying Error Messages with the Action Pa...
- Action Pack Request Parameters
- Creating an Action Pack Registration Form

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials