MediaWiki Install: Difference between revisions
| (98 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
[[Category:OpenDevOps]] | [[Category:OpenDevOps]] | ||
[[Category:MediaWiki]] | [[Category:MediaWiki]] | ||
* Created on | * Created on 2025-09-02 for personal wiki migrate to Scaleway, upgrade, and multi-wiki. | ||
* Previous | * Previous Versions | ||
** [[MediaWiki_Install_2024-08-27]] | |||
** [[MediaWiki_Install_2024-03-14]] | |||
** [[MediaWiki_Install_2022-09-01]] | |||
= Notes = | = Notes = | ||
* See Also: [[MultiWiki]] | |||
* 1.43 is the latest LTS | |||
I | = Create a Test Instance = | ||
== Scaleway == | |||
* 2 core 2 gig instance, $9/mo with IPv4 | |||
** Deb 12 (bookworm); I created it a month or two ago, maybe 13 (trixie) is available now? | |||
* If your provider has default-deny firewalling, make sure ports 22, 80, and 443 are open, which will allow SSH, HTTP, and HTTPS, respectively. | |||
* Attach IPs | |||
** Get the detachable kind. | |||
** For now, get IPv4 right away. When you get to creating certs for TLS, it's pretty much needed. | |||
*** Yes, it sucks, and v6 just works except for the last miles of the lazy and incompetent ... ugh, and I felt like I was dragging my feet. | |||
** IPv6: 2001:bc8:710:e45a:dc00:ff:fec1:654d | |||
** IPv4: 212.47.239.249 | |||
= | = Configure DNS = | ||
Go to your domain name registrar and add an A and AAAA Record and a CNAME record; A and AAAA for wiki., and a CNAME for wiki-static. | |||
{| class="wikitable" | |||
|+ | |||
!Type | |||
!Host | |||
!Value | |||
!TTL | |||
|- | |||
|A Record | |||
|wiki | |||
|212.47.239.249 | |||
|Automatic | |||
|- | |||
|AAAA Record | |||
|wiki | |||
|2001:bc8:710:e45a:dc00:ff:fec1:654d | |||
|Automatic | |||
|- | |||
|CNAME | |||
|wiki-static | |||
|wiki.iterativechaos.com | |||
|Automatic | |||
|- | |||
|} | |||
It may take a bit to cascade through your resolvers. If you want to be able to hit it immediately, you can update your /etc/hosts file. Add a line like "35.165.2.213 mediawiki.domain.com" but with your IP and domain, after the localhost mappings. | |||
= Instance Setup = | |||
== Host System Update == | |||
<pre> | |||
ssh -i ~/.ssh/secret.pem root@2001:bc8:710:e45a:dc00:ff:fec1:654d | |||
apt update | |||
apt upgrade | |||
adduser bob | |||
mkdir /home/bob/.ssh | |||
cat pubkey.pub > /home/bob/.ssh/authorized_keys | |||
chown bob:bob /home/bob/.ssh | |||
chown bob:bob /home/bob/.ssh/authorized_keys | |||
chmod go-rwx /home/bob/.ssh | |||
chmod go-rwx /home/bob/.ssh/authorized_keys | |||
usermod -aG sudo bob | |||
</pre> | |||
== Client Setup == | |||
=== /etc/hosts === | |||
update your /etc/hosts: | update your /etc/hosts: | ||
<pre> | <pre> | ||
212.47.239.249 wiki.iterativechaos.com wiki.bobbushman.com wiki-static.iterativechaos.com wiki-static.bobbushman.com mw.iterativechaos.com mw-static.iterativechaos.com | |||
2001:bc8:710:e45a:dc00:ff:fec1:654d wiki.iterativechaos.com wiki.bobbushman.com wiki-static.iterativechaos.com wiki-static.bobbushman.com mw.iterativechaos.com mw-static.iterativechaos.com | |||
</pre> | </pre> | ||
=== .ssh/config === | |||
<pre> | <pre> | ||
Host | cp .ssh/config .ssh/config.old | ||
cat >> .ssh/config | |||
User | |||
IdentityFile / | Host wiki.bobbushman.com | ||
User bob | |||
IdentityFile /home/bob/.ssh/SECRET_CHANGE_ME.pem | |||
Host wiki.iterativechaos.com | |||
User bob | |||
IdentityFile /home/bob/.ssh/SECRET_CHANGE_ME.pem | |||
^d | |||
ssh wiki.bobbushman.com | |||
</pre> | </pre> | ||
| Line 46: | Line 105: | ||
sudo apt update -y && \ | sudo apt update -y && \ | ||
sudo apt upgrade -y && \ | sudo apt upgrade -y && \ | ||
sudo apt install -y emacs-nox && \ | sudo apt install -y emacs-nox bzip2 cron && \ | ||
sudo apt install -y apache2 certbot python3-certbot-apache && \ | sudo apt install -y apache2 certbot python3-certbot-apache && \ | ||
sudo apt install -y mariadb-server php php-mysql libapache2-mod-php && \ | sudo apt install -y mariadb-server php php-mysql libapache2-mod-php && \ | ||
sudo apt install -y php-xml php-mbstring php-apcu php-intl php-cli php-curl && \ | sudo apt install -y php-xml php-mbstring php-apcu php-intl php-cli php-curl && \ | ||
sudo apt install -y git imagemagick texlive | sudo apt install -y git imagemagick texlive composer | ||
</pre> | </pre> | ||
Control-d will exit and save the file. | Control-d will exit and save the file. | ||
| Line 70: | Line 129: | ||
$ mkdir apps | $ mkdir apps | ||
$ cd apps | $ cd apps | ||
$ wget https://releases.wikimedia.org/mediawiki/1. | $ wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.3.tar.gz | ||
</pre> | </pre> | ||
| Line 79: | Line 138: | ||
<pre> | <pre> | ||
$ cd /var/www | $ cd /var/www | ||
$ sudo tar -xvzf ~/apps/mediawiki-1. | $ sudo tar -xvzf ~/apps/mediawiki-1.43.3.tar.gz | ||
$ sudo mv html static | $ sudo mv html static | ||
$ sudo ln -s mediawiki-1. | $ sudo ln -s mediawiki-1.43.3 mediawiki | ||
</pre> | </pre> | ||
| Line 94: | Line 153: | ||
<pre> | <pre> | ||
$ cd ~/bin | $ cd ~/bin | ||
$ | $ cat > mariadb-wiki-account.sql | ||
create database install_wiki; | create database install_wiki; | ||
create database | create database traxel_wiki; | ||
grant all on install_wiki.* to 'wiki_wiki'@'localhost' identified by 'CHANGE THIS PASSWORD'; | grant all on install_wiki.* to 'wiki_wiki'@'localhost' identified by 'CHANGE THIS PASSWORD'; | ||
grant all on | grant all on traxel_wiki.* to 'wiki_wiki'@'localhost' identified by 'CHANGE THIS PASSWORD'; | ||
flush privileges; | flush privileges; | ||
</pre> | </pre> | ||
| Line 115: | Line 174: | ||
MariaDB> exit | MariaDB> exit | ||
</pre> | </pre> | ||
= Configure Apache = | = Configure Apache = | ||
| Line 166: | Line 185: | ||
</pre> | </pre> | ||
== /etc/apache2/sites-available/wiki.conf == | == /etc/apache2/sites-available/wiki.bobbushman.conf == | ||
<pre> | <pre> | ||
$ cd ~/conf/apache | $ cd ~/conf/apache | ||
$ cat > wiki.conf | $ cat > wiki.bobbushman.conf | ||
<VirtualHost *:80> | <VirtualHost *:80> | ||
ServerName wiki. | ServerName wiki.bobbushman.com | ||
ServerAdmin webmaster@localhost | ServerAdmin webmaster@localhost | ||
DocumentRoot /var/www/mediawiki | DocumentRoot /var/www/mediawiki | ||
ErrorLog ${APACHE_LOG_DIR}/error.log | ErrorLog ${APACHE_LOG_DIR}/wiki-bobbushman-error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | CustomLog ${APACHE_LOG_DIR}/wiki-bobbushman-access.log combined | ||
</VirtualHost> | </VirtualHost> | ||
</pre> | </pre> | ||
== /etc/apache2/sites-available/wiki-static.conf == | == /etc/apache2/sites-available/wiki-static.bobbushman.conf == | ||
<pre> | <pre> | ||
$ cd ~/conf/apache | $ cd ~/conf/apache | ||
$ cat > wiki-static.conf | $ cat > wiki-static.bobbushman.conf | ||
<VirtualHost *:80> | <VirtualHost *:80> | ||
ServerName wiki-static. | ServerName wiki-static.bobbushman.com | ||
ServerAdmin webmaster@localhost | ServerAdmin webmaster@localhost | ||
DocumentRoot /var/www/static | DocumentRoot /var/www/static | ||
ErrorLog ${APACHE_LOG_DIR}/error.log | ErrorLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | CustomLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-access.log combined | ||
</VirtualHost> | </VirtualHost> | ||
</pre> | </pre> | ||
| Line 210: | Line 227: | ||
Activate the mediawiki conf and bounce the server. | Activate the mediawiki conf and bounce the server. | ||
<pre> | <pre> | ||
$ sudo a2ensite wiki wiki-static | $ sudo a2ensite wiki.bobbushman wiki-static.bobbushman | ||
$ sudo | $ sudo systemctl reload apache2 | ||
</pre> | </pre> | ||
| Line 226: | Line 243: | ||
To keep your errors easy to diagnose and resolve, do one site at a time and verify / fix errors independently. | To keep your errors easy to diagnose and resolve, do one site at a time and verify / fix errors independently. | ||
Keys get automatically written to: /etc/letsencrypt/live/ | |||
<pre> | <pre> | ||
$ sudo certbot --apache -d wiki | $ sudo certbot --apache -d wiki.bobbushman.com | ||
</pre> | </pre> | ||
When it asks about redirects, choose, "2: Redirect - Make all requests redirect to secure HTTPS access." | When it asks about redirects, choose, "2: Redirect - Make all requests redirect to secure HTTPS access." | ||
Hit http://wiki | Hit http://wiki.bobbushman.com and verify it redirects to https:// and shows the correct content. If there are any errors, fix them before moving on. | ||
<pre> | <pre> | ||
$ sudo certbot --apache -d wiki-static | $ sudo certbot --apache -d wiki-static.bobbushman.com | ||
</pre> | </pre> | ||
When it asks about redirects, choose, "2: Redirect - Make all requests redirect to secure HTTPS access." | When it asks about redirects, choose, "2: Redirect - Make all requests redirect to secure HTTPS access." | ||
Hit http://wiki-static | Hit http://wiki-static.bobbushman.com and verify it redirects to https:// and shows the correct content. Fix any errors before moving on. | ||
Note: For some reason I had to 'sudo systemctl restart apache2' to get the redirect to work, even though the 443 site worked without it. <shrug> | |||
= Run The MediaWiki Config Script = | = Run The MediaWiki Config Script = | ||
Get a logo image file ready to drag and drop. You will need it later. | <s>Get a logo image file ready to drag and drop. You will need it later.</s> | ||
Upload a logo image to /var/www/static and get the link ready, like: https://wiki-static.bobbushman.com/wiki-logo-cartoon.png | |||
Go to https://wiki | Go to https://wiki.bobbushman.com/ and click on the setup hyperlink. | ||
Note: Figure out the image upload "nosniff" stuff: https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Security#Upload_security | |||
== Database Settings == | ==Connect to Database== | ||
*database host: localhost | |||
*database name: install_wiki | |||
*database table prefix: <LEAVE BLANK> | |||
*database username: wiki_wiki | |||
*database password: <YOUR PASSWORD> | |||
==Database Settings== | |||
I use the same settings for web access as for installation. | I use the same settings for web access as for installation. | ||
== Name == | ==Name== | ||
* name of wiki: | *name of wiki: Bobs Wiki | ||
* project namespace: same as the wiki name | *project namespace: same as the wiki name | ||
* your username: <YourWikiname, conventionally FirstnameLastname> | *your username: <YourWikiname, conventionally FirstnameLastname> | ||
* password: <A DIFFERENT PASSWORD> | *password: <A DIFFERENT PASSWORD> | ||
* repeat password: <THE SAME, DIFFERENT PASSWORD> | *repeat password: <THE SAME, DIFFERENT PASSWORD> | ||
* email address: <LEAVE BLANK> | *email address: <LEAVE BLANK> | ||
* ask me more questions: tick this radio button | *ask me more questions: tick this radio button | ||
* I'm bored already: don't tick this, there's important stuff ahead | *I'm bored already: don't tick this, there's important stuff ahead | ||
== Options == | ==Options== | ||
In the sections below from Special Pages to Other, you can get more info on extensions by tacking the extension name after the colon in the following URL: https://www.mediawiki.org/wiki/Extension:TextExtracts | In the sections below from Special Pages to Other, you can get more info on extensions by tacking the extension name after the colon in the following URL: https://www.mediawiki.org/wiki/Extension:TextExtracts | ||
* user rights profile: Authorized editors only | *user rights profile: Authorized editors only | ||
* copyright and license: No license footer | *copyright and license: No license footer | ||
* email settings: uncheck Enable outbound email | *email settings: uncheck Enable outbound email | ||
* skins: select all and use Vector as the default | *skins: select all and use Vector as the default | ||
* special pages: I include all 5 | *special pages: I include all 5 | ||
* editors: I include all 3 | *editors: I include all 3 | ||
* parser hooks: I include CategoryTree, Cite, Math, SyntaxHighlight_GeSHi, and TemplateData | *parser hooks: I include CategoryTree, Cite, Math, SyntaxHighlight_GeSHi, and TemplateData | ||
* media handlers: I include PdfHandler | *media handlers: I include PdfHandler | ||
* spam prevention: I don't use these, since I used "authorized editors" above. | *spam prevention: I don't use these, since I used "authorized editors" above. | ||
* api: I include PageImages | *api: I include PageImages | ||
* Other: | *Other: I include MultimediaViewer and SecureLinkFixer | ||
* images and file uploads: check "enable file uploads", leave the default directory setting | *images and file uploads: check "enable file uploads", leave the default directory setting | ||
* personalization: Drag your wiki logo to both the "Logo" and "Sidebar Logo" settings. (Note: it is a *lot* easier to do this now, don't skip this step) | *personalization: Drag your wiki logo to both the "Logo" and "Sidebar Logo" settings. (Note: it is a *lot* easier to do this now, don't skip this step) | ||
* advanced configuration: use PHP caching - we installed apcu earlier. | *advanced configuration: use PHP caching - we installed apcu earlier. | ||
== Language == | ==Language== | ||
Pick your language. | Pick your language. | ||
== Install == | ==Install== | ||
When you click continue, this page will write the database. | When you click continue, this page will write the database. | ||
== Complete == | ==Complete== | ||
This page will automatically start a download of the LocalSettings.php file. | This page will automatically start a download of the LocalSettings.php file. | ||
== Install LocalSettings.php == | ==Install LocalSettings.php== | ||
Push a copy to the server at ~/conf/LocalSettings-[datestamp].php . | Push a copy to the server at ~/conf/LocalSettings-[datestamp].php . | ||
| Line 307: | Line 332: | ||
<pre> | <pre> | ||
$ sudo cp ~/conf/LocalSettings-traxel-2022-09-05.php /var/www/mediawiki/LocalSettings.php | $ sudo usermod -aG www-data admin | ||
$ sudo chown -R admin /var/www/mediawiki/ | |||
$ exit | |||
</pre> | |||
Then log back in. | |||
<pre> | |||
$ groups # should show www-data | |||
$ cp ~/conf/LocalSettings-traxel-2022-09-05.php /var/www/mediawiki/LocalSettings.php | |||
$ sudo chown -R www-data /var/www/mediawiki/images | $ sudo chown -R www-data /var/www/mediawiki/images | ||
$ sudo service apache2 restart | $ sudo service apache2 restart | ||
| Line 316: | Line 348: | ||
https://wiki-new.traxel.com/ | https://wiki-new.traxel.com/ | ||
= | = Multi-Wiki = | ||
Set up a single wiki first, do the config, and grab the LocalSettings.php file, which will be used to create the per-instance LocalSettings_instancename.conf files. | |||
== Apache Conf == | |||
<pre> | |||
<VirtualHost *:80> | |||
ServerAdmin webmaster@localhost | |||
DocumentRoot /var/www/mediawiki | |||
ErrorLog ${APACHE_LOG_DIR}/error.log | |||
CustomLog ${APACHE_LOG_DIR}/access.log combined | |||
</VirtualHost> | |||
<VirtualHost *:80> | |||
ServerName wiki-static.bobbushman.com | |||
ServerAdmin webmaster@localhost | |||
DocumentRoot /var/www/static | |||
ErrorLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-error.log | |||
CustomLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-access.log combined | |||
</VirtualHost> | |||
<VirtualHost *:80> | |||
ServerName wiki-static.iterativechaos.com | |||
ServerAdmin webmaster@localhost | |||
DocumentRoot /var/www/static | |||
ErrorLog ${APACHE_LOG_DIR}/wiki-static-iterativechaos-error.log | |||
CustomLog ${APACHE_LOG_DIR}/wiki-static-iterativechaos-access.log combined | |||
</VirtualHost> | |||
<VirtualHost *:80> | |||
ServerName wiki.bobbushman.com | |||
ServerAdmin webmaster@localhost | |||
DocumentRoot /var/www/mediawiki | |||
ErrorLog ${APACHE_LOG_DIR}/wiki-bobbushman-error.log | |||
CustomLog ${APACHE_LOG_DIR}/wiki-bobbushman-access.log combined | |||
</VirtualHost> | |||
<VirtualHost *:80> | |||
ServerName wiki.iterativechaos.com | |||
ServerAdmin webmaster@localhost | |||
DocumentRoot /var/www/mediawiki | |||
ErrorLog ${APACHE_LOG_DIR}/wiki-iterativechaos-error.log | |||
CustomLog ${APACHE_LOG_DIR}/wiki-iterativechaos-access.log combined | |||
</VirtualHost> | |||
</pre> | |||
== LocalSettings.php == | == LocalSettings.php == | ||
<pre> | |||
<?php | |||
$wikis = [ | |||
'wiki.bobbushman.com' => 'bobbushman', | |||
'wiki.iterativechaos.com' => 'iterativechaos', | |||
]; | |||
if ( defined( 'MW_DB' ) ) { | |||
// Automatically set from --wiki option to maintenance scripts | |||
$wikiID = MW_DB; | |||
} else { | |||
// Use MW_DB environment variable or map the domain name | |||
$wikiID = $_SERVER['MW_DB'] ?? $wikis[ $_SERVER['SERVER_NAME'] ?? '' ] ?? null; | |||
} | |||
if ( $wikiID ) { | |||
require_once "LocalSettings_$wikiID.php"; | |||
// } else { | |||
// die( 'Unknown wiki.' ); | |||
} | |||
// Add any settings that should apply to all wikis below this line | |||
// ------- | |||
</pre> | |||
Then just put the regular LocalSettings.php in LocalSettings_foo.php | |||
=OLDER STUFF BELOW HERE = | |||
= OLDER STUFF BELOW HERE = | |||
=OLDER STUFF BELOW HERE = | |||
==Process== | |||
* Backup Existing Wikis | |||
**wiki.traxel.com last | |||
**Check Lightsail | |||
**Check Namecheap | |||
*Shutdown All but wiki.traxel.com | |||
**Verify that the others are all mostly vestigial during backup. | |||
***Decide which to keep, maybe keep all by default, how hard to purge the whole instance after content migration? | |||
**Keep wiki.traxel.com live until the new version is live. | |||
*Create size 2 or 3 instance on Lightsail. | |||
*Install MediaWiki as a multi-wiki on wiki.bobbushman.com | |||
**Instances at /pub, /private, /traxel | |||
**Restore /traxel from wiki.traxel.com | |||
**Restore others? | |||
=OLDER OLDER STUFF BELOW HERE = | |||
== Add Markdown Handler== | |||
* https://www.mediawiki.org/wiki/Extension:WikiMarkdown | |||
=Create a Host = | |||
I'm not going to document this part. Pick your favorite hosting service and create a Debian 12 host. | |||
If your provider supports it, get a permanent IP address and point it at the new host. This will let you blow away the host, create a new one, point the IP at the new host, and redo the install without having to update the DNS entry and wait for the cascade. | |||
Note the IP address. | |||
=Configure Markdown= | |||
ChatGPT makes its output available in Markdown format. While I personally prefer MediaWiki format, Markdown is both more broadly supported and is what ChatGPT spits out; it's handy to support it directly. Fortunately, there's a MediaWiki plugin for Markdown. | |||
==Composer== | |||
Earlier, during the initial system setup, we included the following in support of the Markdown plugin: | |||
<pre> | |||
apt install -y composer | |||
</pre> | |||
Now we need to enable it in the wiki config: | |||
<pre> | |||
$ cd /var/www/mediawiki | |||
$ sudo cp composer.local.json-sample composer.local.json | |||
$ sudo emacs -nw composer.local.json | |||
</pre> | |||
Add the following line in the extra plugin include: | |||
<pre> | |||
{ | |||
"extra": { | |||
"merge-plugin": { | |||
"include": [ | |||
"extensions/WikiMarkdown/composer.json" | |||
] | |||
} | |||
} | |||
} | |||
</pre> | |||
<pre> | |||
$ composer update | |||
$ cd extensions | |||
$ git clone https://github.com/kuenzign/WikiMarkdown.git | |||
$ git clone https://github.com/BenjaminHoegh/ParsedownExtended.git | |||
$ cd .. | |||
</pre> | |||
=Clone the Legacy Wiki = | |||
== LocalSettings.php== | |||
Compare the LocalSettings.php from the legacy server with the new LocalSettings.php file. | Compare the LocalSettings.php from the legacy server with the new LocalSettings.php file. | ||
| Line 346: | Line 521: | ||
</pre> | </pre> | ||
== Database == | ==Database== | ||
Log in to the legacy server, stop Apache, and dump the database. | Log in to the legacy server, stop Apache, and dump the database. | ||
| Line 369: | Line 544: | ||
</pre> | </pre> | ||
== Images == | ==Images== | ||
Back up the images from the legacy wiki. Log in to the old server. | Back up the images from the legacy wiki. Log in to the old server. | ||
| Line 390: | Line 565: | ||
</pre> | </pre> | ||
= Test The Wiki = | =Test The Wiki = | ||
Check out the wiki, make sure everything is working. The next step is the cutover; if anything isn't working right, it's easy to fix now. | Check out the wiki, make sure everything is working. The next step is the cutover; if anything isn't working right, it's easy to fix now. | ||
* Spot check content pages. | *Spot check content pages. | ||
* Spot check pages that contain images. | *Spot check pages that contain images. | ||
* Create an account, but don't give it privileges. | *Create an account, but don't give it privileges. | ||
* Try editing a page using your admin account. (should work) | *Try editing a page using your admin account. (should work) | ||
* Try editing a page using the unpermissioned account. (should fail) | *Try editing a page using the unpermissioned account. (should fail) | ||
* From your admin account, grant permissions to the unpermissioned account. | *From your admin account, grant permissions to the unpermissioned account. | ||
* Try editing a page using the previously unpermissioned account. | *Try editing a page using the previously unpermissioned account. | ||
= Switch DNS = | =Switch DNS= | ||
Go to your DNS provider and point wiki and wiki-new to your new server. | Go to your DNS provider and point wiki and wiki-new to your new server. | ||
| Line 414: | Line 589: | ||
Now it's going to take a while for the DNS to cascade before we can do the new TLS certs. That makes this a good time to set up the backups. | Now it's going to take a while for the DNS to cascade before we can do the new TLS certs. That makes this a good time to set up the backups. | ||
= Set Up Nightly Backups = | =Set Up Nightly Backups= | ||
This script will make the backup available on the static content site. Until the DNS cutover, you can see it at https://wiki-static-new.traxel.com/backups Later it will be available at https://wiki-static.traxel.com/backups . | This script will make the backup available on the static content site. Until the DNS cutover, you can see it at https://wiki-static-new.traxel.com/backups Later it will be available at https://wiki-static.traxel.com/backups . | ||
| Line 441: | Line 616: | ||
tar -C /var/www/mediawiki -cjf $image_archive_path /var/www/mediawiki/images | tar -C /var/www/mediawiki -cjf $image_archive_path /var/www/mediawiki/images | ||
tar -C /tmp -cvjf $tarball_path $bundle_dir | tar -C /tmp -cvjf $tarball_path $bundle_dir | ||
export delete_dstamp=`date --date='last month' +%Y-%m-%d` | |||
export delete_bundle_dir=wiki-backup-$delete_dstamp | |||
export delete_bundle_path=/tmp/$delete_bundle_dir | |||
export delete_dump_path=/tmp/wiki-backup-$delete_dstamp/$wiki_db_name.sql.bz2 | |||
export delete_image_archive_path=/tmp/wiki-backup-$delete_dstamp/$wiki_db_name-images.tar.bz2 | |||
export delete_conf_path=/tmp/wiki-backup-$delete_dstamp/LocalSettings.php | |||
rm $delete_dump_path | |||
rm $delete_image_archive_path | |||
rm $delete_conf_path | |||
rmdir $delete_bundle_path | |||
</pre> | </pre> | ||
Control-d will exit and save the file. | Control-d will exit and save the file. | ||
| Line 458: | Line 643: | ||
Running it repeatedly will just overwrite the files, so you're safe to test to your heart's content without filling the hard drive. | Running it repeatedly will just overwrite the files, so you're safe to test to your heart's content without filling the hard drive. | ||
== Cron Entry == | ==Cron Entry== | ||
Start with a crontab entry that runs the backup every ten minutes, so you can see it run. | Start with a crontab entry that runs the backup every ten minutes, so you can see it run. | ||
| Line 472: | Line 657: | ||
</pre> | </pre> | ||
= Get New TLS Certificates = | =Get New TLS Certificates= | ||
Hopefully the backup setup has taken long enough that we can now get the production URL TLS certs. | Hopefully the backup setup has taken long enough that we can now get the production URL TLS certs. | ||
| Line 481: | Line 666: | ||
</pre> | </pre> | ||
= Pull The Backups Somewhere = | =Pull The Backups Somewhere= | ||
Backups don't do much good if they're not being stored somewhere. Set up a cron script, maybe on one of HSL's on-prem servers, to periodically pull a copy of the wiki backup. | Backups don't do much good if they're not being stored somewhere. Set up a cron script, maybe on one of HSL's on-prem servers, to periodically pull a copy of the wiki backup. | ||
| Line 495: | Line 680: | ||
</pre> | </pre> | ||
= Test Everything = | =Test Everything= | ||
= Errors & Fixes = | = Errors & Fixes= | ||
== Error Listing All Pages == | ==Error Listing All Pages== | ||
<pre> | <pre> | ||
Latest revision as of 21:17, 5 September 2025
- Created on 2025-09-02 for personal wiki migrate to Scaleway, upgrade, and multi-wiki.
- Previous Versions
Notes
- See Also: MultiWiki
- 1.43 is the latest LTS
Create a Test Instance
Scaleway
- 2 core 2 gig instance, $9/mo with IPv4
- Deb 12 (bookworm); I created it a month or two ago, maybe 13 (trixie) is available now?
- If your provider has default-deny firewalling, make sure ports 22, 80, and 443 are open, which will allow SSH, HTTP, and HTTPS, respectively.
- Attach IPs
- Get the detachable kind.
- For now, get IPv4 right away. When you get to creating certs for TLS, it's pretty much needed.
- Yes, it sucks, and v6 just works except for the last miles of the lazy and incompetent ... ugh, and I felt like I was dragging my feet.
- IPv6: 2001:bc8:710:e45a:dc00:ff:fec1:654d
- IPv4: 212.47.239.249
Configure DNS
Go to your domain name registrar and add an A and AAAA Record and a CNAME record; A and AAAA for wiki., and a CNAME for wiki-static.
| Type | Host | Value | TTL |
|---|---|---|---|
| A Record | wiki | 212.47.239.249 | Automatic |
| AAAA Record | wiki | 2001:bc8:710:e45a:dc00:ff:fec1:654d | Automatic |
| CNAME | wiki-static | wiki.iterativechaos.com | Automatic |
It may take a bit to cascade through your resolvers. If you want to be able to hit it immediately, you can update your /etc/hosts file. Add a line like "35.165.2.213 mediawiki.domain.com" but with your IP and domain, after the localhost mappings.
Instance Setup
Host System Update
ssh -i ~/.ssh/secret.pem root@2001:bc8:710:e45a:dc00:ff:fec1:654d apt update apt upgrade adduser bob mkdir /home/bob/.ssh cat pubkey.pub > /home/bob/.ssh/authorized_keys chown bob:bob /home/bob/.ssh chown bob:bob /home/bob/.ssh/authorized_keys chmod go-rwx /home/bob/.ssh chmod go-rwx /home/bob/.ssh/authorized_keys usermod -aG sudo bob
Client Setup
/etc/hosts
update your /etc/hosts:
212.47.239.249 wiki.iterativechaos.com wiki.bobbushman.com wiki-static.iterativechaos.com wiki-static.bobbushman.com mw.iterativechaos.com mw-static.iterativechaos.com 2001:bc8:710:e45a:dc00:ff:fec1:654d wiki.iterativechaos.com wiki.bobbushman.com wiki-static.iterativechaos.com wiki-static.bobbushman.com mw.iterativechaos.com mw-static.iterativechaos.com
.ssh/config
cp .ssh/config .ssh/config.old cat >> .ssh/config Host wiki.bobbushman.com User bob IdentityFile /home/bob/.ssh/SECRET_CHANGE_ME.pem Host wiki.iterativechaos.com User bob IdentityFile /home/bob/.ssh/SECRET_CHANGE_ME.pem ^d ssh wiki.bobbushman.com
System Update and Core Software
Following is based, in part, on MediaWiki Installation Requirements.
Log in to your host.
Create the setup script:
$ mkdir bin $ cat > bin/system-update.sh sudo apt update -y && \ sudo apt upgrade -y && \ sudo apt install -y emacs-nox bzip2 cron && \ sudo apt install -y apache2 certbot python3-certbot-apache && \ sudo apt install -y mariadb-server php php-mysql libapache2-mod-php && \ sudo apt install -y php-xml php-mbstring php-apcu php-intl php-cli php-curl && \ sudo apt install -y git imagemagick texlive composer
Control-d will exit and save the file.
$ chmod ug+x bin/system-update.sh $ ./bin/system-update.sh
If you're not sure that it all ran correctly, you can safely re-run the script. You'll know it ran correctly if the output is roughly 40 lines saying things like, "already the newest", "0 upgraded", and "... Done".
MediaWiki Tarball
- https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki
- https://www.mediawiki.org/wiki/Special:MyLanguage/Download
I am installing from the tarball instead of using the Debian package because other package tools, like RPM or Snap, or other distros than Debian, might put directories in different places. Following the MediaWiki tarball instructions should be close to universal.
$ mkdir apps $ cd apps $ wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.3.tar.gz
One difference on other distros may be the location of web content directories. Debian puts them in /var/www. Adjust the following commands to match your distro's structure if you're not using Deb 10.
I'm moving the stock Apache site to a directory for static content, and linking mediawiki to the wiki engine directory. The symlink will make it a bit easier to upgrade to the next version of MediaWiki.
$ cd /var/www $ sudo tar -xvzf ~/apps/mediawiki-1.43.3.tar.gz $ sudo mv html static $ sudo ln -s mediawiki-1.43.3 mediawiki
Configure MariaDB
Pick a username for MediaWiki to use (I'm using wiki_wiki as an example).
Pick a database name (I'm using hsl_wiki as an example). We'll also create "install_wiki" to hold the default install as a backup in case we have troubles cloning the legacy database.
Pick a password other than "CHANGE THIS PASSWORD".
$ cd ~/bin $ cat > mariadb-wiki-account.sql create database install_wiki; create database traxel_wiki; grant all on install_wiki.* to 'wiki_wiki'@'localhost' identified by 'CHANGE THIS PASSWORD'; grant all on traxel_wiki.* to 'wiki_wiki'@'localhost' identified by 'CHANGE THIS PASSWORD'; flush privileges;
Control-D to write the file.
$ sudo mariadb < mariadb-wiki-account.sql
Then you can verify it worked if you like. (there won't be any tables, but it shouldn't give you an auth error)
$ mariadb -u wiki_wiki -p MariaDB> show tables in traxel_wiki; MariaDB> exit
Configure Apache
Next we'll add an Apache config for wiki-new.domain.com that points to the MediaWiki engine, and another for wiki-static-new.domain.com that points to a static content directory.
$ cd ~/ $ mkdir -p conf/apache $ cd conf/apache
/etc/apache2/sites-available/wiki.bobbushman.conf
$ cd ~/conf/apache
$ cat > wiki.bobbushman.conf
<VirtualHost *:80>
ServerName wiki.bobbushman.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mediawiki
ErrorLog ${APACHE_LOG_DIR}/wiki-bobbushman-error.log
CustomLog ${APACHE_LOG_DIR}/wiki-bobbushman-access.log combined
</VirtualHost>
/etc/apache2/sites-available/wiki-static.bobbushman.conf
$ cd ~/conf/apache
$ cat > wiki-static.bobbushman.conf
<VirtualHost *:80>
ServerName wiki-static.bobbushman.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/static
ErrorLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-error.log
CustomLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-access.log combined
</VirtualHost>
Copy to sites-available
$ sudo cp ~/conf/apache/*conf /etc/apache2/sites-available/
Activate Host Configs
Activate the mediawiki conf and bounce the server.
$ sudo a2ensite wiki.bobbushman wiki-static.bobbushman $ sudo systemctl reload apache2
Check Sites
Now you should be able to see the two Apache configs at the desired host addresses:
- http://wiki-new.traxel.com/ (should show the MediaWiki logo page with a link to the config script)
- http://wiki-static-new.traxel.com/ (should show the static Apache2 root directory)
If you went through this script quickly, the DNS may not have cascaded yet. You could try editing your /etc/hosts file, or go get a cup of coffee and read Reddit for half an hour, then try again.
Enable TLS (SSL)
To keep your errors easy to diagnose and resolve, do one site at a time and verify / fix errors independently.
Keys get automatically written to: /etc/letsencrypt/live/
$ sudo certbot --apache -d wiki.bobbushman.com
When it asks about redirects, choose, "2: Redirect - Make all requests redirect to secure HTTPS access."
Hit http://wiki.bobbushman.com and verify it redirects to https:// and shows the correct content. If there are any errors, fix them before moving on.
$ sudo certbot --apache -d wiki-static.bobbushman.com
When it asks about redirects, choose, "2: Redirect - Make all requests redirect to secure HTTPS access."
Hit http://wiki-static.bobbushman.com and verify it redirects to https:// and shows the correct content. Fix any errors before moving on.
Note: For some reason I had to 'sudo systemctl restart apache2' to get the redirect to work, even though the 443 site worked without it. <shrug>
Run The MediaWiki Config Script
Get a logo image file ready to drag and drop. You will need it later.
Upload a logo image to /var/www/static and get the link ready, like: https://wiki-static.bobbushman.com/wiki-logo-cartoon.png
Go to https://wiki.bobbushman.com/ and click on the setup hyperlink.
Note: Figure out the image upload "nosniff" stuff: https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Security#Upload_security
Connect to Database
- database host: localhost
- database name: install_wiki
- database table prefix: <LEAVE BLANK>
- database username: wiki_wiki
- database password: <YOUR PASSWORD>
Database Settings
I use the same settings for web access as for installation.
Name
- name of wiki: Bobs Wiki
- project namespace: same as the wiki name
- your username: <YourWikiname, conventionally FirstnameLastname>
- password: <A DIFFERENT PASSWORD>
- repeat password: <THE SAME, DIFFERENT PASSWORD>
- email address: <LEAVE BLANK>
- ask me more questions: tick this radio button
- I'm bored already: don't tick this, there's important stuff ahead
Options
In the sections below from Special Pages to Other, you can get more info on extensions by tacking the extension name after the colon in the following URL: https://www.mediawiki.org/wiki/Extension:TextExtracts
- user rights profile: Authorized editors only
- copyright and license: No license footer
- email settings: uncheck Enable outbound email
- skins: select all and use Vector as the default
- special pages: I include all 5
- editors: I include all 3
- parser hooks: I include CategoryTree, Cite, Math, SyntaxHighlight_GeSHi, and TemplateData
- media handlers: I include PdfHandler
- spam prevention: I don't use these, since I used "authorized editors" above.
- api: I include PageImages
- Other: I include MultimediaViewer and SecureLinkFixer
- images and file uploads: check "enable file uploads", leave the default directory setting
- personalization: Drag your wiki logo to both the "Logo" and "Sidebar Logo" settings. (Note: it is a *lot* easier to do this now, don't skip this step)
- advanced configuration: use PHP caching - we installed apcu earlier.
Language
Pick your language.
Install
When you click continue, this page will write the database.
Complete
This page will automatically start a download of the LocalSettings.php file.
Install LocalSettings.php
Push a copy to the server at ~/conf/LocalSettings-[datestamp].php .
Log in to the server to install the config. While we're at it, we'll set the images directory structure to be owned by www-data, so image uploads will work.
$ sudo usermod -aG www-data admin $ sudo chown -R admin /var/www/mediawiki/ $ exit
Then log back in.
$ groups # should show www-data $ cp ~/conf/LocalSettings-traxel-2022-09-05.php /var/www/mediawiki/LocalSettings.php $ sudo chown -R www-data /var/www/mediawiki/images $ sudo service apache2 restart
Now the wiki should be live.
Multi-Wiki
Set up a single wiki first, do the config, and grab the LocalSettings.php file, which will be used to create the per-instance LocalSettings_instancename.conf files.
Apache Conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mediawiki
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName wiki-static.bobbushman.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/static
ErrorLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-error.log
CustomLog ${APACHE_LOG_DIR}/wiki-static-bobbushman-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName wiki-static.iterativechaos.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/static
ErrorLog ${APACHE_LOG_DIR}/wiki-static-iterativechaos-error.log
CustomLog ${APACHE_LOG_DIR}/wiki-static-iterativechaos-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName wiki.bobbushman.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mediawiki
ErrorLog ${APACHE_LOG_DIR}/wiki-bobbushman-error.log
CustomLog ${APACHE_LOG_DIR}/wiki-bobbushman-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName wiki.iterativechaos.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mediawiki
ErrorLog ${APACHE_LOG_DIR}/wiki-iterativechaos-error.log
CustomLog ${APACHE_LOG_DIR}/wiki-iterativechaos-access.log combined
</VirtualHost>
LocalSettings.php
<?php
$wikis = [
'wiki.bobbushman.com' => 'bobbushman',
'wiki.iterativechaos.com' => 'iterativechaos',
];
if ( defined( 'MW_DB' ) ) {
// Automatically set from --wiki option to maintenance scripts
$wikiID = MW_DB;
} else {
// Use MW_DB environment variable or map the domain name
$wikiID = $_SERVER['MW_DB'] ?? $wikis[ $_SERVER['SERVER_NAME'] ?? '' ] ?? null;
}
if ( $wikiID ) {
require_once "LocalSettings_$wikiID.php";
// } else {
// die( 'Unknown wiki.' );
}
// Add any settings that should apply to all wikis below this line
// -------
Then just put the regular LocalSettings.php in LocalSettings_foo.php
OLDER STUFF BELOW HERE
OLDER STUFF BELOW HERE
OLDER STUFF BELOW HERE
Process
- Backup Existing Wikis
- wiki.traxel.com last
- Check Lightsail
- Check Namecheap
- Shutdown All but wiki.traxel.com
- Verify that the others are all mostly vestigial during backup.
- Decide which to keep, maybe keep all by default, how hard to purge the whole instance after content migration?
- Keep wiki.traxel.com live until the new version is live.
- Verify that the others are all mostly vestigial during backup.
- Create size 2 or 3 instance on Lightsail.
- Install MediaWiki as a multi-wiki on wiki.bobbushman.com
- Instances at /pub, /private, /traxel
- Restore /traxel from wiki.traxel.com
- Restore others?
OLDER OLDER STUFF BELOW HERE
Add Markdown Handler
Create a Host
I'm not going to document this part. Pick your favorite hosting service and create a Debian 12 host.
If your provider supports it, get a permanent IP address and point it at the new host. This will let you blow away the host, create a new one, point the IP at the new host, and redo the install without having to update the DNS entry and wait for the cascade.
Note the IP address.
Configure Markdown
ChatGPT makes its output available in Markdown format. While I personally prefer MediaWiki format, Markdown is both more broadly supported and is what ChatGPT spits out; it's handy to support it directly. Fortunately, there's a MediaWiki plugin for Markdown.
Composer
Earlier, during the initial system setup, we included the following in support of the Markdown plugin:
apt install -y composer
Now we need to enable it in the wiki config:
$ cd /var/www/mediawiki $ sudo cp composer.local.json-sample composer.local.json $ sudo emacs -nw composer.local.json
Add the following line in the extra plugin include:
{
"extra": {
"merge-plugin": {
"include": [
"extensions/WikiMarkdown/composer.json"
]
}
}
}
$ composer update $ cd extensions $ git clone https://github.com/kuenzign/WikiMarkdown.git $ git clone https://github.com/BenjaminHoegh/ParsedownExtended.git $ cd ..
Clone the Legacy Wiki
LocalSettings.php
Compare the LocalSettings.php from the legacy server with the new LocalSettings.php file.
I used diff and did a line by line check. It was pretty quick and all the differences were reasonable.
I wasn't satisfied with the permissions from my legacy wiki, nor what was produced by the configuration wizard. I updated the permissions section in LocalSettings.php to read as follows:
# The following permissions were set based on your choice in the installer $wgGroupPermissions['*']['createaccount'] = true; $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['user']['edit'] = false; $wgGroupPermissions['user']['move'] = false; $wgGroupPermissions['writer']['edit'] = true; $wgGroupPermissions['writer']['move'] = true;
Also add this at the end of the file:
$wgDBerrorLog = "/var/log/mediawiki/db-errors.log";
And:
$ sudo mkdir /var/log/mediawiki $ sudo chown www-data /var/log/mediawiki
Database
Log in to the legacy server, stop Apache, and dump the database.
$ sudo service apache stop $ mysqldump -p -u wiki_wiki traxel_wiki | bzip2 > traxel-wiki-dump-2022-09-05.sql.bz2
Transfer the database dump to the new server.
Load the database dump into the new server.
$ bzip2 -dc traxel-wiki-dump-2022-09-05.sql.bz2 | mariadb -p -u wiki_wiki traxel_wiki
Edit /var/www/mediawiki/LocalSettings.php. Change $wgDBname = "install_wiki"; to $wgDBname = "traxel_wiki"; then bounce Apache.
$ sudo emacs -nw /var/www/mediawiki/LocalSettings.php $ sudo service apache2 restart
Images
Back up the images from the legacy wiki. Log in to the old server.
$ cd /var/www/mediawiki $ tar -cvjf ~/images.tar.bz2 ./images
Push a copy of the tarball to the new server at ~/data/.
Log in to the new server to load the images.
$ sudo service apache2 stop $ cd /var/www/mediawiki $ sudo mv images images.old $ sudo tar -xvjf ~/data/images.tar.bz2 $ sudo chown -R www-data images
Test The Wiki
Check out the wiki, make sure everything is working. The next step is the cutover; if anything isn't working right, it's easy to fix now.
- Spot check content pages.
- Spot check pages that contain images.
- Create an account, but don't give it privileges.
- Try editing a page using your admin account. (should work)
- Try editing a page using the unpermissioned account. (should fail)
- From your admin account, grant permissions to the unpermissioned account.
- Try editing a page using the previously unpermissioned account.
Switch DNS
Go to your DNS provider and point wiki and wiki-new to your new server.
Also update LocalSettings.php; change $wgServer = "https://wiki-new.traxel.com"; to $wgServer = "https://wiki.traxel.com";
$ sudo emacs -nw /var/www/mediawiki/LocalSettings.php
Now it's going to take a while for the DNS to cascade before we can do the new TLS certs. That makes this a good time to set up the backups.
Set Up Nightly Backups
This script will make the backup available on the static content site. Until the DNS cutover, you can see it at https://wiki-static-new.traxel.com/backups Later it will be available at https://wiki-static.traxel.com/backups .
This assumes that the administrator user account is "admin".
In the script below, put your password on the first line, but don't change "YOUR_PASSWORD" in the sed line near the end. That is used to overwrite your password before creating the backup archive.
$ sudo mkdir -p /var/www/static/backups $ sudo chown admin /var/www/static/backups $ cat > ~/bin/nightly_backup.sh export db_pass=[YOUR_PASSWORD] export wiki_db_name=traxel_wiki export dstamp=`date +%Y-%m-%d` export bundle_dir=wiki-backup-$dstamp export bundle_path=/tmp/$bundle_dir export dump_path=/tmp/wiki-backup-$dstamp/$wiki_db_name.sql.bz2 export image_archive_path=/tmp/wiki-backup-$dstamp/$wiki_db_name-images.tar.bz2 export conf_path=/tmp/wiki-backup-$dstamp/LocalSettings.php export tarball_path=/var/www/static/backups/wiki-backup.tar.bz2 mkdir -p $bundle_path cp /var/www/mediawiki/LocalSettings.php $conf_path sed -i s/$db_pass/YOUR_PASSWORD/ $conf_path mysqldump -u wiki_wiki --password=$db_pass $wiki_db_name | bzip2 > $dump_path tar -C /var/www/mediawiki -cjf $image_archive_path /var/www/mediawiki/images tar -C /tmp -cvjf $tarball_path $bundle_dir export delete_dstamp=`date --date='last month' +%Y-%m-%d` export delete_bundle_dir=wiki-backup-$delete_dstamp export delete_bundle_path=/tmp/$delete_bundle_dir export delete_dump_path=/tmp/wiki-backup-$delete_dstamp/$wiki_db_name.sql.bz2 export delete_image_archive_path=/tmp/wiki-backup-$delete_dstamp/$wiki_db_name-images.tar.bz2 export delete_conf_path=/tmp/wiki-backup-$delete_dstamp/LocalSettings.php rm $delete_dump_path rm $delete_image_archive_path rm $delete_conf_path rmdir $delete_bundle_path
Control-d will exit and save the file.
Try running it and verify everything works.
$ cd ~ $ chmod ug+x bin/nightly_backup.sh $ ./bin/nightly_backup.sh
Verify that the database password is getting replaced with "YOUR_PASSWORD" in LocalSettings.php.
Try going to https://wiki-static-new.traxel.com/backups to confirm the backup is visible.
Running it repeatedly will just overwrite the files, so you're safe to test to your heart's content without filling the hard drive.
Cron Entry
Start with a crontab entry that runs the backup every ten minutes, so you can see it run.
*/10 * * * * /home/admin/bin/nightly_backup.sh
Then switch it to nightly. My server runs on zulu time, so I set it to run at 01:20 with the following:
20 8 * * * /home/admin/bin/nightly_backup.sh
Get New TLS Certificates
Hopefully the backup setup has taken long enough that we can now get the production URL TLS certs.
$ sudo certbot --apache -d wiki-static.traxel.com -d wiki.traxel.com $ sudo service apache2 restart
Pull The Backups Somewhere
Backups don't do much good if they're not being stored somewhere. Set up a cron script, maybe on one of HSL's on-prem servers, to periodically pull a copy of the wiki backup.
Grab this URL periodically, perhaps with a rotation cycle that retains dailies for a week, weeklys for a month, monthlys for a year, and yearlys forever (or something).
I'm using the following, which is simpler but has a bit more risk of loss:
30 9 * * * wget -O /home/bob/Downloads/wiki-backups/traxel-wiki-nightly.tar.bz2 https://wiki-static.traxel.com/backups/wiki-backup.tar.bz2 30 9 1 * * wget -O /home/bob/Downloads/wiki-backups/traxel-wiki-monthly.tar.bz2 https://wiki-static.traxel.com/backups/wiki-backup.tar.bz2 30 9 1 1 * wget -O /home/bob/Downloads/wiki-backups/traxel-wiki-yearly.tar.bz2 https://wiki-static.traxel.com/backups/wiki-backup.tar.bz2
Test Everything
Errors & Fixes
Error Listing All Pages
Tue Sep 6 4:02:42 UTC 2022 ip-172-26-9-72 traxel_wiki Error 1176 from SpecialPrefixindex::showPrefixChunk, Key 'page_name_title' doesn't exist in table 'page' (localhost) SELECT page_namespace,page_title,page_id,page_namespace,page_title,page_is_redirect,page_is_new,page_latest,page_touched,page_len,page_restrictions,page_content_model FROM `page` FORCE INDEX (page_name_title) WHERE page_namespace = 0 AND (page_title LIKE 'Trax%' ESCAPE '`' ) AND (page_title >= '') ORDER BY page_title LIMIT 346 localhost
#0 /var/www/mediawiki-1.38.2/includes/libs/rdbms/database/Database.php(1564): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /var/www/mediawiki-1.38.2/includes/libs/rdbms/database/Database.php(1173): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /var/www/mediawiki-1.38.2/includes/libs/rdbms/database/Database.php(1810): Wikimedia\Rdbms\Database->query(string, string, integer)
#3 /var/www/mediawiki-1.38.2/includes/libs/rdbms/database/DBConnRef.php(69): Wikimedia\Rdbms\Database->select(string, array, array, string, array)
#4 /var/www/mediawiki-1.38.2/includes/libs/rdbms/database/DBConnRef.php(319): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#5 /var/www/mediawiki-1.38.2/includes/specials/SpecialPrefixindex.php(205): Wikimedia\Rdbms\DBConnRef->select(string, array, array, string, array)
#6 /var/www/mediawiki-1.38.2/includes/specials/SpecialPrefixindex.php(103): SpecialPrefixindex->showPrefixChunk(integer, string, string)
#7 /var/www/mediawiki-1.38.2/includes/specialpage/SpecialPage.php(671): SpecialPrefixindex->execute(NULL)
#8 /var/www/mediawiki-1.38.2/includes/specialpage/SpecialPageFactory.php(1378): SpecialPage->run(NULL)
#9 /var/www/mediawiki-1.38.2/includes/MediaWiki.php(315): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#10 /var/www/mediawiki-1.38.2/includes/MediaWiki.php(912): MediaWiki->performRequest()
#11 /var/www/mediawiki-1.38.2/includes/MediaWiki.php(563): MediaWiki->main()
#12 /var/www/mediawiki-1.38.2/index.php(53): MediaWiki->run()
#13 /var/www/mediawiki-1.38.2/index.php(46): wfIndexMain()
#14 {main}
1.32 version of table "page":
UNIQUE KEY `page_name_title` (`page_namespace`,`page_title`),
1.38 version of table "page":
UNIQUE KEY `name_title` (`page_namespace`,`page_title`),
This fixes it:
create unique index page_name_title on page (page_namespace, page_title); drop index name_title on page;