Skip to content

Commit

Permalink
added nginx support for hosteurope server. refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
chris flöß committed Jul 22, 2010
1 parent 102c50c commit 5ccf196
Show file tree
Hide file tree
Showing 17 changed files with 426 additions and 32 deletions.
8 changes: 6 additions & 2 deletions manifests/nodes.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# TODO: Refactor. Charlie needs postgres stuff, but it shouldn't be
# named in b2c_test
include servercharlie
include servercharlie::packages
adva_users{"puppet-admin": username => "puppet-admin",}
}

Expand All @@ -39,17 +40,20 @@
node 'ext-con-sk-test' {
#include puppet_client
include base_configs
ext-con::adva_users{"application": username => "application",}
#include gems_ext_con
#include ree
#include nginx
}

node /ext-con-sk-\d\d/ {
include base_configs
#include base_configs
ext-con::adva_users{"application": username => "application",}
}

node 'ds87-230-55-112' inherits default {
include packages::ree
include advabest::packages
#include advabest::gems
include advabest::gems
include advabest::nginx
}
62 changes: 62 additions & 0 deletions modules/advabest/files/init.d/nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#! /bin/sh

### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/nginx/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/opt/nginx/logs/$NAME.pid --exec $DAEMON || true
sleep 1
start-stop-daemon --start --quiet --pidfile \
/opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration: "
start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac

exit 0
13 changes: 13 additions & 0 deletions modules/advabest/files/logrotate.d/nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/opt/nginx/logs/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
[ ! -f /opt/nginx/logs/nginx.pid ] || kill -USR1 `cat /opt/nginx/logs/nginx.pid`
endscript
}
71 changes: 71 additions & 0 deletions modules/advabest/files/nginx_conf/advabest.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
server {
listen 80;
server_name ext-b2c-sk-test;
access_log /home/application/projects/sk_b2c/testing/shared/log/nginx_access.log;
root /home/application/projects/sk_b2c/testing/current/public;
index index.html index.htm;

auth_basic "Staging";
auth_basic_user_file staging.sk.htpasswd;

# passenger stuff
passenger_enabled on;
rails_env production;
rails_spawn_method smart-lv2;
rails_framework_spawner_idle_time 1800;
rails_app_spawner_idle_time 600;

#location ~* ^/(javascripts|stylesheets|images/layout|images/colorbox|digital_contents) {
# expires max;
#}
#location /data/pricelists {
# root /home/application/projects/s_k/staging/shared;
# internal;
#}
location /stylesheets/adva_core {
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
alias /home/application/.bundle/ruby/1.8/bundler/gems/adva-cms2-75981a8194b3a07e833796d5110aa9d2b450dfbd-master/adva-core/public;
internal;
}

# For the app maintenance
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
return 503;
}
}

#server {
# listen 443;
# server_name ext-con-sk-test.siewert-kau.de;
# access_log /home/application/projects/s_k/staging/shared/log/nginx_access.log;
# root /home/application/projects/s_k/staging/current/public;
# index index.html index.htm;
#
# auth_basic "Staging";
# auth_basic_user_file staging.sk.htpasswd;
#
# # passenger stuff
# passenger_enabled on;
# rails_env staging;
# rails_spawn_method smart-lv2;
# rails_framework_spawner_idle_time 1800;
# rails_app_spawner_idle_time 600;
#
# ssl on;
# ssl_certificate /home/application/.ssh/siewert-kau.de.chained.crt;
# ssl_certificate_key /home/application/.ssh/siewert-kau.de.key;
#
# location ~* ^/(javascripts|stylesheets|images/layout|images/colorbox|digital_contents) {
# expires max;
# }
# location /data/pricelists {
# root /home/application/projects/s_k/staging/shared;
# internal;
# }
#
# # For the app maintenance
# if (-f $document_root/system/maintenance.html) {
# rewrite ^(.*)$ /system/maintenance.html break;
# }
#}
71 changes: 71 additions & 0 deletions modules/advabest/files/nginx_conf/advabest.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
server {
listen 80;
server_name ext-b2c-sk-test;
access_log /home/application/projects/sk_b2c/testing/shared/log/nginx_access.log;
root /home/application/projects/sk_b2c/testing/current/public;
index index.html index.htm;

auth_basic "Staging";
auth_basic_user_file staging.sk.htpasswd;

# passenger stuff
passenger_enabled on;
rails_env production;
rails_spawn_method smart-lv2;
rails_framework_spawner_idle_time 1800;
rails_app_spawner_idle_time 600;

#location ~* ^/(javascripts|stylesheets|images/layout|images/colorbox|digital_contents) {
# expires max;
#}
#location /data/pricelists {
# root /home/application/projects/s_k/staging/shared;
# internal;
#}
location /stylesheets/adva_core {
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
alias /home/application/.bundle/ruby/1.8/bundler/gems/adva-cms2-75981a8194b3a07e833796d5110aa9d2b450dfbd-master/adva-core/public;
internal;
}

# For the app maintenance
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
return 503;
}
}

#server {
# listen 443;
# server_name ext-con-sk-test.siewert-kau.de;
# access_log /home/application/projects/s_k/staging/shared/log/nginx_access.log;
# root /home/application/projects/s_k/staging/current/public;
# index index.html index.htm;
#
# auth_basic "Staging";
# auth_basic_user_file staging.sk.htpasswd;
#
# # passenger stuff
# passenger_enabled on;
# rails_env staging;
# rails_spawn_method smart-lv2;
# rails_framework_spawner_idle_time 1800;
# rails_app_spawner_idle_time 600;
#
# ssl on;
# ssl_certificate /home/application/.ssh/siewert-kau.de.chained.crt;
# ssl_certificate_key /home/application/.ssh/siewert-kau.de.key;
#
# location ~* ^/(javascripts|stylesheets|images/layout|images/colorbox|digital_contents) {
# expires max;
# }
# location /data/pricelists {
# root /home/application/projects/s_k/staging/shared;
# internal;
# }
#
# # For the app maintenance
# if (-f $document_root/system/maintenance.html) {
# rewrite ^(.*)$ /system/maintenance.html break;
# }
#}
47 changes: 47 additions & 0 deletions modules/advabest/files/nginx_conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
worker_processes 1;

#error_log logs/error.log;
#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
server_tokens off;
passenger_root /opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.14;
passenger_ruby /opt/ruby-ee/bin/ruby;
passenger_max_pool_size 8;
#passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.8;
#passenger_ruby /usr/bin/ruby1.8;

include mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log;

server_names_hash_bucket_size 128;

sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;

gzip on;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# make sure gzip does not lose large gzipped js or css files
# see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6].(?!.*SV1)";

include /opt/nginx/conf/sites-enabled/*;

}
1 change: 1 addition & 0 deletions modules/advabest/files/nginx_conf/staging.sk.htpasswd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
advademo:cZmlwfKQj4NTg
10 changes: 5 additions & 5 deletions modules/advabest/manifests/gems.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class advabest-dev-ds87-230-55-112::gems{
class advabest::gems {
package {
"actionmailer":
ensure => "2.3.4",
Expand Down Expand Up @@ -35,7 +35,7 @@
provider => gem;
"ezcrypto":
ensure => "0.7.2",
"provider => gem;":
provider => gem;
"facter":
ensure => "1.5.6",
provider => gem;
Expand Down Expand Up @@ -70,7 +70,7 @@
ensure => "2.8.1",
provider => gem;
"newrelic_rpm":
ensure => 2.10.5,
ensure => "2.10.5",
provider => gem;
"passenger":
ensure => "2.2.14",
Expand All @@ -88,7 +88,7 @@
ensure => "0.8.4",
provider => gem;
"puppet":
ensure => 0.24.8,
ensure => "0.24.8",
provider => gem;
"rack":
ensure => "1.0.1",
Expand All @@ -106,7 +106,7 @@
ensure => "1.7.0",
provider => gem;
"rmagick":
ensure => 2.12.2,
ensure => "2.12.2",
provider => gem;
"rspec":
ensure => "1.3.0",
Expand Down
Loading

0 comments on commit 5ccf196

Please sign in to comment.