Difference between revisions of "Setup MediaWiki on AWS"

From dftwiki3
Jump to: navigation, search
Line 418: Line 418:
  
 
</source>
 
</source>
 +
=Setup S3cmd on hadoop0=
 +
* install s3cmd
 +
* s3cmd --configure
 +
::* Access Key: AKIAINNPVCF6X257DRPQ
 +
::* Secret Key: GE06l3VK1QHpxFB5Arywu6MJ3xaeWlNfDzoXdyns
 +
::* encryption key: {eZDfswapkcoTXZoKBxLKw2ZmNNwiTKb
 +
* works
 +
* for first backup, go to hadoop0, in 1TB, create s3 dir, then backup-dft-hadoop02 subdir, cd there and issue command:
 +
 +
s3cmd sync -r s3://backup-dft-hadoop02 .
 +
 +
: and it backs s3 down.
 +
* created crontab entry on hadoop0:
 +
 +
0 5 * * 0 /usr/bin/s3cmd sync -q -r s3://backup-dft-hadoop02 /mnt/1TB/s3/backup-dft-hadoop02/
 +
 +
 
</onlydft>
 
</onlydft>
 
<br />
 
<br />

Revision as of 17:52, 22 January 2018

D. Thiebaut (talk) 16:44, 13 January 2018 (EST)



This page contains very sketchy steps for setting up (in my case moving) an existing mediawiki installation to AWS. This list is mostly for myself to remember what steps I have taken.

MediaWiki.png



Mediawiki Installation/Upgrade

  • Follow the steps from https://www.mediawiki.org/wiki/Manual:Upgrading
  • Download the new mediawiki in a directory belonging to the Web server
  • unzip/untar.
  • Create new MySql user/password/database on localhost (same host as Web server)
  • Verify that base directory of mediawiki installation is accessible from a browser by putting a phpinfo.php file in it and loading it up with browser.
  • use browser and point to /mw-config in the mediawiki web directory. Enter database information.
  • Update the LocalSettings.php file
  • If migrating, copy the extensions, skins, images, media, Downloads directory from old wiki to new installed wiki.
  • Install one extension at a time in extensions directory, and at the end of LocalSettings.php

Updated Extensions

I had to update several extensions to match the new format.


...

AWS

EC2

  • Go for free-tier t2-micro with attached EBS drive (20GB)
  • Set OS to Ubuntu Server 16.04.

  • ...

  • Install MediaWiki on it, without data
  • Install emacs
  • Make an AMI out of it
  • Move the images, extensions, skins, etc to newly installed MW.
  • Install ddclient.
    ...


S3

  • Create a bucket for backups
    ...


Backups

  • Install duplicity and duply
  • In the process create a GnuPG key for encryption of backups on S3
 duply test create 

creates a profile to backup for MediaWiki in /data/html/dftwiki3
  • All information in /home/ubuntu/.duply/test/conf
  • Duplicity conf file:

...

  • create script in /usr/local/bin, called backupDftWiki3MySql.sh to do mysqldump of MW to an sql file, and store it:
#! /bin/bash
# This will be called from a root cron job
mysqldump --user=thiebaut --password=xxxxxxxxxx dftwiki3 > /data/html/dftwiki3/backups/dftwiki3.sql 2> /dev/null
cd /data/html/dftwiki3/backups
gzip -f  dftwiki3.sql

Route 53

  • Created new domain dominiquefthiebaut.com
  • Create record to map it to EC2 instance.
  • Find public IP of EC2
    ...

and put in edit-box in record.  Accept defaults.
  • Disable ddclient on EC2 and with dyndns.
  • Change the name of the host in /etc/hosts from hadoop02 to new hostname.

Crontab

Backup MediaWiki EC2 on AWS S3

  • Crontab runs as root on ubuntu EC2
# ------------------------------------------------
# use mysqldump to dump mysql database for dftwiki3
# into a file called dftwiki3.sql in /data/html/dftwiki/backups
0 3 * * * /usr/local/bin/backupDftWiki3MySql.sh

# ------------------------------------------------
# use duplicity (via duply) to backup /data/html/dftwiki3's main
# directories to aws s3.  The configuration and information about
# which S3 bucket is in ~ubuntu/.duply/test/conf
0 4 * * * env HOME=/home/ubuntu duply test backup

Script to Copy MediaWiki from Xgridmac2 to EC2


...


Raw Log


...