]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/apache/recipes/default.rb
Enable mod_evasive for all apache instances except render servers
[chef.git] / cookbooks / apache / recipes / default.rb
index e5f30a410855aea3fb4f6e87f0ddb4b8435fd721..aee5dfcc87564b74dfdb9bbc624a04e1a10c583b 100644 (file)
@@ -54,6 +54,13 @@ template "/etc/apache2/ports.conf" do
   mode "644"
 end
 
+systemd_service "apache2" do
+  dropin "chef"
+  memory_high "50%"
+  memory_max "75%"
+  notifies :restart, "service[apache2]"
+end
+
 service "apache2" do
   action [:enable, :start]
   retries 2
@@ -71,18 +78,17 @@ apache_module "status" do
   variables :hosts => admins["hosts"]
 end
 
-apache_module "deflate" do
-  conf "deflate.conf.erb"
+apache_module "evasive" do
+  conf "evasive.conf.erb"
+  only_if { node[:apache][:evasive] }
 end
 
-if node[:apache][:reqtimeout]
-  apache_module "reqtimeout" do
-    action [:enable]
-  end
-else
-  apache_module "reqtimeout" do
-    action [:disable]
-  end
+apache_module "brotli" do
+  conf "brotli.conf.erb"
+end
+
+apache_module "deflate" do
+  conf "deflate.conf.erb"
 end
 
 apache_module "headers"
@@ -96,8 +102,14 @@ munin_plugin "apache_accesses"
 munin_plugin "apache_processes"
 munin_plugin "apache_volume"
 
+template "/var/lib/prometheus/node-exporter/apache.prom" do
+  source "apache.prom.erb"
+  owner "root"
+  group "root"
+  mode "644"
+end
+
 prometheus_exporter "apache" do
   port 9117
-  listen_switch "telemetry.address"
-  exporter_options "-scrape_uri http://localhost/server-status?auto"
+  options "--scrape_uri=http://localhost/server-status?auto"
 end