Deploying for dummies

I’m kinda newb when it comes to apache. I’ve been tasked with
creating a website to manage some local web applications. This site
will be running just on our local LAN (it will never be accessed
from outside this LAN). We have Kubuntu 7.10 running on this machine
and need a setup that enables us to do the following:

  1. Root website - http://ip.address.of.machine
    A basic web page that will have links to different web applications
    that we will create
  2. Rails app 1 - http://ip.address.of.machine/railsapp1
    A Rails app
  3. Rails app 2 - http://ip.address.of.machine/railsapp2
    Another Rails app
  4. Django app 1 - http://ip.address.of.machine/djangoapp1
    A Django app

The URLs I have denoted are what I envision, although in reality I
guess they could (should?) be different (http://railsapp1,
http://djangoapp1,
etc.) Initially, I don’t think I’ll need a mongrel_cluster or
anything of the like, chances are at most 10 people could be accessing
these apps at once, and in reality probably no more than 2-4 at any
given time.

Again, I’m a complete newb when it comes to apache config files
( and the like). I can find gobs of howto’s on deploying
1 app or the other, but not for the custom setup I have described
above. If I need to break down and buy an Apache book and spend a
month or two learning, I guess I can.

On Feb 11, 2008 8:46 AM, Reacher [email protected] wrote:

The URLs I have denoted are what I envision, although in reality I
guess they could (should?) be different (http://railsapp1, http://djangoapp1,

should. For both your users’ sake, and in case you want/need to
move an app to another machine.

Again, I’m a complete newb when it comes to apache config files
( and the like). I can find gobs of howto’s on deploying
1 app

OK, deploy one. Test. Deploy second app. Test. Deploy… :slight_smile:

Seriously, there’s not that much to configuring a mod_proxy setup,
and multiple proxies, even within one virtual host, are just a couple
more lines. Try it, come back if you have specific questions.


Hassan S. ------------------------ [email protected]

I’m using Hostingrails.com and had to create a symbolic link that
redirects to the app from the console. Read this tutorial to see how -

Make your app’s public folder the public_html
http://www.hostingrails.com/forums/wiki_thread/1#symlink

Thanks everyone for the tips. I did get a single rails app deployed
on our Linux system using Apache2 and FastCGI. I’m not at work now,
but tomorrow I will post what I did to get it to work.

VirtualHost is your friend…

Apache config(there is more to this but this should get you
started… ):

PS You should have a include directive in the main conf/httpd.conf and
add conf files for each of the apps in conf/extra/httpd-app1.conf.
This way you can move/add or disable single apps to apache.

<Proxy balancer://app1_cluster>
BalancerMember http://127.0.0.1:8100

<Proxy balancer://app2_cluster>
BalancerMember http://127.0.0.1:8200

NameVirtualHost *:80

<VirtualHost *:80>
ServerName app1

<Directory "/opt/rails_apps/app1/public">
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/app1(.*)$ balancer://app1_cluster%{REQUEST_URI}

[P,QSA,L]

ServerName app2
<Directory "/opt/rails_apps/app2/public">
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/app2(.*)$ balancer://app2_cluster%{REQUEST_URI}

[P,QSA,L]

Start Mongrels as needed like this(Read about Monit to manage this
better):

/usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e
production --user daemon --group daemon -p 8100 -a 127.0.0.1 -P /opt/
rails_app/app1/shared/pids/mongrel.8100.pid -c /opt/rails_app/app1/
current -l log/mongrel.8100.log --prefix /app1