nominatim: make log dir configurable and move it to ssd on dulcy
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 30 Mar 2016 19:18:13 +0000 (21:18 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 30 Mar 2016 19:18:13 +0000 (21:18 +0200)
cookbooks/nominatim/attributes/default.rb [new file with mode: 0644]
cookbooks/nominatim/recipes/base.rb
cookbooks/nominatim/templates/default/ipblocks.erb
cookbooks/nominatim/templates/default/logrotate.nominatim.erb
cookbooks/nominatim/templates/default/munin.erb
cookbooks/nominatim/templates/default/nominatim.erb
cookbooks/nominatim/templates/default/updater.erb
roles/dulcy.rb

diff --git a/cookbooks/nominatim/attributes/default.rb b/cookbooks/nominatim/attributes/default.rb
new file mode 100644 (file)
index 0000000..b4a0b09
--- /dev/null
@@ -0,0 +1 @@
+default[:nominatim][:logdir] = "/var/log/nominatim"
index a7c5a9c52a0adee354b7957ff6a581cb835a8be3..da10a90010a2db3631543963c8a76d5cadb5e726 100644 (file)
@@ -65,10 +65,25 @@ postgresql_munin "nominatim" do
   database database_name
 end
 
-directory "/var/log/nominatim" do
+directory node[:nominatim][:logdir] do
   owner "nominatim"
   group "nominatim"
   mode 0755
+  recursive true
+end
+
+file "#{node[:nominatim][:logdir]}/query.log" do
+  action :create_if_missing
+  owner "www-data"
+  group "adm"
+  mode 0664
+end
+
+file "#{node[:nominatim][:logdir]}/update.log" do
+  action :create_if_missing
+  owner "nominatim"
+  group "adm"
+  mode 0664
 end
 
 directory "#{home_directory}/status" do
@@ -121,12 +136,6 @@ execute "compile_nominatim" do
   user "nominatim"
 end
 
-directory "#{source_directory}/log" do
-  owner "nominatim"
-  group "nominatim"
-  mode 0755
-end
-
 template "#{source_directory}/.git/hooks/post-merge" do
   source "update_source.erb"
   owner "nominatim"
index a679563a47002eb4f45a1664ea59c05c5a658395..9fb36fef5bbc665f73a0680459acf67e9a91e89d 100644 (file)
@@ -1,4 +1,4 @@
-LOGFILE='/var/log/nominatim/restricted_ips.log'
+LOGFILE='<%= node[:nominatim][:logdir] %>/restricted_ips.log'
 # space-separated list of IPs that are never banned
 WHITELIST = ''
 # space-separated list of IPs manually blocked
index 0b853f79f785cd449b2c32a32a49cbc2b07430d6..7097e432d3987fdc709b8f7077348b1fc9d8013e 100644 (file)
@@ -1,6 +1,6 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
-/var/log/nominatim/update.log {
+<%= node[:nominatim][:logdir] %>/update.log {
   weekly
   missingok
   rotate 5
@@ -10,7 +10,7 @@
   create 640 nominatim adm
 }
 
-/var/log/nominatim/query.log {
+<%= node[:nominatim][:logdir] %>/query.log {
   weekly
   missingok
   rotate 8
index 136211ef5731c31de7402cf5d9629c2a99c6bd1a..aa6ac2af277721f7a695760f7c4776d364c719bd 100644 (file)
@@ -4,4 +4,4 @@
 user www-data
 env.PGDATABASE <%= node[:nominatim][:database][:dbname] %>
 env.PGUSER www-data
-env.NOMINATIM_QUERYLOG /var/log/nominatim/query.log
+env.NOMINATIM_QUERYLOG <%= node[:nominatim][:logdir] %>/query.log
index d1c3517e628ed4bcb69cbde09a4e64af4574a14d..6e911223d93f7a1a62560b6bcef0ce62fd806993 100644 (file)
@@ -17,5 +17,5 @@ else
 @define('CONST_Tablespace_<%= part %>', '<%= name %>');
 <% end -%>
 
-@define('CONST_Log_File', '/var/log/nominatim/query.log');
+@define('CONST_Log_File', '<%= node[:nominatim][:logdir] %>/query.log');
 @define('CONST_Log_DB', false);
index aba7f72aa9dea61a2281126b13dc2589be18d06f..d8c9666ced65778455c0f0605fe96bc956f47e1f 100644 (file)
@@ -9,7 +9,7 @@ cd $DIR/..
 while [ ! -f "<%= @update_stop_file %>" ]
 do
     # Send output to the log (logrotatable)
-    exec >> /var/log/nominatim/update.log 2>&1
+    exec >> <%= node[:nominatim][:logdir] %>/update.log 2>&1
     starttime=`date +%s`
 
     ./utils/update.php --no-npi --import-osmosis
index e40e048343a1c93d8544c77eb2ee5c71855ab640..eb8d29526339094ad4a4629e6fd93f3dda23f674 100644 (file)
@@ -41,6 +41,7 @@ default_attributes(
   :nominatim => {
     :enabled => false,
     :flatnode_file => "/ssd/nominatim/nodes.store",
+    :logdir => "/ssd/nominatim/log",
     :database => {
       :cluster => "9.4/main",
       :dbname => "nominatim",