metakgp / metakgp-wiki

Dockerized source for the metakgp wiki.
https://wiki.metakgp.org
GNU General Public License v3.0
23 stars 20 forks source link
docker hacktoberfest mediawiki metakgp nginx php server
[![Contributors][contributors-shield]][contributors-url] [![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url] [![Wiki][wiki-shield]][wiki-url]


image

MetaKGP Wiki

Dockerized for fun and profit.
Wiki · Report Bug / Request Feature

Table of Contents - [About](#about-the-project) - [Getting Started](#getting-started) - [Prerequisites](#prerequisites) - [Deployment](#deployment) - [Development](#development) - [Production](#production) - [Environment Variables](#environment-variables) - [Setting Up Secondary Services](#setting-up-secondary-services) - [Runbook](./RUNBOOK.md) - [Maintainer(s)](#maintainers) - [Contact](#contact) - [Additional documentation](#additional-documentation)

About

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.

Architecture

(back to top)

Getting Started

See also: The Runbook for a quick reference to processes needed to manage a production wiki.

Prerequisites

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.

(back to top)

Deployment

NOTE: See the #Production section for production deployment. DO NOT follow the development instructions in a production environment.

Development

  1. Set up MetaPloy.
  2. Clone this repository.
  3. Copy the contents of the .env.template file into the .env file. Create the file if it doesn't exist.
  4. Set the necessary environment variables.
  5. Run docker compose up to start the wiki. The wiki will be accessible on localhost:8080 or whichever port MetaPloy is set to use.

(back to top)

Production

  1. Set up MetaPloy for production.
  2. Clone this repository at a convenient location such as /deployments.
  3. Set the appropriate production environment variables in the .env file.
  4. Run 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.
  5. Optionally set up a Systemd service to start the wiki on startup.

(back to top)

Environment Variables

Environment variables can be set using a .env file(use .env.template file for reference). The following variables are used:

Setting Up Secondary Services

Dropbox Backups

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:

  1. Create an app on the Dropbox App Console.
  2. Copy the app key and app secret and set the corresponding environment variables.
  3. Run the script /scripts/get_dropbox_tokens.py and when prompted, enter the app key and app secret.
  4. Set the generated API access token and refresh tokens in the environment variables.
Slack Notifications

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.

  1. Create a Slack app.
  2. Enable "Incoming Webhooks".
  3. Copy the webhook URL and set the appropriate environment variables.
Mailgun

Mailgun is used by the wiki as a mailing service for sending various emails to the users such as account verification and notifications.

  1. Add a new domain in the "Sending" section on Mailgun.
  2. Copy the SMTP password and set the appropriate environment variables.
PyWikiBot (Batman)

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.

  1. Create a bot account on the Wiki.
  2. Add the bot's password to the BATMAN_BOT_PASSWORD variable in the environment variables.
Google Analytics

The legacy google analytics features used here are now deprecated. This needs to be reworked.

Maintainer(s)

(back to top)

Contact

📫 Metakgp - Metakgp's slack invite Metakgp's email metakgp's Facebook metakgp's LinkedIn metakgp's Twitter metakgp's Instagram

(back to top)

Additional documentation

(back to top)