Deploying rails application on the Internet

I use Apache, Mongrel and Capistrano.

When I execute cap deploy it works fine.
I have 2 Mongrel server running on the port 8000 et 8001.

Well, I have an important question now. I want get my rails
application up
on the Internet. The server herd is a web server. I have installed
ruby and friends on the server.

This is a file, which I have created, in the folder sites-available of
Apache on the server. This site is activated.

<VirtualHost *>
ServerName herd.ida.liu.se
DocumentRoot /var/www/CoreSong/current/public

<Directory “/var/www/CoreSong/current/public”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
Allow from localhost

RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -f
RewriteRule (.*) $1 [L]

ProxyPass / balancer://mongrel_cluster/
ProxyPassReverse / balancer://mongrel_cluster/

Deflate

AddOutputFilterByType DEFLATE text/html text/plain text/xml
application/xml application/xhtml+xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

ErrorLog /var/log/apache2/error.coresong.log
CustomLog /var/log/apache2/access.coresong.log combined

Here is my deploy.rb file :

require ‘mongrel_cluster/recipes’

set :user, “root”
set :application, “CoreSong”
set :repository, “https://herd.ida.liu.se/svn/hcs/CoreSong

If you aren’t deploying to /u/apps/#{application} on the target

servers (which is the default), you can specify the actual location

via the :deploy_to variable:

set :deploy_to, “/var/www/#{application}”

If you aren’t using Subversion to manage your source code, specify

your SCM below:

set :scm, :subversion
set :deploy_via, :export
set :use_sudo, false

ssh_options[:port] = 22

role :app, “herd.ida.liu.se”
role :web, “herd.ida.liu.se”
role :db, “herd.ida.liu.se”, :primary => true

set :svn_username, “s08nicma”
set :svn_password, “xxxxxx”

set :mongrel_conf, “#{deploy_to}/current/config/mongrel_cluster.yml”
set :runner, “root”

And here my mongrel_cluster.yml :

cwd: /var/www/CoreSong/current
log_file: log/mongrel.log
port: “8000”
environment: production
address: 127.0.0.1
pid_file: /var/www/CoreSong/shared/pids/mongrel.pid
servers: 2

This configuration is good to get up the application on the Internet
or I have forgotten something ?
If this is good, what is the URL to test the web application from any
machine ?

Thank you in advance for your help, which is very precious for a
beginner like me ! :slight_smile:

Nicolas

hi nicolas

<VirtualHost :80>
ServerName herd.ida.liu.se

<Proxy balancer://mongrels1>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all

This allows you to manage the balancer-manager via the web

<Location /balancer-manager>
SetHandler balancer-manager

RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -f
RewriteRule (.*) $1 [L]

Deflate

AddOutputFilterByType DEFLATE text/html text/plain text/xml
application/xml application/xhtml+xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

ProxyPass / balancer://mongrel_cluster/
ProxyPassReverse / balancer://mongrel_cluster/
ErrorLog /var/log/apache2/error.coresong.log
CustomLog /var/log/apache2/access.coresong.log combined

by using this file in the folder sites-available of Apache. Then you can
type your server name itself in the url for viewing.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs