From a1780627367305e7bd8987ad71fec090cda8743f Mon Sep 17 00:00:00 2001
From: Thomas Skowron
Date: Sun, 24 Feb 2019 19:23:15 +0000
Subject: [PATCH] Enable regular dumps of the main wiki
Closes #220
---
.../mediawiki/templates/default/apache.erb | 9 +++++++++
cookbooks/wiki/recipes/default.rb | 11 ++++------
.../templates/default/apache_wiki_dump.erb | 20 -------------------
.../wiki/templates/default/cron_wiki_dump.erb | 2 ++
4 files changed, 15 insertions(+), 27 deletions(-)
delete mode 100644 cookbooks/wiki/templates/default/apache_wiki_dump.erb
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"
--
2.39.5
|