moved the url in nginx conf to the yml

This commit is contained in:
zhitomirskiyi 2010-11-19 17:52:29 -08:00
parent e82495cc5b
commit bb2b4acb4b
4 changed files with 8 additions and 6 deletions

View file

@ -1,3 +1,5 @@
- port: '3001' thins:
- port: '3002' - port: '3001'
- port: '3003' - port: '3002'
- port: '3003'
url: 'alpha.joindiaspora.com'

View file

@ -15,7 +15,7 @@ end
config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml") 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"] port = thin["port"]
dir = "/service/thin_#{port}" dir = "/service/thin_#{port}"
flags = [] flags = []

View file

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

View file

@ -54,7 +54,7 @@ http {
server { server {
listen 80; listen 80;
server_name alpha.joindiaspora.com www.alpha.joindiaspora.com; server_name <%= @url %> www.<%= @url %>
rewrite ^(.*) https://alpha.joindiaspora.com$1 permanent; rewrite ^(.*) https://alpha.joindiaspora.com$1 permanent;
} }