Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Archlinux support #316

Merged
merged 2 commits into from May 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This module manages NGINX configuration.
### Requirements

* Puppet-2.7.0 or later
* Ruby-1.9.3 or later (Support for Ruby-1.8.7 is not guaranteed. YMMV).
* Ruby-1.9.3 or later (Support for Ruby-1.8.7 is not guaranteed. YMMV).

### Install and bootstrap an NGINX instance

Expand Down Expand Up @@ -74,7 +74,7 @@ To create only a HTTPS vhost, set `ssl => true` and also set `listen_port` to th
Locations require specific settings depending on whether they should be included in the HTTP, HTTPS or both vhosts.

#### HTTP only vhost (default)
If you only have a HTTP vhost (i.e. `ssl => false` on the vhost) maks sure you don't set `ssl => true` on any location you associate with the vhost.
If you only have a HTTP vhost (i.e. `ssl => false` on the vhost) make sure you don't set `ssl => true` on any location you associate with the vhost.

#### HTTP and HTTPS vhost
If you set `ssl => true` and also set `listen_port` and `ssl_port` to different values on the vhost you will need to be specific with the location settings since you will have a HTTP vhost listening on `listen_port` and a HTTPS vhost listening on `ssl_port`:
Expand Down Expand Up @@ -202,7 +202,7 @@ define web::nginx_ssl_with_redirect (
} else {
$tmp_www_root = $www_root
}

nginx::resource::vhost { "${name}.${::domain} ${name}":
ensure => present,
listen_port => 443,
Expand All @@ -211,32 +211,32 @@ define web::nginx_ssl_with_redirect (
location_cfg_append => $location_cfg_append,
index_files => [ 'index.php' ],
ssl => true,
ssl_cert => 'puppet:///modules/sslkey/whildcard_mydomain.crt',
ssl_key => 'puppet:///modules/sslkey/whildcard_mydomain.key',
ssl_cert => 'puppet:///modules/sslkey/wildcard_mydomain.crt',
ssl_key => 'puppet:///modules/sslkey/wildcard_mydomain.key',
}


if $php {
nginx::resource::location { "${name}_root":
ensure => present,
ssl => true,
ssl_only => true,
ssl => true,
ssl_only => true,
vhost => "${name}.${::domain} ${name}",
www_root => "${full_web_path}/${name}/",
www_root => "${full_web_path}/${name}/",
location => '~ \.php$',
index_files => ['index.php', 'index.html', 'index.htm'],
proxy => undef,
fastcgi => "127.0.0.1:${backend_port}",
fastcgi_script => undef,
location_cfg_append => {
location_cfg_append => {
fastcgi_connect_timeout => '3m',
fastcgi_read_timeout => '3m',
fastcgi_send_timeout => '3m'
fastcgi_send_timeout => '3m'
}
}
}
}
```
}
}
}
```

# Call class web::nginx_ssl_with_redirect

Expand Down
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
validate_string($proxy_cache_keys_zone)
validate_string($proxy_cache_max_size)
validate_string($proxy_cache_inactive)
if ($fastcgi_cache_path != false) {

if ($fastcgi_cache_path != false) {
validate_string($fastcgi_cache_path)
}
if (!is_integer($fastcgi_cache_levels)) {
Expand Down
6 changes: 6 additions & 0 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
before => Anchor['nginx::package::end'],
}
}
'archlinux': {
class { 'nginx::package::archlinux':
require => Anchor['nginx::package::begin'],
before => Anchor['nginx::package::end'],
}
}
'Solaris': {
class { 'nginx::package::solaris':
package_name => $package_name,
Expand Down
25 changes: 25 additions & 0 deletions manifests/package/archlinux.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Class: nginx::package::archlinux
#
# This module manages NGINX package installation on Archlinux based systems
#
# Parameters:
#
# There are no default parameters for this class.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# This class file is not called directly
class nginx::package::archlinux(
$package_name = 'nginx',
$package_ensure = 'present'
) {

package { $package_name:
ensure => $package_ensure,
}

}
11 changes: 9 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@
}

$nx_pid = $::kernel ? {
/(?i-mx:linux)/ => '/var/run/nginx.pid',
/(?i-mx:linux)/ => $::osfamily ? {
# archlinux has hardcoded pid in service file to /run/nginx.pid, setting
# it will prevent nginx from starting
/(?i-mx:archlinux)/ => false,
default => '/var/run/nginx.pid',
},
/(?i-mx:sunos)/ => '/var/run/nginx.pid',
}

Expand All @@ -93,14 +98,16 @@
default => 'webservd',
}
$nx_daemon_user = $::osfamily ? {
/(?i-mx:archlinux)/ => 'http',
/(?i-mx:redhat|suse|gentoo|linux)/ => 'nginx',
/(?i-mx:debian)/ => 'www-data',
/(?i-mx:solaris)/ => $solaris_nx_daemon_user,
}
} else {
warning('$::osfamily not defined. Support for $::operatingsystem is deprecated')
warning("Please upgrade from factor ${::facterversion} to >= 1.7.2")
warning("Please upgrade from facter ${::facterversion} to >= 1.7.2")
$nx_daemon_user = $::operatingsystem ? {
/(?i-mx:archlinux)/ => 'http',
/(?i-mx:debian|ubuntu)/ => 'www-data',
/(?i-mx:fedora|rhel|redhat|centos|scientific|suse|opensuse|amazon|gentoo|oraclelinux)/ => 'nginx',
/(?i-mx:solaris)/ => 'webservd',
Expand Down
2 changes: 1 addition & 1 deletion templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ worker_processes <%= @worker_processes %>;
worker_rlimit_nofile <%= @worker_rlimit_nofile %>;

error_log <%= @nginx_error_log %>;
pid <%= scope.lookupvar('nginx::params::nx_pid')%>;
<% if scope.lookupvar('nginx::params::nx_pid') != false %>pid <%= scope.lookupvar('nginx::params::nx_pid')%>;<% end -%>

events {
worker_connections <%= @worker_connections -%>;
Expand Down
2 changes: 1 addition & 1 deletion templates/conf.d/proxy.conf.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
proxy_redirect <%= @proxy_redirect %>;
client_max_body_size <%= @client_max_body_size %>;
client_max_body_size <%= @client_max_body_size %>;
client_body_buffer_size <%= scope.lookupvar('nginx::params::nx_client_body_buffer_size') %>;
proxy_connect_timeout <%= scope.lookupvar('nginx::params::nx_proxy_connect_timeout') %>;
proxy_send_timeout <%= scope.lookupvar('nginx::params::nx_proxy_send_timeout') %>;
Expand Down