]> git.openstreetmap.org Git - chef.git/commitdiff
Merge pull request #332 from Firefishy/git-civicrm-fix
authorGrant <git@firefishy.com>
Thu, 20 Aug 2020 11:18:00 +0000 (12:18 +0100)
committerGitHub <noreply@github.com>
Thu, 20 Aug 2020 11:18:00 +0000 (12:18 +0100)
civicrm: checkout full depth on extensions

cookbooks/geoipupdate/metadata.rb
cookbooks/geoipupdate/recipes/default.rb
cookbooks/systemd/resources/service.rb
cookbooks/systemd/templates/default/service.erb
cookbooks/web/resources/rails_port.rb

index 78d65c5fa7443a439a2902e8e7d89b8b065f60e7..ccc09f6261ddd230c09ca6b8ed4e88bc201a05e4 100644 (file)
@@ -7,3 +7,4 @@ description       "Installs and configures geoipupdate"
 version           "1.0.0"
 supports          "ubuntu"
 depends           "apt"
+depends           "systemd"
index b27b439b6da53a9e921e5175735a541ce7ae5aa9..27d6478ae7f118d796e65daf1bde19af090c0196 100644 (file)
@@ -21,6 +21,19 @@ include_recipe "apt"
 
 license_keys = data_bag_item("geoipupdate", "license-keys")
 
+package "geoip-database" do
+  action :purge
+end
+
+package "geoip-database-contrib" do
+  action :purge
+end
+
+package "geoipupdate" do
+  action :purge
+  only_if { ::File.exist?("/etc/cron.d/geoipupdate") }
+end
+
 package "geoipupdate"
 
 template "/etc/GeoIP.conf" do
@@ -31,13 +44,39 @@ template "/etc/GeoIP.conf" do
   variables :license_keys => license_keys
 end
 
-execute "geoipdate" do
+execute "geoipupdate" do
   command "geoipupdate"
   user "root"
   group "root"
   not_if { ENV.key?("TEST_KITCHEN") || node[:geoipupdate][:editions].all? { |edition| ::File.exist?("/usr/share/GeoIP/#{edition}.mmdb") } }
 end
 
+systemd_service "geoipdate" do
+  action :delete
+end
+
+systemd_service "geoipupdate" do
+  description "Update GeoIP databases"
+  user "root"
+  exec_start "/usr/bin/geoipupdate"
+  private_tmp true
+  private_devices true
+  protect_system "strict"
+  protect_home true
+  read_write_paths "/usr/share/GeoIP"
+end
+
+systemd_timer "geoipupdate" do
+  description "Update GeoIP databases"
+  on_boot_sec "15m"
+  on_unit_active_sec "7d"
+  randomized_delay_sec "4h"
+end
+
+service "geoipupdate.timer" do
+  action [:enable, :start]
+end
+
 directory "/var/lib/GeoIP" do
   action :delete
   recursive true
index 9db776470c8d6c56805adf5500563ec8be302596..26cce29787447d617fe5d58c3382b72efb23a04b 100644 (file)
@@ -57,6 +57,9 @@ property :private_devices, [true, false]
 property :private_network, [true, false]
 property :protect_system, [TrueClass, FalseClass, String]
 property :protect_home, [TrueClass, FalseClass, String]
+property :read_write_paths, [String, Array]
+property :read_only_paths, [String, Array]
+property :inaccessible_paths, [String, Array]
 property :restrict_address_families, [String, Array]
 property :no_new_privileges, [true, false]
 property :tasks_max, Integer
index 4828c96af6dd898da6ccad9821bd802ce545720c..6d8a603cc0c01a92c84f71dab81794ecacaedafd 100644 (file)
@@ -108,6 +108,15 @@ ProtectSystem=<%= @protect_system %>
 <% if @protect_home -%>
 ProtectHome=<%= @protect_home %>
 <% end -%>
+<% if @read_write_paths -%>
+ReadWritePaths=<%= Array(@read_write_paths).join(" ") %>
+<% end -%>
+<% if @read_only_paths -%>
+ReadOnlyPaths=<%= Array(@read_only_paths).join(" ") %>
+<% end -%>
+<% if @inaccessible_paths -%>
+InaccessiblePaths=<%= Array(@inaccessible_paths).join(" ") %>
+<% end -%>
 <% if @restrict_address_families -%>
 RestrictAddressFamilies=<%= Array(@restrict_address_families).join(" ") %>
 <% end -%>
index 6395fb1d53b6aca8600a731a5630cd07eceda6a8..f8ee4ca2e1b09d8c5dfcddc21489129b0469de32 100644 (file)
@@ -80,7 +80,6 @@ action :create do
     ruby#{new_resource.ruby}-dev
     imagemagick
     nodejs
-    geoip-database
     tzdata
   ]
 
@@ -181,7 +180,6 @@ action :create do
 
     line.gsub!(/^( *)#geonames_username:.*$/, "\\1geonames_username: \"openstreetmap\"")
 
-    line.gsub!(/^( *)#geoip_database:.*$/, "\\1geoip_database: \"/usr/share/GeoIP/GeoIPv6.dat\"")
     line.gsub!(/^( *)#maxmind_database:.*$/, "\\1maxmind_database: \"/usr/share/GeoIP/GeoLite2-Country.mmdb\"")
 
     if new_resource.gpx_dir
@@ -327,7 +325,6 @@ action :create do
     "support_email" => "support@openstreetmap.org",
     "email_return_path" => "bounces@openstreetmap.org",
     "geonames_username" => "openstreetmap",
-    "geoip_database" => "/usr/share/GeoIP/GeoIPv6.dat",
     "maxmind_database" => "/usr/share/GeoIP/GeoLite2-Country.mmdb"
   )