2008/01/16

Gusty, Nginx, Rails and Mongrel_cluster howto

Here are the articles where I learned proper way to do this.

sudo cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster /etc/init.d/mongrel_cluster

Next, add a path statement to mongrel_cluster file just above the CONF_DIR variable:
sudo vi /etc/init.d/mongrel_cluster

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin
USER=mongrel to USER=www-data

sudo chmod +x /etc/init.d/mongrel_cluster
sudo update-rc.d mongrel_cluster defaults

In our rails app directory we need to create our mongrel config and then symlink it to where our mongrel config directory located at /etc/mongrel_cluster.

nano config/mongrel_cluster.yml

cwd: /var/www/rails/coredrill
log_file: log/mongrel.log
port: 8000
environment: production
group: www-data
user: mongrel
address: 127.0.0.1
pid_file: tmp/pids/mongrel.pid
servers: 3


ln -s /var/www/rails/coredrill/config/mongrel_cluster.yaml /etc/mongrel_cluster/coredrill.yaml

Starting nginx: 2008/01/15 23:17:19 [warn] 3238#0: conflicting server
name "coredrill.wowdns.com" on 37.208.125.80:80, ignored
==>
You have to add this to your default vhost:

server_name _ *;
listen 8080 default;


Finally, check your vhost config.
server
 listen 37.208.125.80:80; => listen 8080;
...
}
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default



mongrel_rails start -d -e production -p 8000 -P log/mongrel8000.pid 
mongrel_rails start -d -e production -p 8001 -P log/mongrel8001.pid 
mongrel_rails cluster::start 
mongrel_cluster_ctl status

0 comments:

Post a Comment