Skip to content

Commit 9c41392

Browse files
committed
Add missing parameters for 1.4.0 release
This patch adds all the missing parameters now defined in the 1.4.0 release. This includes some new database parameters mainly, but also adds gc_interval to the `puppetdb` and `puppetdb::server` classes, as previously this wasn't configurable using this method. To avoid documentation duplication the Puppet headers have been removed in favour of documenting classes from the README.md. Until such times as the forge can turn Puppet docs into HTML automatically, this is just duplicate noise and prone to update slippage. The README.md is more authoritative in this area and is pubicly displayed on the forge project page so it should be used for now. Signed-off-by: Ken Barber <ken@bob.sh>
1 parent 45f9de1 commit 9c41392

5 files changed

Lines changed: 74 additions & 205 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,34 @@ The length of time a node can be deactivated before it's deleted from the databa
209209

210210
The length of time reports should be stored before being deleted. (defaults to '7d', which is a 7-day period). This option is supported in PuppetDB >= 1.1.0.
211211

212+
####`gc_interval`
213+
214+
This controls how often, in minutes, to compact the database. The compaction process reclaims space and deletes unnecessary rows. If not supplied, the default is every 60 minutes.
215+
216+
####`log_slow_statements`
217+
218+
This sets the number of seconds before an SQL query is considered "slow." Slow SQL queries are logged as warnings, to assist in debugging and tuning. Note PuppetDB does not interrupt slow queries; it simply reports them after they complete.
219+
220+
The default value is 10 seconds. A value of 0 will disable logging of slow queries.
221+
222+
####`conn_max_age`
223+
224+
The maximum time (in minutes), for a pooled connection to remain unused before it is closed off.
225+
226+
If not supplied, we default to 60 minutes.
227+
228+
####`conn_keep_alive`
229+
230+
This sets the time (in minutes), for a connection to remain idle before sending a test query to the DB. This is useful to prevent a DB from timing out connections on its end.
231+
232+
If not supplied, we default to 45 minutes.
233+
234+
####`conn_lifetime`
235+
236+
The maximum time (in minutes) a pooled connection should remain open. Any connections older than this setting will be closed off. Connections currently in use will not be affected until they are returned to the pool.
237+
238+
If not supplied, we won't terminate connections based on their age alone.
239+
212240
####`puppetdb_package`
213241

214242
The puppetdb package name in the package manager.

manifests/init.pp

Lines changed: 6 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Class: puppetdb
2-
#
31
# This class provides a simple way to get a puppetdb instance up and running
42
# with minimal effort. It will install and configure all necessary packages,
53
# including the database server and instance.
@@ -13,81 +11,6 @@
1311
#
1412
# In addition to this class, you'll need to configure your puppet master to use
1513
# puppetdb. You can use the `puppetdb::master::config` class to accomplish this.
16-
#
17-
# Parameters:
18-
# ['listen_address'] - The address that the web server should bind to
19-
# for HTTP requests. (defaults to `localhost`.
20-
# '0.0.0.0' = all)
21-
# ['listen_port'] - The port on which the puppetdb web server should
22-
# accept HTTP requests (defaults to 8080).
23-
# ['open_listen_port'] - If true, open the http listen port on the firewall.
24-
# (defaults to false).
25-
# ['ssl_listen_address'] - The address that the web server should bind to
26-
# for HTTPS requests. (defaults to `$::fqdn`.)
27-
# Set to '0.0.0.0' to listen on all addresses.
28-
# ['ssl_listen_port'] - The port on which the puppetdb web server should
29-
# accept HTTPS requests (defaults to 8081).
30-
# ['disable_ssl'] - If true, disable HTTPS and only serve
31-
# HTTP requests. Defaults to false.
32-
# ['open_ssl_listen_port'] - If true, open the ssl listen port on the firewall.
33-
# (defaults to true).
34-
# ['database'] - Which database backend to use; legal values are
35-
# `postgres` (default) or `embedded`. (The `embedded`
36-
# db can be used for very small installations or for
37-
# testing, but is not recommended for use in production
38-
# environments. For more info, see the puppetdb docs.)
39-
# ['database_port'] - The port that the database server listens on.
40-
# (defaults to `5432`; ignored for `embedded` db)
41-
# ['database_username'] - The name of the database user to connect as.
42-
# (defaults to `puppetdb`; ignored for `embedded` db)
43-
# ['database_password'] - The password for the database user.
44-
# (defaults to `puppetdb`; ignored for `embedded` db)
45-
# ['database_name'] - The name of the database instance to connect to.
46-
# (defaults to `puppetdb`; ignored for `embedded` db)
47-
# ['node_ttl'] - The length of time a node can go without receiving
48-
# any new data before it's automatically deactivated.
49-
# (defaults to '0', which disables auto-deactivation)
50-
# This option is supported in PuppetDB >= 1.1.0.
51-
# ['node_purge_ttl'] - The length of time a node can be deactivated before
52-
# it's deleted from the database.
53-
# (defaults to '0', which disables purging)
54-
# This option is supported in PuppetDB >= 1.2.0.
55-
# ['report_ttl'] - The length of time reports should be stored before
56-
# being deleted.
57-
# (defaults to '7d', which is a 7-day period)
58-
# This option is supported in PuppetDB >= 1.1.0.
59-
# ['open_postgres_port'] - If true, open the postgres port on the firewall.
60-
# (defaults to true).
61-
# ['puppetdb_package'] - The puppetdb package name in the package manager
62-
# ['puppetdb_version'] - The version of the `puppetdb` package that should
63-
# be installed. You may specify an explicit version
64-
# number, 'present', or 'latest'. (defaults to
65-
# 'present')
66-
# ['puppetdb_service'] - The name of the puppetdb service.
67-
# ['manage_redhat_firewall'] - DEPRECATED: Use open_ssl_listen_port instead.
68-
# boolean indicating whether or not the module
69-
# should open a port in the firewall on redhat-based
70-
# systems. Defaults to `false`. This parameter is
71-
# likely to change in future versions. Possible
72-
# changes include support for non-RedHat systems and
73-
# finer-grained control over the firewall rule
74-
# (currently, it simply opens up the postgres port to
75-
# all TCP connections).
76-
# ['confdir'] - The puppetdb configuration directory; defaults to
77-
# `/etc/puppetdb/conf.d`.
78-
# ['java_args'] - Java VM options used for overriding default Java VM
79-
# options specified in PuppetDB package.
80-
# (defaults to `{}`).
81-
# e.g. { '-Xmx' => '512m', '-Xms' => '256m' }
82-
# Actions:
83-
# - Creates and manages a puppetdb server and its database server/instance.
84-
#
85-
# Requires:
86-
# - `inkling/postgresql`
87-
#
88-
# Sample Usage:
89-
# include puppetdb
90-
#
9114
class puppetdb(
9215
$listen_address = $puppetdb::params::listen_address,
9316
$listen_port = $puppetdb::params::listen_port,
@@ -104,6 +27,11 @@
10427
$node_ttl = $puppetdb::params::node_ttl,
10528
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
10629
$report_ttl = $puppetdb::params::report_ttl,
30+
$gc_interval = $puppetdb::params::gc_interval,
31+
$log_slow_statements = $puppetdb::params::log_slow_statements,
32+
$conn_max_age = $puppetdb::params::conn_max_age,
33+
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
34+
$conn_lifetime = $puppetdb::params::conn_lifetime,
10735
$puppetdb_package = $puppetdb::params::puppetdb_package,
10836
$puppetdb_version = $puppetdb::params::puppetdb_version,
10937
$puppetdb_service = $puppetdb::params::puppetdb_service,
@@ -163,6 +91,7 @@
16391
node_ttl => $node_ttl,
16492
node_purge_ttl => $node_purge_ttl,
16593
report_ttl => $report_ttl,
94+
gc_interval => $gc_interval,
16695
puppetdb_package => $puppetdb_package,
16796
puppetdb_version => $puppetdb_version,
16897
puppetdb_service => $puppetdb_service,

manifests/params.pp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
# Class: puppetdb::params
2-
#
3-
# The puppetdb configuration settings.
4-
#
5-
# Parameters:
6-
#
7-
# Actions:
8-
#
9-
# Requires:
10-
#
11-
# Sample Usage:
12-
#
1+
# The puppetdb default configuration settings.
132
class puppetdb::params {
143
$listen_address = 'localhost'
154
$listen_port = '8080'
@@ -54,6 +43,11 @@
5443

5544
$gc_interval = '60'
5645

46+
$log_slow_statements = '10'
47+
$conn_max_age = '60'
48+
$conn_keep_alive = '45'
49+
$conn_lifetime = '0'
50+
5751
case $::osfamily {
5852
'RedHat': {
5953
$firewall_supported = true

manifests/server.pp

Lines changed: 10 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Class: puppetdb::server
2-
#
31
# This class provides a simple way to get a puppetdb instance up and running
42
# with minimal effort. It will install and configure all necessary packages for
53
# the puppetdb server, but will *not* manage the database (e.g., postgres) server
@@ -20,83 +18,6 @@
2018
#
2119
# You'll also need to configure your puppet master to use puppetdb. You can
2220
# use the `puppetdb::master::config` class to accomplish this.
23-
#
24-
# Parameters:
25-
# ['listen_address'] - The address that the web server should bind to
26-
# for HTTP requests. (defaults to `localhost`.)
27-
# Set to '0.0.0.0' to listen on all addresses.
28-
# ['listen_port'] - The port on which the puppetdb web server should
29-
# accept HTTP requests (defaults to 8080).
30-
# ['open_listen_port'] - If true, open the http listen port on the firewall.
31-
# (defaults to false).
32-
# ['ssl_listen_address'] - The address that the web server should bind to
33-
# for HTTPS requests. (defaults to `$::fqdn`.)
34-
# Set to '0.0.0.0' to listen on all addresses.
35-
# ['ssl_listen_port'] - The port on which the puppetdb web server should
36-
# accept HTTPS requests (defaults to 8081).
37-
# ['disable_ssl'] - If true, disable HTTPS and only serve
38-
# HTTP requests. Defaults to false.
39-
# ['open_ssl_listen_port'] - If true, open the ssl listen port on the firewall.
40-
# (defaults to true).
41-
# ['database'] - Which database backend to use; legal values are
42-
# `postgres` (default) or `embedded`. (The `embedded`
43-
# db can be used for very small installations or for
44-
# testing, but is not recommended for use in production
45-
# environments. For more info, see the puppetdb docs.)
46-
# ['database_host'] - The hostname or IP address of the database server.
47-
# (defaults to `localhost`; ignored for `embedded` db)
48-
# ['database_port'] - The port that the database server listens on.
49-
# (defaults to `5432`; ignored for `embedded` db)
50-
# ['database_username'] - The name of the database user to connect as.
51-
# (defaults to `puppetdb`; ignored for `embedded` db)
52-
# ['database_password'] - The password for the database user.
53-
# (defaults to `puppetdb`; ignored for `embedded` db)
54-
# ['database_name'] - The name of the database instance to connect to.
55-
# (defaults to `puppetdb`; ignored for `embedded` db)
56-
# ['node_ttl'] - The length of time a node can go without receiving
57-
# any new data before it's automatically deactivated.
58-
# (defaults to '0', which disables auto-deactivation)
59-
# This option is supported in PuppetDB >= 1.1.0.
60-
# ['node_purge_ttl'] - The length of time a node can be deactivated before
61-
# it's deleted from the database.
62-
# (defaults to '0', which disables purging)
63-
# This option is supported in PuppetDB >= 1.2.0.
64-
# ['report_ttl'] - The length of time reports should be stored before
65-
# being deleted.
66-
# (defaults to '7d', which is a 7-day period)
67-
# This option is supported in PuppetDB >= 1.1.0.
68-
# ['puppetdb_package'] - The puppetdb package name in the package manager
69-
# ['puppetdb_version'] - The version of the `puppetdb` package that should
70-
# be installed. You may specify an explicit version
71-
# number, 'present', or 'latest'. Defaults to
72-
# 'present'.
73-
# ['puppetdb_service'] - The name of the puppetdb service.
74-
# ['manage_redhat_firewall'] - DEPRECATED: Use open_ssl_listen_port instead.
75-
# boolean indicating whether or not the module
76-
# should open a port in the firewall on redhat-based
77-
# systems. Defaults to `true`. This parameter is
78-
# likely to change in future versions. Possible
79-
# changes include support for non-RedHat systems and
80-
# finer-grained control over the firewall rule
81-
# (currently, it simply opens up the postgres port to
82-
# all TCP connections).
83-
# ['confdir'] - The puppetdb configuration directory; defaults to
84-
# `/etc/puppetdb/conf.d`.
85-
# ['java_args'] - Java VM options used for overriding default Java VM
86-
# options specified in PuppetDB package.
87-
# (defaults to `{}`).
88-
# e.g. { '-Xmx' => '512m', '-Xms' => '256m' }
89-
# Actions:
90-
# - Creates and manages a puppetdb server
91-
#
92-
# Requires:
93-
# - `inkling/postgresql`
94-
#
95-
# Sample Usage:
96-
# class { 'puppetdb::server':
97-
# database_host => 'puppetdb-postgres',
98-
# }
99-
#
10021
class puppetdb::server(
10122
$listen_address = $puppetdb::params::listen_address,
10223
$listen_port = $puppetdb::params::listen_port,
@@ -114,6 +35,11 @@
11435
$node_ttl = $puppetdb::params::node_ttl,
11536
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
11637
$report_ttl = $puppetdb::params::report_ttl,
38+
$gc_interval = $puppetdb::params::gc_interval,
39+
$log_slow_statements = $puppetdb::params::log_slow_statements,
40+
$conn_max_age = $puppetdb::params::conn_max_age,
41+
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
42+
$conn_lifetime = $puppetdb::params::lifetime,
11743
$puppetdb_package = $puppetdb::params::puppetdb_package,
11844
$puppetdb_version = $puppetdb::params::puppetdb_version,
11945
$puppetdb_service = $puppetdb::params::puppetdb_service,
@@ -175,6 +101,11 @@
175101
node_ttl => $node_ttl,
176102
node_purge_ttl => $node_purge_ttl,
177103
report_ttl => $report_ttl,
104+
gc_interval => $gc_interval,
105+
log_slow_statements => $log_slow_statements,
106+
conn_max_age => $conn_max_age,
107+
conn_keep_alive => $conn_keep_alive,
108+
conn_lifetime => $conn_lifetime,
178109
confdir => $confdir,
179110
notify => Service[$puppetdb_service],
180111
}

manifests/server/database_ini.pp

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,4 @@
1-
# Class: puppetdb::server::database_ini
2-
#
31
# This class manages puppetdb's `database.ini` file.
4-
#
5-
# Parameters:
6-
# ['database'] - Which database backend to use; legal values are
7-
# `postgres` (default) or `embedded`. (The `embedded`
8-
# db can be used for very small installations or for
9-
# testing, but is not recommended for use in production
10-
# environments. For more info, see the puppetdb docs.)
11-
# ['database_host'] - The hostname or IP address of the database server.
12-
# (defaults to `localhost`; ignored for `embedded` db)
13-
# ['database_port'] - The port that the database server listens on.
14-
# (defaults to `5432`; ignored for `embedded` db)
15-
# ['database_user'] - The name of the database user to connect as.
16-
# (defaults to `puppetdb`; ignored for `embedded` db)
17-
# ['database_password'] - The password for the database user.
18-
# (defaults to `puppetdb`; ignored for `embedded` db)
19-
# ['database_name'] - The name of the database instance to connect to.
20-
# (defaults to `puppetdb`; ignored for `embedded` db)
21-
# ['confdir'] - The puppetdb configuration directory; defaults to
22-
# `/etc/puppetdb/conf.d`.
23-
#
24-
# Actions:
25-
# - Manages puppetdb's `database.ini` file
26-
#
27-
# Requires:
28-
# - Inifile
29-
#
30-
# Sample Usage:
31-
# class { 'puppetdb::server::database_ini':
32-
# database_host => 'my.postgres.host',
33-
# database_port => '5432',
34-
# database_username => 'puppetdb_pguser',
35-
# database_password => 'puppetdb_pgpasswd',
36-
# database_name => 'puppetdb',
37-
# }
38-
#
392
class puppetdb::server::database_ini(
403
$database = $puppetdb::params::database,
414
$database_host = $puppetdb::params::database_host,
@@ -47,6 +10,10 @@
4710
$node_purge_ttl = $puppetdb::params::node_purge_ttl,
4811
$report_ttl = $puppetdb::params::report_ttl,
4912
$gc_interval = $puppetdb::params::gc_interval,
13+
$log_slow_statements = $puppetdb::params::log_slow_statements,
14+
$conn_max_age = $puppetdb::params::conn_max_age,
15+
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
16+
$conn_lifetime = $puppetdb::params::conn_lifetime,
5017
$confdir = $puppetdb::params::confdir,
5118
) inherits puppetdb::params {
5219

@@ -132,4 +99,24 @@
13299
setting => 'report-ttl',
133100
value => $report_ttl,
134101
}
102+
103+
ini_setting {'puppetdb_log_slow_statements':
104+
setting => 'log-slow-statements',
105+
value => $log_slow_statements,
106+
}
107+
108+
ini_setting {'puppetdb_conn_max_age':
109+
setting => 'conn-max-age',
110+
value => $conn_max_age,
111+
}
112+
113+
ini_setting {'puppetdb_conn_keep_alive':
114+
setting => 'conn-keep-alive',
115+
value => $conn_keep_alive,
116+
}
117+
118+
ini_setting {'puppetdb_conn_lifetime':
119+
setting => 'conn-lifetime',
120+
value => $conn_lifetime,
121+
}
135122
}

0 commit comments

Comments
 (0)