From: Thomas Skowron Date: Sun, 24 Feb 2019 19:23:15 +0000 (+0000) Subject: Enable regular dumps of the main wiki X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/a1780627367305e7bd8987ad71fec090cda8743f Enable regular dumps of the main wiki Closes #220 --- diff --git a/cookbooks/mediawiki/templates/default/apache.erb b/cookbooks/mediawiki/templates/default/apache.erb index 7aba9752b..d5485a620 100644 --- a/cookbooks/mediawiki/templates/default/apache.erb +++ b/cookbooks/mediawiki/templates/default/apache.erb @@ -87,6 +87,7 @@ RewriteCond %{REQUEST_URI} !^/value/ RewriteCond %{REQUEST_URI} !^/reference/ RewriteCond %{REQUEST_URI} !^/prop/ + RewriteCond %{REQUEST_URI} !^/dump/ RewriteCond %{REQUEST_URI} !^/server-status RewriteCond %{REQUEST_URI} !^/.well-known/ RewriteCond %{LA-U:REQUEST_FILENAME} !-f @@ -144,6 +145,14 @@ php_admin_flag engine off + /dump/> + Options Indexes FollowSymLinks MultiViews + AllowOverride All + IndexIgnore .ht* . robots.txt HEADER.html HEADER.cgi logo.png style.css + IndexOptions FancyIndexing FoldersFirst NameWidth=* TrackModified + IndexOrderDefault Descending Date + + Require all denied diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb index 782fbdd3a..5e15212e0 100644 --- a/cookbooks/wiki/recipes/default.rb +++ b/cookbooks/wiki/recipes/default.rb @@ -23,6 +23,8 @@ include_recipe "mediawiki" passwords = data_bag_item("wiki", "passwords") +dump_directory = "/srv/wiki.openstreetmap.org/dump" + package "lua5.1" # newer versions do not work with Scribuntu! apache_site "default" do @@ -115,21 +117,16 @@ cookbook_file "/srv/wiki.openstreetmap.org/favicon.ico" do mode 0o644 end -directory "/srv/dump.wiki.openstreetmap.org" do +directory dump_directory do owner node[:mediawiki][:user] group node[:mediawiki][:group] mode "0775" end -apache_site "dump.wiki.openstreetmap.org" do - template "apache_wiki_dump.erb" - directory "/srv/dump.wiki.openstreetmap.org" - variables :aliases => "dump.wiki.osm.org" -end - template "/etc/cron.d/wiki-osm-org-dump" do owner "root" group "root" mode 0o644 source "cron_wiki_dump.erb" + variables :dumppath => dump_directory end diff --git a/cookbooks/wiki/templates/default/apache_wiki_dump.erb b/cookbooks/wiki/templates/default/apache_wiki_dump.erb deleted file mode 100644 index 529404f4c..000000000 --- a/cookbooks/wiki/templates/default/apache_wiki_dump.erb +++ /dev/null @@ -1,20 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - - - ServerName <%= @name %> - ServerAlias <%= @aliases %> - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/<%= @name %>-access.log combined - ErrorLog /var/log/apache2/<%= @name %>-error.log - - DocumentRoot <%= @directory %> - - > - Options Indexes FollowSymLinks MultiViews - AllowOverride All - IndexIgnore .ht* . robots.txt HEADER.html HEADER.cgi logo.png style.css - IndexOptions FancyIndexing FoldersFirst NameWidth=* TrackModified - IndexOrderDefault Descending Date - - diff --git a/cookbooks/wiki/templates/default/cron_wiki_dump.erb b/cookbooks/wiki/templates/default/cron_wiki_dump.erb index a84d2c58d..4ed8c8a68 100644 --- a/cookbooks/wiki/templates/default/cron_wiki_dump.erb +++ b/cookbooks/wiki/templates/default/cron_wiki_dump.erb @@ -1,3 +1,5 @@ #!/bin/bash # DO NOT EDIT - This file is being maintained by Chef +cd <%= @basepath %>/maintenance +php dumpBackup.php --full > "<%= @dumppath %>/dump.xml"