From cd4a206a48773477b8c3a81cf31160257bc866fb Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Mon, 27 Oct 2025 13:39:38 +0100 Subject: [PATCH 1/3] add service control - https://gitlab.confdroid.com/internal/confdroid_management/-/issues/284 --- manifests/main/files.pp | 11 ++++++ manifests/params.pp | 4 ++- templates/puppetdb/puppetdb_service.erb | 48 +++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 templates/puppetdb/puppetdb_service.erb diff --git a/manifests/main/files.pp b/manifests/main/files.pp index 8993d09..129fb95 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -42,5 +42,16 @@ class puppet_cd::main::files ( content => template($pt_puppetdb_conf_erb), # notify => Service[$pt_agent_service,$pt_server_service], } + + # fix service file + file { $pt_puppetdb_service_file: + ensure => file, + path => $pt_puppetdb_service_file, + owner => 'root', + group => 'root', + mode => '0644', + content => template($pt_puppetdb_service_erb), + notify => Service[$pt_db_service], + } } } diff --git a/manifests/params.pp b/manifests/params.pp index 1a704e4..60c2d75 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -93,7 +93,7 @@ class puppet_cd::params ( String $pt_db_fqdn = 'puppetdb.example.net', # installation - String $pt_pkg_ensure = 'present', + String $pt_pkg_ensure = 'latest', String $pt_agent_pkg = 'puppet-agent', String $pt_server_pkg = 'puppetserver', Array $pt_db_pkg = ['puppetdb','puppetdb-termini'], @@ -231,6 +231,8 @@ class puppet_cd::params ( $pt_puppetdb_conf_erb = 'puppet_cd/puppetdb/puppetdb.conf.erb' $pt_puppetdb_repl_ini = "${pt_puppetdb_conf_d}/repl.ini" $pt_puppetdb_repl_erb = 'puppet_cd/puppetdb/repl.ini.erb' + $pt_puppetdb_service_file = '/usr/lib/systemd/system/puppetdb.service' + $pt_puppetdb_service_erb = 'puppet_cd/puppetdb/puppetdb_service.erb' ## r10k $pt_r10k_file = "${pt_r10k_dir}/r10k.yaml" $pt_r10k_erb = 'puppet_cd/r10k/r10k.yaml.erb' diff --git a/templates/puppetdb/puppetdb_service.erb b/templates/puppetdb/puppetdb_service.erb new file mode 100644 index 0000000..66ac171 --- /dev/null +++ b/templates/puppetdb/puppetdb_service.erb @@ -0,0 +1,48 @@ +# +# Local settings can be configured without being overwritten by package upgrades, for example +# if you want to increase puppetdb open-files-limit to 10000, +# you need to increase systemd's LimitNOFILE setting, so create a file named +# "/etc/systemd/system/puppetdb.service.d/limits.conf" containing: +# [Service] +# LimitNOFILE=10000 +# You can confirm it worked by running systemctl daemon-reload +# then running systemctl show puppetdb | grep LimitNOFILE +# +[Unit] +Description=puppetdb Service +After=syslog.target network.target nss-lookup.target + +[Service] +Type=forking +EnvironmentFile=/etc/sysconfig/puppetdb +User=puppetdb +TimeoutStartSec=14400 +TimeoutStopSec=60 +Restart=on-failure +StartLimitBurst=5 +PIDFile=/run/puppetlabs/puppetdb/puppetdb.pid + +# https://tickets.puppetlabs.com/browse/EZ-129 +# Prior to systemd v228, TasksMax was unset by default, and unlimited. Starting in 228 a default of '512' +# was implemented. This is low enough to cause problems for certain applications. In systemd 231, the +# default was changed to be 15% of the default kernel limit. This explicitly sets TasksMax to 4915, +# which should match the default in systemd 231 and later. +# See https://github.com/systemd/systemd/issues/3211#issuecomment-233676333 +TasksMax=4915 + +#set default privileges to -rw-r----- +UMask=027 + + +ExecReload=/opt/puppetlabs/server/apps/puppetdb/bin/puppetdb reload +ExecStart=/opt/puppetlabs/server/apps/puppetdb/bin/puppetdb start +ExecStop=/opt/puppetlabs/server/apps/puppetdb/bin/puppetdb stop + +KillMode=process + +SuccessExitStatus=143 + +StandardOutput=journald + +[Install] +WantedBy=multi-user.target From f482a5db2fea8eadcf550ee86923530ce3e00dff Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Mon, 27 Oct 2025 13:40:10 +0100 Subject: [PATCH 2/3] add service control - https://gitlab.confdroid.com/internal/confdroid_management/-/issues/284 --- manifests/main/files.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/main/files.pp b/manifests/main/files.pp index 129fb95..47c5f7b 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -43,7 +43,7 @@ class puppet_cd::main::files ( # notify => Service[$pt_agent_service,$pt_server_service], } - # fix service file + # fix service file syslog vs journald file { $pt_puppetdb_service_file: ensure => file, path => $pt_puppetdb_service_file, From fae2421e33b7677de080837bf8a2d20be9116461 Mon Sep 17 00:00:00 2001 From: Jenkins Server Date: Mon, 27 Oct 2025 13:41:44 +0100 Subject: [PATCH 3/3] Recommit for updates in build 70 --- .../puppet_cd_3A_3Amain_3A_3Afiles.html | 24 ++++++++++++++++++- doc/puppet_classes/puppet_cd_3A_3Aparams.html | 10 +++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html b/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html index 9842bf1..3297907 100644 --- a/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html +++ b/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html @@ -141,7 +141,18 @@ 43 44 45 -46 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57
# File 'manifests/main/files.pp', line 6
@@ -185,6 +196,17 @@ class puppet_cd::main::files (
       content => template($pt_puppetdb_conf_erb),
 #      notify  => Service[$pt_agent_service,$pt_server_service],
     }
+
+    # fix service file syslog vs journald
+    file { $pt_puppetdb_service_file:
+      ensure  => file,
+      path    => $pt_puppetdb_service_file,
+      owner   => 'root',
+      group   => 'root',
+      mode    => '0644',
+      content => template($pt_puppetdb_service_erb),
+      notify  => Service[$pt_db_service],
+    }
   }
 }
diff --git a/doc/puppet_classes/puppet_cd_3A_3Aparams.html b/doc/puppet_classes/puppet_cd_3A_3Aparams.html index 2acb544..956bbd3 100644 --- a/doc/puppet_classes/puppet_cd_3A_3Aparams.html +++ b/doc/puppet_classes/puppet_cd_3A_3Aparams.html @@ -180,7 +180,7 @@ (String) - (defaults to: 'present') + (defaults to: 'latest') — @@ -1694,7 +1694,9 @@ 247 248 249 -250 +250 +251 +252
# File 'manifests/params.pp', line 89
@@ -1706,7 +1708,7 @@ class puppet_cd::params (
   String $pt_db_fqdn                = 'puppetdb.example.net',
 
   # installation
-  String $pt_pkg_ensure             = 'present',
+  String $pt_pkg_ensure             = 'latest',
   String $pt_agent_pkg              = 'puppet-agent',
   String $pt_server_pkg             = 'puppetserver',
   Array $pt_db_pkg                  = ['puppetdb','puppetdb-termini'],
@@ -1844,6 +1846,8 @@ class puppet_cd::params (
   $pt_puppetdb_conf_erb             = 'puppet_cd/puppetdb/puppetdb.conf.erb'
   $pt_puppetdb_repl_ini             = "${pt_puppetdb_conf_d}/repl.ini"
   $pt_puppetdb_repl_erb             = 'puppet_cd/puppetdb/repl.ini.erb'
+  $pt_puppetdb_service_file         = '/usr/lib/systemd/system/puppetdb.service'
+  $pt_puppetdb_service_erb          = 'puppet_cd/puppetdb/puppetdb_service.erb'
 ## r10k
   $pt_r10k_file                     = "${pt_r10k_dir}/r10k.yaml"
   $pt_r10k_erb                      = 'puppet_cd/r10k/r10k.yaml.erb'