From bb2b4acb4b871c018220e543c28048806a7a8adc Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Fri, 19 Nov 2010 17:52:29 -0800 Subject: [PATCH] moved the url in nginx conf to the yml --- chef/cookbooks/common/files/default/thins.yml | 8 +++++--- chef/cookbooks/common/recipes/daemontools.rb | 2 +- chef/cookbooks/common/recipes/nginx.rb | 2 +- chef/cookbooks/common/templates/default/nginx.conf.erb | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/chef/cookbooks/common/files/default/thins.yml b/chef/cookbooks/common/files/default/thins.yml index 0f660443f..12980b6b6 100644 --- a/chef/cookbooks/common/files/default/thins.yml +++ b/chef/cookbooks/common/files/default/thins.yml @@ -1,3 +1,5 @@ -- port: '3001' -- port: '3002' -- port: '3003' +thins: + - port: '3001' + - port: '3002' + - port: '3003' +url: 'alpha.joindiaspora.com' diff --git a/chef/cookbooks/common/recipes/daemontools.rb b/chef/cookbooks/common/recipes/daemontools.rb index 11f863338..6568571e5 100644 --- a/chef/cookbooks/common/recipes/daemontools.rb +++ b/chef/cookbooks/common/recipes/daemontools.rb @@ -15,7 +15,7 @@ end config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml") -config.each do |thin| +config['thins'].each do |thin| port = thin["port"] dir = "/service/thin_#{port}" flags = [] diff --git a/chef/cookbooks/common/recipes/nginx.rb b/chef/cookbooks/common/recipes/nginx.rb index a229023e8..033cbef60 100644 --- a/chef/cookbooks/common/recipes/nginx.rb +++ b/chef/cookbooks/common/recipes/nginx.rb @@ -29,5 +29,5 @@ 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 :ports => config.map{|thin| "#{thin["port"]}"} + variables :ports => config['thins'].map{|thin| "#{thin["port"]}"}, :url => config['url'] end diff --git a/chef/cookbooks/common/templates/default/nginx.conf.erb b/chef/cookbooks/common/templates/default/nginx.conf.erb index 387a63c72..5543bcc31 100644 --- a/chef/cookbooks/common/templates/default/nginx.conf.erb +++ b/chef/cookbooks/common/templates/default/nginx.conf.erb @@ -54,7 +54,7 @@ http { server { listen 80; - server_name alpha.joindiaspora.com www.alpha.joindiaspora.com; + server_name <%= @url %> www.<%= @url %> rewrite ^(.*) https://alpha.joindiaspora.com$1 permanent; }