]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for nominatim cookbook
authorTom Hughes <tom@compton.nu>
Mon, 18 May 2020 13:53:55 +0000 (13:53 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 18 May 2020 13:53:55 +0000 (13:53 +0000)
.github/workflows/test-kitchen.yml
.kitchen.yml
cookbooks/nginx/recipes/default.rb
cookbooks/nominatim/attributes/default.rb
cookbooks/nominatim/metadata.rb
cookbooks/nominatim/recipes/default.rb
test/data_bags/accounts/lonvia.json [new file with mode: 0644]
test/data_bags/accounts/nominatim.json [new file with mode: 0644]
test/integration/nominatim/serverspec/nginx_spec.rb [new file with mode: 0644]

index d6d3f83eb6bb5041e890975ab563a2eac8a389da..f62bc5d9308b252b9a11cfe811dfcd126010d8ce 100644 (file)
@@ -56,6 +56,7 @@ jobs:
           - networking
           - nginx
           - nodejs
           - networking
           - nginx
           - nodejs
+          - nominatim
           - ntp
           - openssh
           - osmosis
           - ntp
           - openssh
           - osmosis
index 51f0fc43e9922439a9bcafdf43243eff63aa6e2d..f664702b6608b38206d2dc1601ad75a703e08575 100644 (file)
@@ -202,6 +202,9 @@ suites:
   - name: nodejs
     run_list:
       - recipe[nodejs::default]
   - name: nodejs
     run_list:
       - recipe[nodejs::default]
+  - name: nominatim
+    run_list:
+      - recipe[nominatim::default]
   - name: ntp
     run_list:
       - recipe[ntp::default]
   - name: ntp
     run_list:
       - recipe[ntp::default]
index f17e3dc44de3323de3c0c988a5729a760ff447d5..cfd79376dab764296ce7c9e700483ec06fb1bf42 100644 (file)
@@ -19,6 +19,7 @@
 
 include_recipe "apt"
 include_recipe "munin"
 
 include_recipe "apt"
 include_recipe "munin"
+include_recipe "ssl"
 
 package "nginx"
 
 
 package "nginx"
 
index d096f93941079d5136bb68fd71b1080384c2e442..fe1118822a69352a60263ee879a18209c5795c5c 100644 (file)
@@ -1,7 +1,9 @@
 default[:nominatim][:state] = "off" # or: standalone, master, slave
 default[:nominatim][:dbadmins] = []
 default[:nominatim][:state] = "off" # or: standalone, master, slave
 default[:nominatim][:dbadmins] = []
+default[:nominatim][:dbcluster] = "12/main"
 default[:nominatim][:dbname] = "nominatim"
 default[:nominatim][:tablespaces] = []
 default[:nominatim][:dbname] = "nominatim"
 default[:nominatim][:tablespaces] = []
+default[:nominatim][:postgis] = "2.5"
 default[:nominatim][:logdir] = "/var/log/nominatim"
 default[:nominatim][:repository] = "https://git.openstreetmap.org/public/nominatim.git"
 default[:nominatim][:revision] = "master"
 default[:nominatim][:logdir] = "/var/log/nominatim"
 default[:nominatim][:repository] = "https://git.openstreetmap.org/public/nominatim.git"
 default[:nominatim][:revision] = "master"
@@ -17,3 +19,7 @@ default[:nominatim][:fpm_pools] = {
 }
 
 default[:nominatim][:redirects] = {}
 }
 
 default[:nominatim][:redirects] = {}
+
+default[:postgresql][:versions] |= [node[:nominatim][:dbcluster].split("/").first]
+
+default[:accounts][:users][:nominatim][:status] = :role
index 57b19a03adaaf65f95baadd14673805ad0f21093..017bc0912b31664442c8701d267694f7eb525760 100644 (file)
@@ -6,11 +6,11 @@ description       "Installs and configures nominatim servers"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
-depends           "systemd"
-depends           "apache"
+depends           "accounts"
 depends           "fail2ban"
 depends           "git"
 depends           "munin"
 depends           "nginx"
 depends           "postgresql"
 depends           "python"
 depends           "fail2ban"
 depends           "git"
 depends           "munin"
 depends           "nginx"
 depends           "postgresql"
 depends           "python"
+depends           "systemd"
index 929645f38cf62a1be389266d80f45fb26a537c11..46a03fc9148ade9af1003d54adb77b82144389de 100644 (file)
@@ -17,6 +17,7 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "munin"
 
 basedir = data_bag_item("accounts", "nominatim")["home"]
 include_recipe "munin"
 
 basedir = data_bag_item("accounts", "nominatim")["home"]
@@ -312,7 +313,7 @@ directory "#{basedir}/etc" do
   mode 0o775
 end
 
   mode 0o775
 end
 
-%w[user_agent referer email].each do |name|
+%w[user_agent referrer email].each do |name|
   file "#{basedir}/etc/nginx_blocked_#{name}.conf" do
     action :create_if_missing
     owner "nominatim"
   file "#{basedir}/etc/nginx_blocked_#{name}.conf" do
     action :create_if_missing
     owner "nominatim"
diff --git a/test/data_bags/accounts/lonvia.json b/test/data_bags/accounts/lonvia.json
new file mode 100644 (file)
index 0000000..1684539
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "lonvia",
+  "uid": "1056",
+  "comment": "Sarah Hoffmann",
+  "email": "lonvia@example.com"
+}
diff --git a/test/data_bags/accounts/nominatim.json b/test/data_bags/accounts/nominatim.json
new file mode 100644 (file)
index 0000000..675eb77
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "nominatim",
+  "uid": "518",
+  "comment": "nominatim.openstreetmap.org",
+  "home": "/srv/nominatim.openstreetmap.org"
+}
diff --git a/test/integration/nominatim/serverspec/nginx_spec.rb b/test/integration/nominatim/serverspec/nginx_spec.rb
new file mode 100644 (file)
index 0000000..03901cc
--- /dev/null
@@ -0,0 +1,17 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("nginx") do
+  it { should be_installed }
+end
+
+describe service("nginx") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(8050) do
+  it { should be_listening.with("tcp") }
+end