Jump to content

Documentation:Wiki Deployment

From jb-vpn.uk Wiki
Revision as of 14:45, 16 May 2026 by Josh (talk | contribs) (Updated documentation from markdown files)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Production wikis run on this VPS under /var/www/wiki.jb/.

Stack

[edit]
Service Container Public URL Upstream
Main wiki wiki-mediawiki https://wiki.jb-vpn.uk 127.0.0.1:8010
Werbs wiki wiki-werbs-mediawiki https://werbs-wiki.jb-vpn.uk 127.0.0.1:8011
Database wiki-mariadb (internal) 127.0.0.1:3307
  • MediaWiki version: 1.44 (Docker image mediawiki:1.44)
  • Edge proxy: Caddy (/etc/caddy/Caddyfile) terminates HTTPS and proxies to the containers
  • Config on host: wiki/LocalSettings.php, werbs-wiki/LocalSettings.php (mounted read-only; group www-data must be able to read)
  • Uploads: wiki/images/, werbs-wiki/images/

Daily operations

[edit]
cd /var/www/wiki.jb
docker compose ps
docker compose logs -f wiki
docker compose restart wiki werbs-wiki

Upload documentation from the VPS:

python3 /root/wiki_manager.py --upload -y
python3 /root/wiki_manager.py --update-main-page -y

Optional uploads without public HTTPS round-trip:

python3 /root/wiki_manager.py --upload -y --wiki-url http://127.0.0.1:8010

Email

[edit]

Outbound mail uses Fastmail SMTP (configured in each LocalSettings.php: $wgSMTP, $wgPasswordSender, $wgEmergencyContact). After editing settings on the host, ensure permissions remain 640 and group www-data.

Backups

[edit]
cd /var/www/wiki.jb
bash scripts/backup-wikis.sh

Creates backups/YYYY-MM-DD/ with mediawiki.sql, mediawiki_werbs.sql, and wiki-images.tar.gz. Deletes backup folders older than 30 days (RETENTION_DAYS=0 to disable pruning).

Weekly cron (root):

0 3 '' '' 0 /var/www/wiki.jb/scripts/backup-wikis.sh >> /var/log/wiki-backup.log 2>&1

Maintenance

[edit]
cd /var/www/wiki.jb
source .env
docker compose exec -T wiki php maintenance/run.php update --quick --conf /var/www/html/LocalSettings.php
docker compose exec -T werbs-wiki php maintenance/run.php update --quick --conf /var/www/html/LocalSettings.php

Logos after image restores: bash scripts/fix-logos.sh

Extensions

[edit]

The VPS LocalSettings.php files use the default MediaWiki 1.44 extension set from the installer (skins only unless you add more). Content was imported from the NAS farm; per-wiki farm files (LocalSettings_wiki.php, LocalSettings_werbs-wiki.php) are not on this server.

To restore NAS-only extensions:

  1. Copy farm configs from the NAS backup (e.g. /volume2/Backups/wiki-migration-* or /volume2/web_packages/mediawiki/).
  2. Merge any wfLoadExtension(...) lines into the matching VPS LocalSettings.php.
  3. Run maintenance/run.php update --quick in the affected container.

$wgEnableUploads is enabled so existing files under wiki/images/ and werbs-wiki/images/ remain usable.

Scripts (/var/www/wiki.jb/scripts/)

[edit]
Script Purpose
backup-wikis.sh Dump both DBs and image trees to backups/YYYY-MM-DD/
fix-logos.sh Set $wgLogos paths after image changes
init-db-users.sh Create/grant wikiuser in MariaDB
install-wikis.sh Fresh MediaWiki install (empty DB only)

First-time install (empty databases)

[edit]

Only needed on a fresh stack without imported content:

cd /var/www/wiki.jb
cp .env.example .env   # set passwords
docker compose up -d
bash scripts/init-db-users.sh
bash scripts/install-wikis.sh

Admin credentials from .env: WIKI_ADMIN_USER / WIKI_ADMIN_PASSWORD (installer account; production wiki admin is the imported Josh sysop account).