aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté <mikisabate@gmail.com>2011-11-04 21:01:27 +0100
committerMiquel Sabaté <mikisabate@gmail.com>2011-11-04 21:01:27 +0100
commit336831ab79b7fdeb13a6ac22595bff1a4449b635 (patch)
treebbd37c248abf58fa2359da4c594c89d11fd69943
parentaa7db0efe69f213798304e9ddcc1b5a2aadd68cc (diff)
downloaddotfiles-336831ab79b7fdeb13a6ac22595bff1a4449b635.tar.gz
dotfiles-336831ab79b7fdeb13a6ac22595bff1a4449b635.zip
Getting more work done on the nginx/unicorn configuration
-rw-r--r--nginx_unicorn/README.rdoc7
-rw-r--r--nginx_unicorn/nginx.server.conf2
-rw-r--r--nginx_unicorn/unicorn.rb6
3 files changed, 10 insertions, 5 deletions
diff --git a/nginx_unicorn/README.rdoc b/nginx_unicorn/README.rdoc
index d379fdd..76fa311 100644
--- a/nginx_unicorn/README.rdoc
+++ b/nginx_unicorn/README.rdoc
@@ -18,12 +18,16 @@ inside the /etc/nginx/sites-enabled directory (not created by default). Here
it goes:
# Setting up the basic HTTP configuration
+
$ sudo cp -f nginx.http.conf /etc/nginx/conf/nginx.conf
$ sudo mkdir /etc/nginx/sites-enabled
# Copy the nginx.server.conf to your Rails application config directory.
# After doing this, you have to edit this file and change the root with
# the public path of your Rails application (in our case /home/mssola/myapp/public).
+ # You also want to change the upstream unicorn block by replacing the 'my_app_name'
+ # with the name of your app.
+
$ cp nginx.server.conf /home/mssola/myapp/config/nginx.conf
$ vim /home/mssola/myapp/config/nginx.conf
@@ -38,7 +42,8 @@ My Unicorn configuration assumes that you want as many worker processes as
CPU cores you have (using a linux-specific command). In order to change this and
more, please configure the unicorn.rb file. In this file you also have to
change the working directory (WD constant) with the path of your Rails
-application (/home/mssola/myapp in our case). After editing this file, you
+application (/home/mssola/myapp in our case). Don't forget to replace all
+the 'my_app_name' with the name of your app. After editing this file, you
have to edit the unicorn_init.sh script and change the APP_ROOT variable
with the path of your Rails application (/home/mssola/myapp again :) ). I
usually place both files to the config directory of my Rails
diff --git a/nginx_unicorn/nginx.server.conf b/nginx_unicorn/nginx.server.conf
index 65cdb21..bc06d5c 100644
--- a/nginx_unicorn/nginx.server.conf
+++ b/nginx_unicorn/nginx.server.conf
@@ -1,5 +1,5 @@
upstream unicorn {
- server unix:/tmp/unicorn.rem.sock fail_timeout=0;
+ server unix:/tmp/unicorn.my_app_name.sock fail_timeout=0;
}
server {
diff --git a/nginx_unicorn/unicorn.rb b/nginx_unicorn/unicorn.rb
index 5149547..b0f194f 100644
--- a/nginx_unicorn/unicorn.rb
+++ b/nginx_unicorn/unicorn.rb
@@ -8,15 +8,15 @@ NCORES = `cat /proc/cpuinfo | grep 'cores' | uniq | sed 's/[^0-9]//g'`.to_i
# Setting up the working directory and some paths
working_directory WD
pid "#{WD}/tmp/pids/unicorn.pid"
-stderr_path "#{WD}/log/unicorn.rem.sock"
-stdout_path "#{WD}/log/unicorn.rem.sock"
+stderr_path "#{WD}/log/unicorn.my_app_name.sock"
+stdout_path "#{WD}/log/unicorn.my_app_name.sock"
# We want one worker per core.
worker_processes NCORES
# Listen on a Unix domain socket. I'm using a shorter backlog
# for quicker failover when busy.
-listen '/tmp/unicorn.rem.sock', backlog: 64
+listen '/tmp/unicorn.my_app_name.sock', backlog: 64
# nuke workers after 30 seconds instead of 60 seconds (the default)
timeout 30