Make apache worker config not depend on role memberships
authorPeter Palfrader <peter@palfrader.org>
Sun, 15 Sep 2019 07:47:05 +0000 (09:47 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sun, 15 Sep 2019 07:47:05 +0000 (09:47 +0200)
hieradata/nodes/beach.debian.org.yaml
hieradata/nodes/buxtehude.debian.org.yaml [new file with mode: 0644]
hieradata/nodes/pinel.debian.org.yaml [new file with mode: 0644]
modules/apache2/manifests/init.pp
modules/apache2/templates/mpm_worker.erb

index a202ad6..770daa1 100644 (file)
@@ -1,3 +1,5 @@
 ---
 classes:
   - bugs_mirror
 ---
 classes:
   - bugs_mirror
+
+apache2::smaller_number_of_threads: true
diff --git a/hieradata/nodes/buxtehude.debian.org.yaml b/hieradata/nodes/buxtehude.debian.org.yaml
new file mode 100644 (file)
index 0000000..212974c
--- /dev/null
@@ -0,0 +1,2 @@
+---
+apache2::smaller_number_of_threads: true
diff --git a/hieradata/nodes/pinel.debian.org.yaml b/hieradata/nodes/pinel.debian.org.yaml
new file mode 100644 (file)
index 0000000..212974c
--- /dev/null
@@ -0,0 +1,2 @@
+---
+apache2::smaller_number_of_threads: true
index 7875bd7..dfa4b59 100644 (file)
@@ -6,7 +6,13 @@
 #
 #   include apache2
 #
 #
 #   include apache2
 #
-class apache2 {
+# @param smaller_number_of_threads by default the worker config is geared towards
+#                                  serving static/cheap content.  If the host is very
+#                                  script heavy (say the bug tracking system), set this
+#                                  to reduce the number of worker threads.
+class apache2(
+  Boolean $smaller_number_of_threads = false
+) {
   include webserver
 
   package { 'apache2':
   include webserver
 
   package { 'apache2':
index 9525998..c433bb9 100644 (file)
@@ -23,9 +23,7 @@
 #    MaxConnectionsPerChild    0
 
 <IfModule mpm_worker_module>
 #    MaxConnectionsPerChild    0
 
 <IfModule mpm_worker_module>
-<% if scope.function_has_role(['bugs_base']) or
-      scope.function_has_role(['popcon'])
-      -%>
+<% if @smaller_number_of_threads -%>
     StartServers                 2
     MinSpareThreads             25
     MaxSpareThreads             75
     StartServers                 2
     MinSpareThreads             25
     MaxSpareThreads             75