Skip to content

Commit

Permalink
Merge pull request voxpupuli#1 from jfryman/master
Browse files Browse the repository at this point in the history
Merge upstream changes
  • Loading branch information
SteveMaddison committed May 19, 2015
2 parents 1620e18 + 9d45695 commit 58ef496
Show file tree
Hide file tree
Showing 57 changed files with 1,072 additions and 490 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pp linguist-language=Puppet
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
files/server_test.crt
files/server_test.pem
pkg/
pkg/
log/
Gemfile.lock
spec/fixtures/modules
spec/fixtures/manifests
vendor
.ruby-version
.vagrant/
31 changes: 0 additions & 31 deletions .nodeset.yml

This file was deleted.

15 changes: 2 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,13 @@ bundler_args: --without rake
matrix:
fast_finish: true
include:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.5.0" FUTURE_PARSER="yes"
allow_failures:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.5.0" FUTURE_PARSER="yes"
env: PUPPET_GEM_VERSION="~> 4.0"
notifications:
email: false
email: false
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ end
group :rake, :test do
gem 'puppetlabs_spec_helper', '>=0.8.2', :require => false
gem 'puppet-blacksmith', :require => false
gem 'rspec-system-puppet', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
end

group :rake do
gem 'rspec-puppet', '~>1.0'
gem 'rspec-puppet', '>=2.1.0', :require => false
gem 'rake', '>=0.9.2.2'
gem 'puppet-lint', '>=1.0.1'
gem 'rspec-system-serverspec', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand Down
20 changes: 19 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
maintenance. Please take a look at [https://github.com/jfryman/puppet-nginx/blob/master/docs/hiera.md](https://github.com/jfryman/puppet-nginx/blob/master/docs/hiera.md)
before upgrading or installing Version 0.1.0 or greater.

[![Puppet
Forge](http://img.shields.io/puppetforge/v/jfryman/nginx.svg)](https://forge.puppetlabs.com/jfryman/nginx)
[![Build Status](https://travis-ci.org/jfryman/puppet-nginx.png)](https://travis-ci.org/jfryman/puppet-nginx)


Expand Down Expand Up @@ -115,6 +117,7 @@ nginx::nginx_locations:
'static':
location: '~ "^/static/[0-9a-fA-F]{8}\/(.*)$"'
vhost: www.puppetlabs.com
www_root: /var/www/html
'userContent':
location: /userContent
vhost: www.puppetlabs.com
Expand All @@ -130,8 +133,9 @@ nginx::nginx_mailhosts:
## Nginx with precompiled Passenger
Currently this works only for Debian family.
Currently this works only for Debian family and OpenBSD.
On Debian it might look like:
```puppet
class { 'nginx':
package_source => 'passenger',
Expand All @@ -141,6 +145,20 @@ class { 'nginx':
}
```

Here the example for OpenBSD:

```puppet
class { 'nginx':
package_flavor => 'passenger',
service_flags => '-u'
http_cfg_append => {
passenger_root => '/usr/local/lib/ruby/gems/2.1/gems/passenger-4.0.44',
passenger_ruby => '/usr/local/bin/ruby21',
passenger_max_pool_size => '15',
}
}
```

Package source `passenger` will add [Phusion Passenger repository](https://oss-binaries.phusionpassenger.com/apt/passenger) to APT sources.
For each virtual host you should specify which ruby should be used.

Expand Down
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ CLOBBER.include('.tmp', '.librarian')

require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet_blacksmith/rake_tasks'
require 'rspec-system/rake_task'

task :default => [:clean, :spec]

PuppetLint.configuration.fail_on_warnings
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
Expand Down
9 changes: 8 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
$multi_accept = 'off',
$names_hash_bucket_size = '64',
$names_hash_max_size = '512',
$nginx_cfg_prepend = false,
$proxy_buffers = '32 4k',
$proxy_buffer_size = '8k',
$proxy_cache_inactive = '20m',
Expand Down Expand Up @@ -93,7 +94,7 @@
) inherits ::nginx::params {

### Validations ###
if (!is_string($worker_processes)) and (!is_integer($worker_processes)) {
if ($worker_processes != 'auto') and (!is_integer($worker_processes)) {
fail('$worker_processes must be an integer or have value "auto".')
}
if (!is_integer($worker_connections)) {
Expand Down Expand Up @@ -151,6 +152,12 @@
}
}

if ($nginx_cfg_prepend != false) {
if !(is_hash($nginx_cfg_prepend) or is_array($nginx_cfg_prepend)) {
fail('$nginx_cfg_prepend must be either a hash or array')
}
}

validate_string($nginx_error_log)
validate_string($http_access_log)
validate_string($proxy_headers_hash_bucket_size)
Expand Down
19 changes: 11 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@
$package_ensure = present,
$package_name = $::nginx::params::package_name,
$package_source = 'nginx',
$package_flavor = undef,
$manage_repo = $::nginx::params::manage_repo,
### END Package Configuration ###

### START Service Configuation ###
$configtest_enable = false,
$service_ensure = running,
$service_flags = undef,
$service_restart = '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
$service_name = undef,
### END Service Configuration ###
Expand Down Expand Up @@ -210,6 +212,7 @@
package_name => $package_name,
package_source => $package_source,
package_ensure => $package_ensure,
package_flavor => $package_flavor,
notify => Class['::nginx::service'],
manage_repo => $manage_repo,
}
Expand Down Expand Up @@ -281,24 +284,24 @@
sites_available_owner => $sites_available_owner,
sites_available_group => $sites_available_group,
sites_available_mode => $sites_available_mode,
require => Class['::nginx::package'],
notify => Class['::nginx::service'],
}
}
Class['::nginx::package'] -> Class['::nginx::config'] ~> Class['::nginx::service']

class { '::nginx::service':
configtest_enable => $configtest_enable,
service_ensure => $service_ensure,
service_restart => $service_restart,
service_name => $service_name,
service_flags => $service_flags,
}

create_resources('::nginx::resource::upstream', $nginx_upstreams)
create_resources('::nginx::resource::vhost', $nginx_vhosts, $nginx_vhosts_defaults)
create_resources('::nginx::resource::location', $nginx_locations)
create_resources('::nginx::resource::mailhost', $nginx_mailhosts)
create_resources('::nginx::resource::map', $string_mappings)
create_resources('::nginx::resource::geo', $geo_mappings)
create_resources('nginx::resource::upstream', $nginx_upstreams)
create_resources('nginx::resource::vhost', $nginx_vhosts, $nginx_vhosts_defaults)
create_resources('nginx::resource::location', $nginx_locations)
create_resources('nginx::resource::mailhost', $nginx_mailhosts)
create_resources('nginx::resource::map', $string_mappings)
create_resources('nginx::resource::geo', $geo_mappings)

# Allow the end user to establish relationships to the "main" class
# and preserve the relationship to the implementation classes through
Expand Down
9 changes: 8 additions & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$package_name = $::nginx::params::package_name,
$package_source = 'nginx',
$package_ensure = 'present',
$package_flavor = undef,
$manage_repo = $::nginx::params::manage_repo,
) inherits ::nginx::params {

Expand Down Expand Up @@ -57,8 +58,14 @@
source => $package_source,
}
}
'OpenBSD': {
package { $package_name:
ensure => $package_ensure,
flavor => $package_flavor,
}
}
default: {
package { 'nginx':
package { $package_name:
ensure => $package_ensure,
}
}
Expand Down
29 changes: 15 additions & 14 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,35 @@
case $package_source {
'nginx', 'nginx-stable': {
apt::source { 'nginx':
location => "http://nginx.org/packages/${distro}",
repos => 'nginx',
key => '7BD9BF62',
key_source => 'http://nginx.org/keys/nginx_signing.key',
location => "http://nginx.org/packages/${distro}",
repos => 'nginx',
key => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
}
}
'nginx-mainline': {
apt::source { 'nginx':
location => "http://nginx.org/packages/mainline/${distro}",
repos => 'nginx',
key => '7BD9BF62',
key_source => 'http://nginx.org/keys/nginx_signing.key',
location => "http://nginx.org/packages/mainline/${distro}",
repos => 'nginx',
key => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
}
}
'passenger': {
apt::source { 'nginx':
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
repos => 'main',
key => '561F9B9CAC40B2F7',
key_source => 'https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt',
required_packages => 'apt-transport-https ca-certificates',
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
repos => 'main',
key => '16378A33A6EF16762922526E561F9B9CAC40B2F7',
}

package { ['apt-transport-https', 'ca-certificates']:
ensure => 'present',
before => Apt::Source['nginx'],
}

package { 'passenger':
ensure => 'present',
require => Exec['apt_update'],
}

if $package_name != 'nginx-extras' {
warning('You must set $package_name to "nginx-extras" to enable Passenger')
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/package/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
gpgcheck => '1',
priority => '1',
gpgkey => 'http://nginx.org/keys/nginx_signing.key',
before => Package[$package_name],
before => Package['nginx'],
}
}
'nginx-mainline': {
Expand All @@ -50,7 +50,7 @@
gpgcheck => '1',
priority => '1',
gpgkey => 'http://nginx.org/keys/nginx_signing.key',
before => Package[$package_name],
before => Package['nginx'],
}
}
default: {
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
'Debian': {
if ($::operatingsystem == 'ubuntu' and $::lsbdistcodename in ['lucid', 'precise', 'trusty'])
or ($::operatingsystem == 'debian' and $::operatingsystemmajrelease in ['6', '7']) {
or ($::operatingsystem == 'debian' and $::operatingsystemmajrelease in ['6', '7', '8']) {
$_module_os_overrides = {
'manage_repo' => true,
'daemon_user' => 'www-data',
Expand Down
2 changes: 1 addition & 1 deletion manifests/resource/geo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#
# Sample Hiera usage:
#
# nginx::geos:
# nginx::geo_mappings:
# client_network:
# ensure: present
# ranges: false
Expand Down
Loading

0 comments on commit 58ef496

Please sign in to comment.