Difference between revisions of "HOWTO backup and install the GlueX wiki"

From GlueXWiki
Jump to: navigation, search
Line 5: Line 5:
 
The GlueX wiki uses [http://www.mediawiki.org MediaWiki] with a [http://www.mysql.com MySQL] database for the backend. The wiki is hosted at JLab with these settings:
 
The GlueX wiki uses [http://www.mediawiki.org MediaWiki] with a [http://www.mysql.com MySQL] database for the backend. The wiki is hosted at JLab with these settings:
  
* host = halldweb1.jlab.org (webserver and MySQL server)
+
* Web Server = halldweb1.jlab.org
* dbname = wikidb
+
* MySQL Server = cnidb.jlab.org
* mysql user = wiki
+
* dbname = halldwikidb
 +
* mysql user = halldwiki
 +
* mysql password = ??
  
  
Line 21: Line 23:
 
=== Unpacking the files ===
 
=== Unpacking the files ===
 
1. Unpack MediaWiki
 
1. Unpack MediaWiki
  > tar xzvf mediawiki-1.17.0.tar.gz
+
  > tar xzvf mediawiki-1.22.5.tar.gz
 
2. Rename "mediawiki-X" directory to "wiki"
 
2. Rename "mediawiki-X" directory to "wiki"
  > mv mediawiki-1.17.0 wiki
+
  > mv mediawiki-1.22.5 wiki
 
3. Unpack tarball from GlueX wiki backup
 
3. Unpack tarball from GlueX wiki backup
  > tar xzvf wiki_backup_13-10-09.tgz
+
  > tar xzvf wiki_backup_14-04-18.tgz
 
4. Move files from backup directory into wiki directory
 
4. Move files from backup directory into wiki directory
  > cp -rp wiki_backup_13-10-09/* wiki
+
  > cp -rp wiki_backup_14-04-18/* 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.
 
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
 
  > chmod -R o+w wiki/images
Line 37: Line 39:
  
 
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 :
 
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";
+
  #$wgDBserver        = "halldweb1.jlab.org";
  $wgDBname          = "wikidb";
+
$wgDBserver        = "cnidb.jlab.org";
  $wgDBuser          = "wiki";
+
  $wgDBname          = "halldwikidb";
 +
#$wgDBname          = "wikidb";
 +
  $wgDBuser          = "halldwiki";
 +
#$wgDBuser          = "wiki";
 
  $wgDBpassword      = "wiki";
 
  $wgDBpassword      = "wiki";
 
  $wgDBprefix        = "gluex_";
 
  $wgDBprefix        = "gluex_";
Line 47: Line 52:
  
 
  $wgDBserver        = "127.0.0.1";
 
  $wgDBserver        = "127.0.0.1";
  $wgDBname          = "wikidb";
+
  $wgDBname          = "halldwikidb";
  $wgDBuser          = "www";
+
  $wgDBuser          = "halldwiki";
 
  $wgDBpassword      = "";
 
  $wgDBpassword      = "";
 
  $wgDBprefix        = "gluex_";
 
  $wgDBprefix        = "gluex_";
 
  $wgDBtype          = "mysql";
 
  $wgDBtype          = "mysql";
  
2. Create the wikidb database on the server
+
2. Create the halldwikidb database on the server
  > mysql -u www
+
  > mysql -u halldwiki
 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
 
  Your MySQL connection id is 14
 
  Your MySQL connection id is 14
Line 61: Line 66:
 
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
   
 
   
  mysql> create database wikidb;
+
  mysql> create database halldwikidb;
 
  mysql> quit
 
  mysql> quit
  
 
3. Fill the database using the wikidb.sql file
 
3. Fill the database using the wikidb.sql file
  >mysql -u www wikidb < wikidb.sql
+
  >mysql -u halldwiki halldwikidb < halldwikidb.sql
  
  

Revision as of 14:35, 18 April 2014

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:

  • Web Server = halldweb1.jlab.org
  • MySQL Server = cnidb.jlab.org
  • dbname = halldwikidb
  • mysql user = halldwiki
  • mysql password = ??


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.22.5.tar.gz

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

> mv mediawiki-1.22.5 wiki

3. Unpack tarball from GlueX wiki backup

> tar xzvf wiki_backup_14-04-18.tgz

4. Move files from backup directory into wiki directory

> cp -rp wiki_backup_14-04-18/* 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";
$wgDBserver         = "cnidb.jlab.org";
$wgDBname           = "halldwikidb";
#$wgDBname           = "wikidb";
$wgDBuser           = "halldwiki";
#$wgDBuser           = "wiki";
$wgDBpassword       = "wiki";
$wgDBprefix         = "gluex_";
$wgDBtype           = "mysql";

to this

$wgDBserver         = "127.0.0.1";
$wgDBname           = "halldwikidb";
$wgDBuser           = "halldwiki";
$wgDBpassword       = "";
$wgDBprefix         = "gluex_";
$wgDBtype           = "mysql";

2. Create the halldwikidb database on the server

> mysql -u halldwiki
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 halldwikidb;
mysql> quit

3. Fill the database using the wikidb.sql file

>mysql -u halldwiki halldwikidb < halldwikidb.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>