Skip to content

Commit 3272b29

Browse files
author
Tim Meusel
committed
add ability to adjust unicorn worker
1 parent 62ca99b commit 3272b29

File tree

4 files changed

+57
-52
lines changed

4 files changed

+57
-52
lines changed

manifests/master.pp

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,45 @@
33
# This class installs and configures a Puppet master
44
#
55
# Parameters:
6-
# ['user_id'] - The userid of the puppet user
7-
# ['group_id'] - The groupid of the puppet group
8-
# ['modulepath'] - Module path to be served by the puppet master
9-
# ['manifest'] - Manifest path
10-
# ['external_nodes'] - ENC script path
11-
# ['node_terminus'] - Node terminus setting, is overridden to 'exec' if external_nodes is set
12-
# ['hiera_config'] - Hiera config file path
13-
# ['environments'] - Which environment method (directory or config)
14-
# ['environmentpath'] - Puppet environment base path (use with environments directory)
15-
# ['reports'] - Turn on puppet reports
16-
# ['storeconfigs'] - Use storedconfigs
17-
# ['storeconfigs_dbserver'] - Puppetdb server
18-
# ['storeconfigs_dbport'] - Puppetdb port
19-
# ['certname'] - The certname the puppet master should use
20-
# ['autosign'] - Auto sign agent certificates default false
21-
# ['reporturl'] - Url to send reports to, if reporting enabled
22-
# ['puppet_ssldir'] - Puppet sll directory
23-
# ['puppet_docroot'] - Doc root to be configured in apache vhost
24-
# ['puppet_vardir'] - Vardir used by puppet
25-
# ['puppet_proxy_port'] - Port to configure the proxy on - default 8140
26-
# ['puppet_master_package'] - Puppet master package
27-
# ['puppet_master_service'] - Puppet master service
28-
# ['version'] - Version of the puppet master package to install
29-
# ['apache_serveradmin'] - Apache server admin
30-
# ['pluginsync'] - Enable plugin sync
31-
# ['parser'] - Which parser to use
32-
# ['puppetdb_startup_timeout'] - The timeout for puppetdb
33-
# ['dns_alt_names'] - Comma separated list of alternative DNS names
34-
# ['digest_algorithm'] - The algorithm to use for file digests.
35-
# ['webserver'] - install 'nginx' (with unicorn) or 'httpd' (with passenger) - httpd is default
36-
# ['listen_address'] - IP for binding the webserver, defaults to *
37-
# ['disable_ssl'] - Disables SSL on the webserver. usefull if you use this master behind a loadbalancer. currently only supported by nginx, defaults to undef
38-
# ['backup_upstream'] - specify another puppet master as fallback. currently only supported by nginx
39-
# ['unicorn_package'] - package name of a unicorn rpm. if provided we install it, otherwise we built it via gem/gcc
40-
# ['unicorn_path'] - custom path to the unicorn binary
41-
# ['generate_ssl_certs'] - Generate ssl certs (false to disable)
42-
# ['disable_master'] - this disables the normal master, the server will only act as a CA, currently only supported by nginx
43-
# ['upstream'] - define additional masters reachable via tcp as an array, currently only supported by nginx
6+
# ['user_id'] - The userid of the puppet user
7+
# ['group_id'] - The groupid of the puppet group
8+
# ['modulepath'] - Module path to be served by the puppet master
9+
# ['manifest'] - Manifest path
10+
# ['external_nodes'] - ENC script path
11+
# ['node_terminus'] - Node terminus setting, is overridden to 'exec' if external_nodes is set
12+
# ['hiera_config'] - Hiera config file path
13+
# ['environments'] - Which environment method (directory or config)
14+
# ['environmentpath'] - Puppet environment base path (use with environments directory)
15+
# ['reports'] - Turn on puppet reports
16+
# ['storeconfigs'] - Use storedconfigs
17+
# ['storeconfigs_dbserver'] - Puppetdb server
18+
# ['storeconfigs_dbport'] - Puppetdb port
19+
# ['certname'] - The certname the puppet master should use
20+
# ['autosign'] - Auto sign agent certificates default false
21+
# ['reporturl'] - Url to send reports to, if reporting enabled
22+
# ['puppet_ssldir'] - Puppet sll directory
23+
# ['puppet_docroot'] - Doc root to be configured in apache vhost
24+
# ['puppet_vardir'] - Vardir used by puppet
25+
# ['puppet_proxy_port'] - Port to configure the proxy on - default 8140
26+
# ['puppet_master_package'] - Puppet master package
27+
# ['puppet_master_service'] - Puppet master service
28+
# ['version'] - Version of the puppet master package to install
29+
# ['apache_serveradmin'] - Apache server admin
30+
# ['pluginsync'] - Enable plugin sync
31+
# ['parser'] - Which parser to use
32+
# ['puppetdb_startup_timeout'] - The timeout for puppetdb
33+
# ['dns_alt_names'] - Comma separated list of alternative DNS names
34+
# ['digest_algorithm'] - The algorithm to use for file digests.
35+
# ['webserver'] - install 'nginx' (with unicorn) or 'httpd' (with passenger) - httpd is default
36+
# ['listen_address'] - IP for binding the webserver, defaults to *
37+
# ['disable_ssl'] - Disables SSL on the webserver. usefull if you use this master behind a loadbalancer. currently only supported by nginx, defaults to undef
38+
# ['backup_upstream'] - specify another puppet master as fallback. currently only supported by nginx
39+
# ['unicorn_package'] - package name of a unicorn rpm. if provided we install it, otherwise we built it via gem/gcc
40+
# ['unicorn_path'] - custom path to the unicorn binary
41+
# ['generate_ssl_certs'] - Generate ssl certs (false to disable)
42+
# ['disable_master'] - this disables the normal master, the server will only act as a CA, currently only supported by nginx
43+
# ['upstream'] - define additional masters reachable via tcp as an array, currently only supported by nginx
44+
# ['backend_process_number'] - number of processes to start on the backebd webserver (unicorn/passenger), currently only supported by unicorn
4445
#
4546
# Requires:
4647
#
@@ -103,6 +104,7 @@
103104
$puppetdb_version = 'present',
104105
$disable_master = $::puppet::params::disable_master,
105106
$upstream = $::puppet::params::upstream,
107+
$backend_process_number = $::puppet::params:backend_process_number,
106108
) inherits puppet::params {
107109

108110
anchor { 'puppet::master::begin': }
@@ -142,18 +144,19 @@
142144
nginx: {
143145
Anchor['puppet::master::begin'] ->
144146
class {'puppet::unicorn':
145-
certname => $certname,
146-
puppet_conf => $puppet_conf,
147-
puppet_ssldir => $puppet_ssldir,
148-
dns_alt_names => $dns_alt_names,
149-
listen_address => $listen_address,
150-
puppet_proxy_port => $puppet_proxy_port,
151-
disable_ssl => $disable_ssl,
152-
backup_upstream => $backup_upstream,
153-
unicorn_package => $unicorn_package,
154-
unicorn_path => $unicorn_path,
155-
disable_master => $disable_master,
156-
upstream => $upstream,
147+
certname => $certname,
148+
puppet_conf => $puppet_conf,
149+
puppet_ssldir => $puppet_ssldir,
150+
dns_alt_names => $dns_alt_names,
151+
listen_address => $listen_address,
152+
puppet_proxy_port => $puppet_proxy_port,
153+
disable_ssl => $disable_ssl,
154+
backup_upstream => $backup_upstream,
155+
unicorn_package => $unicorn_package,
156+
unicorn_path => $unicorn_path,
157+
disable_master => $disable_master,
158+
upstream => $upstream,
159+
backend_process_number => $backend_process_number,
157160
} ->
158161
Anchor['puppet::master::end']
159162
}

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
$unicorn_path = '/usr/local/bin/unicorn'
4040
$disable_master = false
4141
$upstream = []
42+
$backend_process_number = $::processorcount
4243

4344
# Only used when environments == directory
4445
$environmentpath = "${confdir}/environments"

manifests/unicorn.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
$unicorn_path,
4444
$disable_master,
4545
$upstream,
46+
$backend_process_number,
4647
){
4748
class { '::nginx':
4849
worker_processes => $::processorcount,
@@ -70,7 +71,7 @@
7071
}
7172
file {'unicorn-conf':
7273
path => '/etc/puppet/unicorn.conf',
73-
source => 'puppet:///modules/puppet/unicorn.conf',
74+
content => template('puppet:///modules/puppet/unicorn.conf'),
7475
} ->
7576
file {'copy-config':
7677
path => '/etc/puppet/config.ru',

files/unicorn.conf renamed to templates/unicorn.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
worker_processes 16
1+
worker_processes <%= @backend_process_number %>;
22
working_directory "/etc/puppet"
33
listen '/var/run/puppet/puppetmaster_unicorn.sock', :backlog => 512
44
timeout 180

0 commit comments

Comments
 (0)