Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Commit 5443f9b

Browse files
authored
Merge pull request #230 from tampakrap/unicorn_fixes
improve the rack code in passenger and unicorn
2 parents 8fa8ae2 + d474956 commit 5443f9b

File tree

9 files changed

+44
-100
lines changed

9 files changed

+44
-100
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: ruby
33
bundler_args: --without development
44
before_install: rm Gemfile.lock || true
55
rvm:
6-
- 1.9.3
76
- 2.0.0
87
- 2.1.6
98
script: bundle exec rake test
@@ -13,10 +12,11 @@ env:
1312
- PUPPET_VERSION="~> 3.3.0"
1413
- PUPPET_VERSION="~> 3.4.0"
1514
- PUPPET_VERSION="~> 3.7.5"
16-
- PUPPET_VERSION="~> 3.7.5" FUTURE_PARSER=yes
17-
- PUPPET_VERSION="~> 3.7.5" STRINGIFY_FACTS=no
18-
- PUPPET_VERSION="~> 3.7.5" STRICT_VARIABLES=yes
19-
- PUPPET_VERSION="~> 3.7.5" ORDERING=random
15+
- PUPPET_VERSION="~> 3.8.7"
16+
- PUPPET_VERSION="~> 3.8.7" FUTURE_PARSER=yes
17+
- PUPPET_VERSION="~> 3.8.7" STRINGIFY_FACTS=no
18+
- PUPPET_VERSION="~> 3.8.7" STRICT_VARIABLES=yes
19+
- PUPPET_VERSION="~> 3.8.7" ORDERING=random
2020
matrix:
2121
exclude:
2222
- rvm: 2.0.0
@@ -28,4 +28,4 @@ matrix:
2828
- rvm: 2.1.6
2929
env: PUPPET_VERSION="~> 3.3.0"
3030
allow_failures:
31-
- env: PUPPET_VERSION="~> 3.7.5" STRICT_VARIABLES=yes
31+
- env: PUPPET_VERSION="~> 3.8.7" STRICT_VARIABLES=yes

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ source "https://rubygems.org"
22

33
group :test do
44
gem "rake"
5-
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.5'
5+
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.7'
66
gem "puppet-lint"
77
gem "rspec-puppet"
8-
gem "rspec", '< 3.0.0'
98
gem "puppet-syntax"
109
gem "puppetlabs_spec_helper"
1110
gem "metadata-json-lint"

files/config.ru.passenger.3

Lines changed: 0 additions & 33 deletions
This file was deleted.

manifests/server.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172

173173
$service = $servertype ? {
174174
'passenger' => 'httpd',
175-
'unicorn' => 'nginx',
175+
'unicorn' => 'unicorn_puppetmaster',
176176
'standalone' => $puppet::params::master_service,
177177
}
178178

manifests/server/passenger.pp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,11 @@
99
include apache
1010
include apache::mod::ssl
1111
include apache::mod::passenger
12-
13-
file { ['/etc/puppet/rack', '/etc/puppet/rack/public/', '/etc/puppet/rack/tmp']:
14-
ensure => directory,
15-
owner => 'puppet',
16-
group => 'puppet',
17-
}
18-
19-
file { '/etc/puppet/rack/config.ru':
20-
owner => 'puppet',
21-
group => 'puppet',
22-
mode => '0644',
23-
source => 'puppet:///modules/puppet/config.ru.passenger.3',
24-
}
25-
26-
if $puppet::server::bindaddress == '::' {
27-
$ip = '*'
28-
} else {
29-
$ip = $puppet::server::bindaddress
30-
}
12+
include puppet::server::rack
3113

3214
apache::vhost { 'puppetmaster':
3315
servername => $puppet::server::servername,
34-
ip => $ip,
16+
ip => $puppet::server::bindaddress,
3517
port => '8140',
3618
priority => '10',
3719
docroot => '/etc/puppet/rack/public/',

manifests/server/rack.pp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,31 @@
88
#
99
class puppet::server::rack {
1010

11+
include puppet
12+
13+
file { [
14+
"${puppet::confdir}/rack",
15+
"${puppet::confdir}/rack/public/",
16+
"${puppet::confdir}/rack/tmp"
17+
]:
18+
ensure => directory,
19+
owner => $puppet::user,
20+
group => $puppet::group,
21+
}
22+
1123
# Template variables for concat fragment
12-
$puppet_confdir = $::puppet::params::puppet_confdir
13-
$puppet_vardir = $::puppet::params::puppet_vardir
24+
$puppet_confdir = $puppet::confdir
25+
$puppet_vardir = $puppet::vardir
1426

15-
concat { "${puppet_confdir}/config.ru":
27+
concat { "${puppet::confdir}/config.ru":
1628
owner => 'puppet',
1729
group => 'puppet',
1830
mode => '0644',
1931
}
2032

2133
concat::fragment { 'run-puppet-master':
2234
order => '99',
23-
target => "${puppet_confdir}/config.ru",
35+
target => "${puppet::confdir}/config.ru",
2436
content => template('puppet/config.ru/99-run-3.0.erb'),
2537
}
2638
}

manifests/server/unicorn.pp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# Private class
12
class puppet::server::unicorn {
23

3-
include puppet::params
4+
include puppet
45
include puppet::server::rack
56
include nginx
67

@@ -12,22 +13,22 @@
1213
],
1314
}
1415

15-
$servername = pick($::puppet::server::servername, $::clientcert, $::fqdn)
16-
$unicorn_socket = "unix:${puppet::params::puppet_rundir}/puppetmaster_unicorn.sock"
16+
$unicorn_socket = "unix:${puppet::rundir}/puppetmaster_unicorn.sock"
1717

1818
nginx::resource::vhost { 'puppetmaster':
19-
server_name => [$servername],
19+
server_name => [$puppet::server::servername],
20+
listen_ip => $puppet::server::bindaddress,
2021
ssl => true,
2122
ssl_port => '8140',
2223
listen_port => '8140', # force ssl_only by matching ssl_port
23-
ssl_cert => "${::puppet::ssldir}/certs/${servername}.pem",
24-
ssl_key => "${::puppet::ssldir}/private_keys/${servername}.pem",
25-
ssl_ciphers => $::puppet::server::ssl_ciphers,
26-
ssl_protocols => $::puppet::server::ssl_protocols,
24+
ssl_cert => "${puppet::ssldir}/certs/${puppet::server::servername}.pem",
25+
ssl_key => "${puppet::ssldir}/private_keys/${puppet::server::servername}.pem",
26+
ssl_ciphers => $puppet::server::ssl_ciphers,
27+
ssl_protocols => $puppet::server::ssl_protocols,
2728
use_default_location => false,
2829
vhost_cfg_append => {
29-
ssl_crl => "${::puppet::ssldir}/crl.pem",
30-
ssl_client_certificate => "${::puppet::ssldir}/certs/ca.pem",
30+
ssl_crl => "${puppet::ssldir}/crl.pem",
31+
ssl_client_certificate => "${puppet::ssldir}/certs/ca.pem",
3132
ssl_verify_client => 'optional',
3233
proxy_set_header => [ 'Host $host',
3334
'X-Real-IP $remote_addr',
@@ -67,7 +68,7 @@
6768
vhost => 'puppetmaster',
6869
proxy_set_header => [],
6970
location_custom_cfg => {
70-
proxy_pass => $::puppet::server::external_ca,
71+
proxy_pass => $puppet::server::external_ca,
7172
proxy_redirect => 'off',
7273
proxy_connect_timeout => '90',
7374
proxy_read_timeout => '300',
@@ -79,13 +80,13 @@
7980
}
8081

8182
unicorn::app { 'puppetmaster':
82-
approot => $::puppet::params::puppet_confdir,
83-
config_file => "${::puppet::params::puppet_confdir}/unicorn.conf",
84-
pidfile => "${::puppet::params::puppet_rundir}/puppetmaster_unicorn.pid",
83+
approot => $puppet::confdir,
84+
config_file => "${puppet::confdir}/unicorn.conf",
85+
pidfile => "${puppet::rundir}/puppetmaster_unicorn.pid",
8586
socket => $unicorn_socket,
86-
logdir => $::puppet::params::puppet_logdir,
87-
user => 'puppet',
88-
group => 'puppet',
87+
logdir => $puppet::logdir,
88+
user => $puppet::user,
89+
group => $puppet::group,
8990
before => Service['nginx'],
9091
# export_home => $::confdir, # uncomment pending https://github.com/puppetlabs-operations/puppet-unicorn/pull/14
9192
}

templates/dashboard/database.yml.erb

Lines changed: 0 additions & 7 deletions
This file was deleted.

templates/dashboard/puppet-dashboard.logrotate.erb

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)