AllCops:
TargetRubyVersion: 2.3
+ChefModernize/IncludingAptDefaultRecipe:
+ Enabled: false
+
Layout/ExtraSpacing:
AllowForAlignment: true
uri "ppa:ubuntugis/ubuntugis-unstable"
end
+apt_repository "maxmind" do
+ action repository_actions["maxmind"]
+ uri "ppa:maxmind/ppa"
+end
+
apt_repository "openstreetmap" do
action repository_actions["openstreetmap"]
uri "ppa:osmadmins/ppa"
version "1.0.0"
supports "ubuntu"
+depends "geoipupdate"
depends "systemd"
# limitations under the License.
#
+include_recipe "geoipupdate"
+
package %w[
- geoipupdate
gdnsd
]
-execute "geoipdate" do
- command "geoipupdate"
- user "root"
- group "root"
- not_if { ::File.exist?("/var/lib/GeoIP/GeoLite2-Country.mmdb") }
-end
-
directory "/etc/gdnsd/config.d" do
owner "nobody"
group "nogroup"
--- /dev/null
+# geoipupdate Cookbook
+
+This cookbook installs and configures geoipupdate, a tool to keep MaxMind
+GeoIP databases up to date.
--- /dev/null
+default[:geoipupdate][:account] = "149244"
+default[:geoipupdate][:editions] = %w[GeoLite2-ASN GeoLite2-City GeoLite2-Country]
+
+default[:apt][:sources] |= ["maxmind"]
--- /dev/null
+name "geoipupdate"
+maintainer "OpenStreetMap Administrators"
+maintainer_email "admins@openstreetmap.org"
+license "Apache-2.0"
+description "Installs and configures geoipupdate"
+
+version "1.0.0"
+supports "ubuntu"
+depends "apt"
--- /dev/null
+#
+# Cookbook:: geoipdate
+# Recipe:: default
+#
+# Copyright:: 2020, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "apt"
+
+license_keys = data_bag_item("geoipupdate", "license-keys")
+
+package "geoipupdate" do
+ action [:install, :upgrade]
+end
+
+template "/etc/GeoIP.conf" do
+ source "GeoIP.conf.erb"
+ owner "root"
+ group "root"
+ mode 0o644
+ variables :license_keys => license_keys
+end
+
+execute "geoipdate" do
+ command "geoipupdate"
+ user "root"
+ group "root"
+ not_if { node[:geoipupdate][:editions].all? { |edition| ::File.exist?("/usr/share/GeoIP/#{edition}.mmdb") } }
+end
+
+directory "/var/lib/GeoIP" do
+ action :delete
+ recursive true
+end
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+AccountID <%= node[:geoipupdate][:account] %>
+LicenseKey <%= @license_keys[node[:geoipupdate][:account]] %>
+EditionIDs <%= Array(node[:geoipupdate][:editions]).join(" ") %>
version "1.0.0"
supports "ubuntu"
depends "apache"
+depends "geoipupdate"
depends "mysql"
#
include_recipe "apache"
+include_recipe "geoipupdate"
include_recipe "mysql"
passwords = data_bag_item("piwik", "passwords")
package "php-xml"
package "php-apcu"
-package "geoipupdate"
-
apache_module "expires"
apache_module "php7.2"
apache_module "rewrite"
end
link "/opt/piwik-#{version}/piwik/misc/GeoLite2-ASN.mmdb" do
- to "/var/lib/GeoIP/GeoLite2-ASN.mmdb"
+ to "/usr/share/GeoIP/GeoLite2-ASN.mmdb"
end
link "/opt/piwik-#{version}/piwik/misc/GeoLite2-City.mmdb" do
- to "/var/lib/GeoIP/GeoLite2-City.mmdb"
+ to "/usr/share/GeoIP/GeoLite2-City.mmdb"
end
link "/opt/piwik-#{version}/piwik/misc/GeoLite2-Country.mmdb" do
- to "/var/lib/GeoIP/GeoLite2-Country.mmdb"
+ to "/usr/share/GeoIP/GeoLite2-Country.mmdb"
end
link "/srv/piwik.openstreetmap.org" do