Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
Setup stat-update without variables
Browse files Browse the repository at this point in the history
Sam Kottler committed Jul 14, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c69e1c5 commit fc0e323
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Berksfile.lock
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ GRAPH
rubygems-backups (0.0.14)
chef-vault (>= 0.0.0)
rubygems-ruby (>= 0.0.0)
rubygems-balancer (0.0.15)
rubygems-balancer (0.0.18)
chef-vault (>= 0.0.0)
nginx (>= 0.0.0)
rubygems (>= 0.0.0)
2 changes: 1 addition & 1 deletion cookbooks/rubygems-balancer/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name 'rubygems-balancer'

version '0.0.15'
version '0.0.18'

depends 'chef-vault'
depends 'nginx'
1 change: 0 additions & 1 deletion cookbooks/rubygems-balancer/recipes/site.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@
mode '0644'
variables(
app_servers: search(:node, "roles:app AND chef_environment:#{node.chef_environment}"),
stat_server: search(:node, 'roles:stat')[0],
server_names: ['rubygems.org', 'www.rubygems.org'],
ssl_key: File.join(node['nginx']['dir'], 'certs', 'rubygems.org.key'),
ssl_cert: File.join(node['nginx']['dir'], 'certs', 'rubygems.org.crt')
18 changes: 5 additions & 13 deletions cookbooks/rubygems-balancer/templates/default/site.conf.erb
Original file line number Diff line number Diff line change
@@ -39,18 +39,14 @@ server {
proxy_set_header Host $host;
proxy_redirect off;

<% if @stat_server %>
location = /__log {
internal;
proxy_pass http://<%= stat_server %>/gems/$gem.gem;
}
<% end %>
location = /__log {
internal;
proxy_pass http://127.0.0.1:5000/gems/$gem.gem;
}

location ~ /gems/(.*)\.gem$ {
<% if @stat_server %>
set $gem $1;
post_action /__log;
<% end %>
rewrite ^ $gem_mirror$request_uri redirect;
}

@@ -209,18 +205,14 @@ server {

##### BEGIN legacy rules

<% if @stat_server %>
location = /__log {
internal;
proxy_pass http://<%= @stat_server %>/gems/$gem.gem;
proxy_pass http://127.0.0.1:5000/gems/$gem.gem;
}
<% end %>

location ~ /gems/(.*)\.gem$ {
<% if @stat_server %>
set $gem $1;
post_action /__log;
<% end %>
rewrite ^ $gem_mirror_ssl$request_uri redirect;
}

0 comments on commit fc0e323

Please sign in to comment.