From 4b43eaef6bc7419123fba53740f26bbe390edb4e Mon Sep 17 00:00:00 2001
From: Raphael <raphael@joindiaspora.com>
Date: Thu, 2 Dec 2010 12:34:43 -0800
Subject: [PATCH] Port 7894 for resque web client.  HTTP basic looks in
 /usr/local/nginx/conf/htpasswd for user:pass.

---
 chef/cookbooks/common/files/default/iptables  |  2 +-
 .../common/templates/default/nginx.conf.erb   | 21 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/chef/cookbooks/common/files/default/iptables b/chef/cookbooks/common/files/default/iptables
index 7fa13a0aa6..345df7a19a 100644
--- a/chef/cookbooks/common/files/default/iptables
+++ b/chef/cookbooks/common/files/default/iptables
@@ -16,7 +16,7 @@
 #HTTPS
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT  
 #Resque-Web
--A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5678 -j ACCEPT  
+-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 7894 -j ACCEPT  
 #Websocket
 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT 
 #Crossdomain policy file for Flash sockets
diff --git a/chef/cookbooks/common/templates/default/nginx.conf.erb b/chef/cookbooks/common/templates/default/nginx.conf.erb
index e294d49078..c06963b53c 100644
--- a/chef/cookbooks/common/templates/default/nginx.conf.erb
+++ b/chef/cookbooks/common/templates/default/nginx.conf.erb
@@ -36,6 +36,10 @@ http {
   <% end %>
   }
 
+  upstream resque_web {
+    server localhost:5678;
+  }
+
   server {
    listen       843;
 
@@ -51,6 +55,23 @@ http {
 
   }
 
+  server {
+   listen  7894;
+   server_name  <%= @url %>  www.<%= @url %>;
+
+   auth_basic "Restricted";
+   auth_basic_user_file  htpasswd;
+
+   ssl on;
+   ssl_certificate      /usr/local/nginx/conf/diaspora.crt;
+   ssl_certificate_key  /usr/local/nginx/conf/diaspora.key;
+
+   location / {
+      proxy_set_header Host $http_host;
+      proxy_pass http://resque_web;
+   }
+  }
+
   server {
    listen       80;
    server_name  <%= @url %>  www.<%= @url %>;
-- 
GitLab