Skip to content
Browse files

1204142206

  • Loading branch information...
1 parent caa7310 commit b0ac74d6aeab245a8e3c606716774d1000843c18 @andyl committed Apr 14, 2012
View
2 _puppet/modules/nginx/manifests/app_passenger.pp
@@ -1,4 +1,4 @@
-define nginx::app_passenger($app_name = $title, $deploy_user, $server_names, $port=3333) {
+define nginx::app_passenger($app_name = $title, $deploy_user, $server_names, $port='unix_socket') {
$conf_file = "/home/$deploy_user/a/_conf/$app_name.conf"
$root_dir = "/home/$deploy_user/a/$app_name"
View
2 _puppet/modules/nginx/manifests/deploy_service.pp
@@ -1,4 +1,4 @@
-define deploy_service($root_dir = $title, $type, $user, $name, $port=3000) {
+define deploy_service($root_dir = $title, $type, $user, $name, $port='unix_socket') {
$app_name = "app-${type}-${name}"
View
6 _puppet/modules/nginx/templates/conf_passenger.erb
@@ -1,15 +1,21 @@
# vi: set ft=nginx :
+<% if port == "unix_socket" -%>
upstream <%= app_name %>_upstream {
server unix:/tmp/<%= app_name %>.socket;
}
+<% end -%>
server {
listen 80;
server_name <%= [0..server_names.length-1].map {|x| server_names[x]}.join(' ') %>;
root <%= root_dir %>/current/public;
location / {
+ <% if port == "unix_socket" -%>
proxy_pass http://<%= app_name %>_upstream;
+ <% else -%>
+ proxy_pass http://127.0.0.1:<%= port %>;
+ <% end -%>
proxy_set_header Host $host;
}
}
View
8 _puppet/modules/nginx/templates/init_passenger.erb
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# vi: set ft=sh :
#
@@ -25,8 +25,10 @@ APP_ROOT="<%= root_dir %>/current"
LOG_FILE="<%= root_dir %>/shared/log/$ENV.log"
PID_FILE="<%= root_dir %>/shared/pids/$DESC.pid"
-PASSENGER_ARG="-p $TCP_PORT -e $ENV -R config.ru -d --log-file $LOG_FILE --pid-file $PID_FILE"
-# PASSENGER_ARG="-S $UNX_PORT -e $ENV -R config.ru -d --log-file $LOG_FILE --pid-file $PID_FILE"
+CONNECT_METHOD="-p $TCP_PORT"
+[ "$TCP_PORT" == "unix_socket" ] && CONNECT_METHOD="-S $UNX_PORT"
+
+PASSENGER_ARG="$CONNECT_METHOD -e $ENV -R config.ru -d --log-file $LOG_FILE --pid-file $PID_FILE"
PASSENGER_CMD="cd $APP_ROOT && /home/$USR_NAME/.rbenv/shims/passenger"
CMD_STOP="$PASSENGER_CMD stop --pid-file $PID_FILE"
View
2 _puppet/modules/nginx/tests/nginx_test.pp
@@ -8,5 +8,5 @@
nginx::app_static {'static2' : server_names => ['static2'] }
nginx::app_passenger {'pass1' : deploy_user => 'vagrant', server_names => ['pass1'], port => 8010 }
-nginx::app_passenger {'pass2' : deploy_user => 'vagrant', server_names => ['pass2'], port => 8020 }
+nginx::app_passenger {'pass2' : deploy_user => 'vagrant', server_names => ['pass2'] }

0 comments on commit b0ac74d

Please sign in to comment.
Something went wrong with that request. Please try again.