HOWTO backup and install the GlueX wiki

From GlueXWiki
Revision as of 21:45, 12 October 2013 by Davidl (Talk | contribs)

Jump to: navigation, search

Here are instructions for backing up the GlueX wiki and reinstalling it at another location. This is motivated by the ongoing US Federal Government shutdown of 2013 that may cause JLab to close temporarily. To avoid complete disruption to the collaboration, we are preparing to move it to the URegina server temporarily.


Technical details

The GlueX wiki uses MediaWiki with a MySQL database for the backend. The wiki is hosted at JLab with these settings:

  • host = halldweb1.jlab.org (webserver and MySQL server)
  • dbname = wikidb
  • mysql user = wiki


Backing up the wiki

Use the script: https://halldsvn.jlab.org/repos/trunk/scripts/backup_wiki

Restoring the wiki

Before starting, you'll need to get your PHP-enabled web-sever up and running as well as you MySQL database. Once those are working, go to the directory where the wiki pages will be served from and follow these steps:

Unpacking the files

1. Unpack MediaWiki

> tar xzvf mediawiki-1.17.0.tar.gz

2. Rename "mediawiki-X" directory to "wiki"

> mv mediawiki-1.17.0 wiki

3. Unpack tarball from GlueX wiki backup

> tar xzvf wiki_backup_13-10-09.tgz

4. Move files from backup directory into wiki directory

> cp -rp wiki_backup_13-10-09/* wiki

5. You may need to change permissions on the images directory (and subdirs) so that the web server can add and modify files there.

> chmod -R o+w wiki/images

6. Adjust the top-level directory name in LocalSettings.php if needed. This is the directory relative to the root directory the webserver will use to serve up pages. If you install the "wiki" directory in the top-level directory then you don't need to change anything. On my laptop however, the wiki was being served out of ~davidl/wiki so I had to modify the value of the $wgScriptPath to be this:

$wgScriptPath	    = "/~davidl/wiki";

Filling the Database

Prior to filling the database, you need to make sure you have an account there that the webserver can write to.

1. Edit the file wiki/LocalSettings.php to set the connection parameters for the database (look for the string wgDBserver). For example, to install this on my laptop I changed this :

$wgDBserver         = "halldweb1.jlab.org";
$wgDBname           = "wikidb";
$wgDBuser           = "wiki";
$wgDBpassword       = "wiki";
$wgDBprefix         = "gluex_";
$wgDBtype           = "mysql";

to this

$wgDBserver         = "127.0.0.1";
$wgDBname           = "wikidb";
$wgDBuser           = "www";
$wgDBpassword       = "";
$wgDBprefix         = "gluex_";
$wgDBtype           = "mysql";

2. Create the wikidb database on the server

> mysql -u www
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.1.43 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wikidb;
mysql> quit

3. Fill the database using the wikidb.sql file

>mysql -u www wikidb < wikidb.sql


Troubleshooting

No images

When I first installed the wiki on my laptop (Macbook Pro, OS X 10.7.5) the images would not come up and I could see this message in the error log:

>tail /var/log/apache2/error_log
[Sat Oct 12 20:19:55 2013] [error] [client fe80::1] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /Users/davidl/Sites/wiki/images/thumb/8/80/Gluex-eng1.png/300px-Gluex-eng1.png, referer: http://localhost/~davidl/wiki/index.php/Main_Page

After some head scratching and web searching, it turns out the problem is due to some reduced permissions being set in a .htaccess file in the images directory. This file looks to be distributed with MediaWiki to address a security bug. The solution was found here which said to add a "Options FollowSymLinks" line to the .htaccess file. Here's what mine looked like after I added it and images started working:

# Protect against bug 28235
<IfModule rewrite_module>
	Options FollowSymLinks
	RewriteEngine On
	RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
	RewriteRule . - [forbidden]
</IfModule>