diff --git a/chef/cookbooks/common/files/default/thins.yml b/chef/cookbooks/common/files/default/thins.yml index 31bd3d893..0f660443f 100644 --- a/chef/cookbooks/common/files/default/thins.yml +++ b/chef/cookbooks/common/files/default/thins.yml @@ -1,3 +1,3 @@ -- socket_id: '1' -- socket_id: '2' -- socket_id: '3' +- port: '3001' +- port: '3002' +- port: '3003' diff --git a/chef/cookbooks/common/recipes/daemontools.rb b/chef/cookbooks/common/recipes/daemontools.rb index ed2e6980a..3ce295c3a 100644 --- a/chef/cookbooks/common/recipes/daemontools.rb +++ b/chef/cookbooks/common/recipes/daemontools.rb @@ -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 diff --git a/chef/cookbooks/common/recipes/nginx.rb b/chef/cookbooks/common/recipes/nginx.rb index f4719f74b..5ee2a1ba7 100644 --- a/chef/cookbooks/common/recipes/nginx.rb +++ b/chef/cookbooks/common/recipes/nginx.rb @@ -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 diff --git a/chef/cookbooks/common/templates/default/nginx.conf.erb b/chef/cookbooks/common/templates/default/nginx.conf.erb index 8a4f0b888..21ed1e4d1 100644 --- a/chef/cookbooks/common/templates/default/nginx.conf.erb +++ b/chef/cookbooks/common/templates/default/nginx.conf.erb @@ -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 %> }