now running thins through ports since sockets were not working for some reason

This commit is contained in:
zhitomirskiyi 2010-11-12 11:36:34 -08:00
parent a9ae262fac
commit 6544d8235b
4 changed files with 12 additions and 10 deletions

View file

@ -1,3 +1,3 @@
- socket_id: '1'
- socket_id: '2'
- socket_id: '3'
- port: '3001'
- port: '3002'
- port: '3003'

View file

@ -16,13 +16,14 @@ end
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml")
config.each do |thin|
id = thin["socket_id"]
socket = "/tmp/thin_#{id}.sock"
dir = "/service/thin_#{id}"
id = thin["port"]
#socket = "/tmp/thin_#{id}.sock"
dir = "/service/thin_#{port}"
flags = []
flags << "-c /usr/local/app/diaspora" #directory to run from
flags << "-e production" #run in production mode
flags << "-S #{socket}" #use a socket
#flags << "-S #{socket}" #use a socket
flags << "-p #{port}" #use a socket
execute "thin run" do
command "mkdir -p #{dir} && echo '#!/bin/sh' > #{dir}/run && echo 'exec /usr/local/bin/ruby /usr/local/bin/thin start #{flags.join(" ")}' >> #{dir}/run"
end

View file

@ -21,5 +21,6 @@ end
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml")
template "/usr/local/nginx/conf/nginx.conf" do
source "nginx.conf.erb"
variables :socket_paths => config.map{|thin| "/tmp/thin_#{thin["socket_id"]}.sock"}
#variables :socket_paths => config.map{|thin| "/tmp/thin_#{thin["socket_id"]}.sock"}
variables :ports => config.map{|thin| "thin["port"]"}
end

View file

@ -28,8 +28,8 @@ http {
gzip_proxied any;
gzip_buffers 16 8k;
upstream thin_cluster {
<% @socket_paths.each do |socket_path| %>
server unix:<%=socket_path%>;
<% @ports.each do |port| %>
server <%="localhost:#{port}"%>;
<% end %>
}