|
|
Line 1: |
Line 1: |
− | = Deployment =
| + | Moved to [https://janus.middlebury.edu/display/WTASDOC/Deploying+Code https://janus.middlebury.edu/display/WTASDOC/Deploying+Code] |
− | == Installing MediaWiki on a new production host ==
| |
− | | |
− | 1. (Option A) Copy the ssh public/private key pair from the old host to the new host:
| |
− | <pre>scp /root/.ssh/id_* newhost:/root/.ssh/</pre>
| |
− | | |
− | 1. (Option B) Create a new ssh key pair on the new host with <code>ssh-keygen</code> and add its public key to the gitosis configuration on chisel.
| |
− | | |
− | 2. Clone the repository to <code>/var/www/mediawiki/</code>
| |
− | <pre>cd /var/www/
| |
− | git clone git@github.com:middlebury/mediawiki.git
| |
− | cd mediawiki
| |
− | git submodule update --init</pre>
| |
− | | |
− | 3. Add a post-merge hook so that all submodules will be updated when we run <code>git pull</code> in the future.
| |
− | <pre>echo "#!/bin/bash
| |
− | git submodule update --init --recursive" > .git/hooks/post-merge
| |
− | chmod a+x .git/hooks/post-merge</pre>
| |
− | | |
− | 3. Find all of the image directories on the old host with:
| |
− | <pre>find mediawiki/webroot/wikis -type d -name images</pre>
| |
− | Then take that list and search/replace each line into an rsync command:
| |
− | <pre>rsync -av --delete oldhost:/path/to/mediawiki/webroot/wikis/CCP/images/ /newpath/to/mediawiki/webroot/wikis/CCP/images/</pre>
| |
− | Then run all of the rsync commands. Note: Adding the new host's public key to the old host's <code>~/.ssh/authorized_keys2</code> file will allow you to run all of the rsync commands without entering your password many times.
| |
− | | |
− | 4. Add the Apache virtual-host configuration to <code>/etc/httpd/conf.d/vhost.conf</code>. Restart Apache.
| |
− | | |
− | == Updating MediaWiki in production ==
| |
− | | |
− | If the MediaWiki core code has been updated, then the database tables need to be updated.
| |
− | | |
− | 1. Update the code on moth:
| |
− | <pre>ssh moth
| |
− | cd /path/to/mediawiki
| |
− | git pull</pre>
| |
− | | |
− | 2. Run the MediaWiki update script on all wiki databases.
| |
− | <pre>php midd_maintenance/midd_update_all.php</pre>
| |
− | | |
− | 3. Most likely, you will also need to update the /install_data/default_tables.sql to reflect schema changes from the updated code on newly created wikis.
| |
− | | |
− | == Managing Extensions ==
| |
− | | |
− | Review the current status of extensions installed on the Middlebury MediaWiki instance:
| |
− | http://mediawiki.middlebury.edu/wiki/LIS/Special:Version
| |
− | | |
− | Review the Web Team "MediaWiki Extensions" document for a history of extension updates:
| |
− | https://drive.google.com/open?id=13yaXDgXQnMRjcTi2mRnDqo9hqCWwgRpeapFQ6qzHcIM
| |
− | | |
− | ===Installing/Updating an Extension:===
| |
− | | |
− | 1. Checkout the master branch from the MediaWiki Github project.
| |
− | <pre>git checkout master</pre>
| |
− | | |
− | 2. Sync master branch with GitHub repository.
| |
− | <pre>git pull </pre>
| |
− | | |
− | 2. Extract the extension folder to the /var/www/mediawiki/shared/extensions directory.
| |
− | <pre>
| |
− | unzip name-of-extension.zip
| |
− | | |
− | mv name-of-extension shared/extensions/
| |
− | | |
− | rm name-of-extension.zip</pre>
| |
− | | |
− | 3. Commit the extension changes to the master branch.
| |
− | <pre>
| |
− | git add shared/extensions/name-of-extension
| |
− | | |
− | git add -u shared/extensions/name-of-extension
| |
− | | |
− | git commit -m "Updated name-of-extension from version x to version y
| |
− | </pre>
| |
− | | |
− | 5. After successful testing, push the master branch commits to GitHub.
| |
− | <pre>
| |
− | git push origin master
| |
− | </pre>
| |
− | | |
− | 6. Update the code on moth to deploy the changes.
| |
− | <pre>ssh moth
| |
− | cd /path/to/mediawiki
| |
− | git pull</pre>
| |
− | | |
− | ==Installing MediaWiki in Development==
| |
− | | |
− | 1. Create a sym link for your new instance of MediaWiki.
| |
− | | |
− | <pre>cd ~/public_html
| |
− | ln -s ../private_html/mediawiki/webroot mediawiki</pre>
| |
− | | |
− | 2. Clone the code into your private_html directory.
| |
− | | |
− | <pre>cd ~/private_html
| |
− | git clone git@github.com:middlebury/mediawiki.git
| |
− | cd mediawiki</pre>
| |
− | | |
− | 3. Install the submodules.
| |
− | | |
− | <pre>git submodule init
| |
− | git submodule update</pre>
| |
− | | |
− | 4. Copy the CasAuthSettings from production.
| |
− | | |
− | <pre>scp moth:/var/www/mediawiki/webroot/shared/extensions/CASAuth/CASAuthSettings.php .</pre>
| |
− | | |
− | 5. Get a copy of the database.
| |
− | | |
− | <pre>mysqldump -u DB_USER -p -h DB_HOST DB_NAME > mediawiki.sql
| |
− | mysql -u DEV_DB_USER -p -h DEV_DB_HOST DEV_DB_NAME < mediawiki.sql</pre>
| |
− | | |
− | 6. Create a copy of the Middlebury settings file and edit it. Replace instances of "myusername" with your username.
| |
− | | |
− | <pre>cp MiddSettings.php.sample MiddSettings.php</pre>
| |
− | | |
− | = Creating new Wikis =
| |
− | In the MediaWiki root on the production host there is a createWiki script that will allow you to quickly create a new wiki:
| |
− | <pre>Usage: createWiki -n <short name> -t <title> -a <admin id>
| |
− | | |
− | Example: createWiki -n TestWiki -t "A Wiki For Testing" -a 1003
| |
− | | |
− | | |
− | Note: The admin user is the only one who will be able to go in and make
| |
− | other users admins. This should likely be your id (internal to mediawiki).
| |
− | | |
− | The admin id is the 'user_id' field in the cas_users table in the mediawiki database.
| |
− | | |
− | Some ids you might wish to use:
| |
− | 1003 Adam Franco
| |
− | 1000 Joe Antonioli
| |
− | 1045 Ian McBride
| |
− | </pre>
| |
− | | |
− | You can then edit the wiki's <code>LocalSettings.php</code> file in <code>mediawiki/webroot/wikis/TestWiki/LocalSettings.php</code> to make any changes.
| |
− | | |
− | In order to allow file uploads, you will need to create an "images" directory. Go into the wiki's directory on the server and execute these commands.
| |
− | | |
− | <pre>
| |
− | mkdir images
| |
− | chown apache:apache images
| |
− | chmod 775 images
| |
− | </pre>
| |
− | | |
− | == Common configuration additions ==
| |
− | | |
− | === Restricting access to groups or users ===
| |
− | | |
− | All pages but the main page in a wiki can be restricted to certain groups or users by adding something like the following to the wiki's <code>LocalSettings.php</code> file.
| |
− | <pre># Disable reading by anonymous users
| |
− | $wgGroupPermissions['*']['read'] = false;
| |
− | | |
− | # But allow them to read e.g., these pages:
| |
− | $wgWhitelistRead = array ( "Main Page", "Special:Userlogin", "Wikipedia:Help");
| |
− | | |
− | # Disable anonymous editing
| |
− | $wgGroupPermissions['*']['edit'] = false;
| |
− | | |
− | # Authorized Groups
| |
− | # Use the full DN of the group from the AD.
| |
− | $CASAuth["AllowedGroups"]= array(
| |
− | "CN=Helpdesk Staff,OU=General,OU=Groups,DC=middlebury,DC=edu",
| |
− | );
| |
− | | |
− | # Authorized Users (in addition to those in the groups)
| |
− | # Use the MiddleburyCollegeUID for the user.
| |
− | $CASAuth["AllowedUsers"]= array(
| |
− | 'B0F836FCDADFDDFF7A17C02C62CDB227', // Adam Franco
| |
− | );</pre>
| |
− | | |
− | === Changing allowed file types ===
| |
− | <pre>##Override the default with a bundle of filetypes:
| |
− | $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ppt', 'pdf', 'doc');
| |
− | $wgStrictFileExtensions = false;</pre>
| |
| | | |
| [[Category:MediaWiki]] | | [[Category:MediaWiki]] |
| [[Category:Web Application Development]] | | [[Category:Web Application Development]] |