Configure shared TCP fastopen keys for tile and www
authorTom Hughes <tom@compton.nu>
Thu, 30 May 2019 17:55:38 +0000 (18:55 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 30 May 2019 17:57:02 +0000 (18:57 +0100)
cookbooks/networking/recipes/default.rb
roles/tilecache.rb
roles/web-frontend.rb

index 822f9042f1c0c89929b05e228e05aa679c4b2ed6..8b6b1f35f64f6a3f7c53585d960c870035e93b25 100644 (file)
@@ -198,6 +198,17 @@ template "/etc/systemd/resolved.conf.d/99-chef.conf" do
   notifies :restart, "service[systemd-resolved]"
 end
 
+if node[:networking][:tcp_fastopen_key]
+  fastopen_keys = data_bag_item("networking", "fastopen")
+
+  node.normal[:sysctl][:tcp_fastopen] = {
+    :comment => "Set shared key for TCP fast open",
+    :parameters => {
+      "net.ipv4.tcp_fastopen_key" => fastopen_keys[node[:networking][:tcp_fastopen_key]]
+    }
+  }
+end
+
 node.interfaces(:role => :internal) do |interface|
   if interface[:gateway] && interface[:gateway] != interface[:address]
     search(:node, "networking_interfaces*address:#{interface[:gateway]}") do |gateway|
index e2cad2518cfa613ce49684c12019a818b42c2793..a2e595f3bf93b20a9821fcb0487f3bbc2fc2904f 100644 (file)
@@ -12,6 +12,9 @@ default_attributes(
   :apt => {
     :sources => ["nginx"]
   },
+  :networking => {
+    :tcp_fastopen_key => "tile"
+  },
   :nginx => {
     :access_log => false
   },
index 5010e555dfaca959e8f53074231ada3efc929659..741a40b901e3cf3db3dbc7f7b461c9c13c99a66b 100644 (file)
@@ -21,6 +21,9 @@ default_attributes(
       ]
     }
   },
+  :networking => {
+    :tcp_fastopen_key => "www"
+  },
   :passenger => {
     :max_pool_size => 50
   },