Merge pull request #314 from janorn/pull_269

Pull request 269 revisited
This commit is contained in:
James Fryman 2014-06-23 12:14:07 -05:00
commit 09b42b9d54
5 changed files with 65 additions and 21 deletions

View file

@ -15,6 +15,7 @@
# This class file is not called directly
class nginx::config(
$client_body_buffer_size = $nginx::params::nx_client_body_buffer_size,
$client_body_temp_path = $nginx::params::nx_client_body_temp_path,
$client_max_body_size = $nginx::params::nx_client_max_body_size,
$confd_purge = $nginx::params::nx_confd_purge,
$conf_dir = $nginx::params::nx_conf_dir,
@ -31,10 +32,16 @@ class nginx::config(
$gzip = $nginx::params::nx_gzip,
$http_access_log = $nginx::params::nx_http_access_log,
$http_cfg_append = $nginx::params::nx_http_cfg_append,
$http_tcp_nodelay = $nginx::params::nx_http_tcp_nodelay,
$http_tcp_nopush = $nginx::params::nx_http_tcp_nopush,
$keepalive_timeout = $nginx::params::nx_keepalive_timeout,
$logdir = $nginx::params::nx_logdir,
$mail = $nginx::params::nx_mail,
$multi_accept = $nginx::params::nx_multi_accept,
$names_hash_bucket_size = $nginx::params::nx_names_hash_bucket_size,
$names_hash_max_size = $nginx::params::nx_names_hash_max_size,
$nginx_error_log = $nginx::params::nx_nginx_error_log,
$pid = $nginx::params::nx_pid,
$proxy_buffers = $nginx::params::nx_proxy_buffers,
$proxy_buffer_size = $nginx::params::nx_proxy_buffer_size,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
@ -50,15 +57,19 @@ class nginx::config(
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_send_timeout = $nginx::params::nx_proxy_send_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_temp_path = $nginx::params::nx_proxy_temp_path,
$run_dir = $nginx::params::nx_run_dir,
$sendfile = $nginx::params::nx_sendfile,
$server_tokens = $nginx::params::nx_server_tokens,
$spdy = $nginx::params::nx_spdy,
$super_user = $nginx::params::nx_super_user,
$temp_dir = $nginx::params::nx_temp_dir,
$types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size,
$types_hash_max_size = $nginx::params::nx_types_hash_max_size,
$vhost_purge = $nginx::params::nx_vhost_purge,
$worker_connections = $nginx::params::nx_worker_connections,
$worker_processes = $nginx::params::nx_worker_processes,
$worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile,
$worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile
) inherits nginx::params {
File {
@ -99,16 +110,16 @@ class nginx::config(
ensure => absent,
}
file {$nginx::config::nx_run_dir:
file {$run_dir:
ensure => directory,
}
file {$nginx::config::nx_client_body_temp_path:
file {$client_body_temp_path:
ensure => directory,
owner => $daemon_user,
}
file {$nginx::config::nx_proxy_temp_path:
file {$proxy_temp_path:
ensure => directory,
owner => $daemon_user,
}
@ -157,14 +168,14 @@ class nginx::config(
ensure => absent,
}
file { "${nginx::config::nx_temp_dir}/nginx.d":
file { "${temp_dir}/nginx.d":
ensure => absent,
purge => true,
recurse => true,
force => true,
}
file { "${nginx::config::nx_temp_dir}/nginx.mail.d":
file { "${temp_dir}/nginx.mail.d":
ensure => absent,
purge => true,
recurse => true,

View file

@ -30,6 +30,7 @@
# }
class nginx (
$client_body_buffer_size = $nginx::params::nx_client_body_buffer_size,
$client_body_temp_path = $nginx::params::nx_client_body_temp_path,
$client_max_body_size = $nginx::params::nx_client_max_body_size,
$confd_purge = $nginx::params::nx_confd_purge,
$configtest_enable = $nginx::params::nx_configtest_enable,
@ -47,6 +48,10 @@ class nginx (
$gzip = $nginx::params::nx_gzip,
$http_access_log = $nginx::params::nx_http_access_log,
$http_cfg_append = $nginx::params::nx_http_cfg_append,
$http_tcp_nodelay = $nginx::params::nx_http_tcp_nodelay,
$http_tcp_nopush = $nginx::params::nx_http_tcp_nopush,
$keepalive_timeout = $nginx::params::nx_keepalive_timeout,
$logdir = $nginx::params::nx_logdir,
$mail = $nginx::params::nx_mail,
$manage_repo = $nginx::params::manage_repo,
$multi_accept = $nginx::params::nx_multi_accept,
@ -60,6 +65,7 @@ class nginx (
$package_ensure = $nginx::params::package_ensure,
$package_name = $nginx::params::package_name,
$package_source = $nginx::params::package_source,
$pid = $nginx::params::nx_pid,
$proxy_buffers = $nginx::params::nx_proxy_buffers,
$proxy_buffer_size = $nginx::params::nx_proxy_buffer_size,
$proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive,
@ -75,11 +81,17 @@ class nginx (
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_send_timeout = $nginx::params::nx_proxy_send_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_temp_path = $nginx::params::nx_proxy_temp_path,
$run_dir = $nginx::params::nx_run_dir,
$sendfile = $nginx::params::nx_sendfile,
$server_tokens = $nginx::params::nx_server_tokens,
$service_ensure = $nginx::params::nx_service_ensure,
$service_restart = $nginx::params::nx_service_restart,
$spdy = $nginx::params::nx_spdy,
$super_user = $nginx::params::nx_super_user,
$temp_dir = $nginx::params::nx_temp_dir,
$types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size,
$types_hash_max_size = $nginx::params::nx_types_hash_max_size,
$vhost_purge = $nginx::params::nx_vhost_purge,
$worker_connections = $nginx::params::nx_worker_connections,
$worker_processes = $nginx::params::nx_worker_processes,
@ -175,6 +187,7 @@ class nginx (
class { 'nginx::config':
client_body_buffer_size => $client_body_buffer_size,
client_body_temp_path => $client_body_temp_path,
client_max_body_size => $client_max_body_size,
confd_purge => $confd_purge,
conf_dir => $conf_dir,
@ -191,10 +204,16 @@ class nginx (
gzip => $gzip,
http_access_log => $http_access_log,
http_cfg_append => $http_cfg_append,
http_tcp_nodelay => $http_tcp_nodelay,
http_tcp_nopush => $http_tcp_nopush,
keepalive_timeout => $keepalive_timeout,
logdir => $logdir,
mail => $mail,
multi_accept => $multi_accept,
names_hash_bucket_size => $names_hash_bucket_size,
names_hash_max_size => $names_hash_max_size,
nginx_error_log => $nginx_error_log,
pid => $pid,
proxy_buffers => $proxy_buffers,
proxy_buffer_size => $proxy_buffer_size,
proxy_cache_inactive => $proxy_cache_inactive,
@ -210,9 +229,15 @@ class nginx (
proxy_redirect => $proxy_redirect,
proxy_send_timeout => $proxy_send_timeout,
proxy_set_header => $proxy_set_header,
proxy_temp_path => $proxy_temp_path,
run_dir => $run_dir,
sendfile => $sendfile,
server_tokens => $server_tokens,
spdy => $spdy,
super_user => $super_user,
temp_dir => $temp_dir,
types_hash_bucket_size => $types_hash_bucket_size,
types_hash_max_size => $types_hash_max_size,
vhost_purge => $vhost_purge,
worker_connections => $worker_connections,
worker_processes => $worker_processes,

View file

@ -35,7 +35,8 @@ class nginx::params {
$nx_events_use = false
$nx_sendfile = on
$nx_keepalive_timeout = 65
$nx_tcp_nodelay = on
$nx_http_tcp_nodelay = on
$nx_http_tcp_nopush = off
$nx_gzip = on
$nx_server_tokens = on
$nx_spdy = off

View file

@ -150,7 +150,7 @@ define nginx::resource::vhost (
$ssl_stapling_responder = undef,
$ssl_stapling_verify = false,
$ssl_trusted_cert = undef,
$spdy = $nginx::params::nx_spdy,
$spdy = $nginx::config::spdy,
$proxy = undef,
$proxy_read_timeout = $nginx::config::proxy_read_timeout,
$proxy_connect_timeout = $nginx::config::proxy_connect_timeout,
@ -377,7 +377,7 @@ define nginx::resource::vhost (
# Also opted to add more logic here and keep template cleaner which
# unfortunately means resorting to the $varname_real thing
$access_log_tmp = $access_log ? {
undef => "${nginx::params::nx_logdir}/${name_sanitized}.access.log",
undef => "${nginx::config::logdir}/${name_sanitized}.access.log",
default => $access_log,
}
@ -387,7 +387,7 @@ define nginx::resource::vhost (
}
$error_log_real = $error_log ? {
undef => "${nginx::params::nx_logdir}/${name_sanitized}.error.log",
undef => "${nginx::config::logdir}/${name_sanitized}.error.log",
default => $error_log,
}
@ -489,7 +489,7 @@ define nginx::resource::vhost (
# Also opted to add more logic here and keep template cleaner which
# unfortunately means resorting to the $varname_real thing
$ssl_access_log_tmp = $access_log ? {
undef => "${nginx::params::nx_logdir}/ssl-${name_sanitized}.access.log",
undef => "${nginx::config::logdir}/ssl-${name_sanitized}.access.log",
default => $access_log,
}
@ -499,7 +499,7 @@ define nginx::resource::vhost (
}
$ssl_error_log_real = $error_log ? {
undef => "${nginx::params::nx_logdir}/ssl-${name_sanitized}.error.log",
undef => "${nginx::config::logdir}/ssl-${name_sanitized}.error.log",
default => $error_log,
}

View file

@ -2,10 +2,12 @@
user <%= @daemon_user %>;
<% end -%>
worker_processes <%= @worker_processes %>;
worker_rlimit_nofile <%= @worker_rlimit_nofile %>;
<% if @worker_rlimit_nofile %>worker_rlimit_nofile <%= @worker_rlimit_nofile %>;<% end -%>
error_log <%= @nginx_error_log %>;
<% if scope.lookupvar('nginx::params::nx_pid') != false %>pid <%= scope.lookupvar('nginx::params::nx_pid')%>;<% end -%>
<% if @pid -%>
pid <%= @pid %>;
<% end -%>
events {
worker_connections <%= @worker_connections -%>;
@ -23,20 +25,25 @@ http {
access_log <%= @http_access_log %>;
sendfile <%= @sendfile %>;
<% if @sendfile == 'on' -%>
sendfile on;
<% if @http_tcp_nopush == 'on' -%>
tcp_nopush on;
<% end -%>
<% end -%>
server_tokens <%= @server_tokens %>;
types_hash_max_size <%= scope.lookupvar('nginx::params::nx_types_hash_max_size')%>;
types_hash_bucket_size <%= scope.lookupvar('nginx::params::nx_types_hash_bucket_size')%>;
types_hash_max_size <%= @types_hash_max_size %>;
types_hash_bucket_size <%= @types_hash_bucket_size %>;
server_names_hash_bucket_size <%= @names_hash_bucket_size %>;
server_names_hash_max_size <%= @names_hash_max_size %>;
keepalive_timeout <%= scope.lookupvar('nginx::params::nx_keepalive_timeout')%>;
tcp_nodelay <%= scope.lookupvar('nginx::params::nx_tcp_nodelay')%>;
keepalive_timeout <%= @keepalive_timeout %>;
tcp_nodelay <%= @http_tcp_nodelay %>;
<% if @gzip == 'on' %>
<% if @gzip == 'on' -%>
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
<% end -%>
@ -64,7 +71,7 @@ http {
include <%= @conf_dir %>/sites-enabled/*;
}
<% if scope.lookupvar('nginx::mail') %>
<% if @mail -%>
mail {
include <%= @conf_dir %>/conf.mail.d/*.conf;
}