This is the dockerized source for the MetaKGP Wiki deployed at https://wiki.metakgp.org. The wiki is a Mediawiki instance with some extensions and services that take backups and update certain pages.
It is hosted on a DigitalOcean droplet with 2GB RAM and a single CPU. See MetaPloy for the deployment architecture.
See also: The Runbook for a quick reference to processes needed to manage a production wiki.
Docker and docker compose are the only required dependencies. You can either install Docker Desktop or the Docker Engine. For minimal installations and production use cases, Docker Engine is recommended.
NOTE: See the #Production section for production deployment. DO NOT follow the development instructions in a production environment.
.env.template
file into the .env
file. Create the file if it doesn't exist.docker compose up
to start the wiki. The wiki will be accessible on localhost:8080
or whichever port MetaPloy is set to use./deployments
..env
file.docker compose -f docker-compose.prod.yml up
to start the wiki. This enables the jobs
service which includes backups, log rotation, and other periodic jobs.Environment variables can be set using a .env
file(use .env.template
file for reference). The following variables are used:
DEV
: When set to true
, Mediawiki PHP stack-trace is shown with error messages. (Default: false
)MYSQL_PASSWORD
: A secret password for the MySQL database.SERVER_PORT
: Port on which the wiki server is exposed to the host. (Default: 8080
)SERVER_NAME
: Base URL of the wiki (eg: https://wiki.metakgp.org
).MAILGUN_EMAIL
: The email ID used for sending emails via Mailgun. (eg: [email protected]
)MAILGUN_PASSWORD
: Mailgun SMTP password for sending official mails from the wiki.WG_SECRET_KEY
: Secret key used for encryption by mediawiki. Make it a long, random, secret string (Reference).DROPBOX_APP_KEY
: Dropbox app key (can be found at Dropbox App Console).DROPBOX_APP_SECRET
: Dropbox app secret (can be found at Dropbox App Console).DROPBOX_ACCESS_TOKEN
: Dropbox API access token (generated using /scripts/get_dropbox_tokens.py
)DROPBOX_REFRESH_TOKEN
: Dropbox API refresh token (generated using /scripts/get_dropbox_tokens.py
) used to refresh the access token.SLACK_CHANGES_WH_URL
: URL to the Slack webhook used to send updates about wiki changes. (See this section for more details)SLACK_INCIDENTS_WH_URL
: URL to the Slack webhook used to send incidents reports and errors(like Dropbox backup failure). (See this section for more details)BATMAN_BOT_PASSWORD
: A generated password of the Batman bot user account on the wiki(Mediawiki documentation to generate bot passwords can be found here).The jobs
service runs periodic local backups (see /jobs/backups
) and stores the last 30 days of backups on Dropbox. To set this up, a Dropbox app has to be created, and access tokens need to be generated:
/scripts/get_dropbox_tokens.py
and when prompted, enter the app key and app secret.The Slack notifications are sent via webhooks. Two webhooks are used by the wiki: Recent Changes webhook and Incidents webhook (See environment variables). The recent changes webhook logs recent changes to the wiki (page edits, user creation, etc.) and the incidents webhook notifies about server incidents such as backup failures.
Mailgun is used by the wiki as a mailing service for sending various emails to the users such as account verification and notifications.
PyWikiBot is a Python library that interfaces with the wiki as a bot (called "Batman") and is used to run various jobs such as updating the trending pages list. See /jobs/pywikibot
for a list of scripts.
BATMAN_BOT_PASSWORD
variable in the environment variables.The legacy google analytics features used here are now deprecated. This needs to be reworked.