Differences between revisions 1 and 2
Revision 1 as of 2020-03-03 19:06:40
Size: 3243
Comment:
Revision 2 as of 2020-03-03 20:17:49
Size: 3681
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
MoinMoin is a wiki software. Version 1 (current release) runs on Python 2 with vendored dependencies, a complex plugin ecosystem, and no plan for security support. Version 2 (unstable) runs on Python 3 with the Flask ecosystem. !MoinMoin is a wiki software. Version 1 (current release) runs on Python 2 with vendored dependencies, a complex plugin ecosystem, and no plan for security support. Version 2 (unstable) runs on Python 3 with the Flask ecosystem.
Line 13: Line 13:
MoinMoin requires a running web server with uWSGI. The below walkthrough uses NGINX and skims over security and configuration details. !MoinMoin requires a running web server running [[PythonSetup|Python]] and [[UWSGISetup|uWSGI]]. The below walkthrough skims over security and configuration details.
Line 19: Line 19:
Create a server location that passes into the MoinMoin socket. then enable and start the NGINX service. Create a server location that passes into the !MoinMoin socket. then enable and start the NGINX service.
Line 38: Line 38:
See [[NGINXSetup|here]] for more details on setting up NGINX.
Line 41: Line 43:

Use the NGINX plugin for `certbot`.

{{{
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install python-certbot-nginx
sudo certbot --nginx -d wiki.dominic-ricottone.com
}}}

See [[SSLSetup|here]] for more details on setting up SSL.

Line 47: Line 62:


See [[UWSGISetup|here]] for more details on setting up uWSGI.
Line 56: Line 74:
To insulate the MoinMoin instance from the wider web server, it should be installed inside a virtual environment. To insulate the !MoinMoin instance from the wider web server, it should be installed inside a virtual environment.
Line 64: Line 82:
MoinMoin and its dependencies can now be installed safely. !MoinMoin and its dependencies can now be installed safely.
Line 80: Line 98:
Unpack key directories and files from the installed MoinMoin package. Unpack key directories and files from the downloaded !MoinMoin package.

MoinMoin

!MoinMoin is a wiki software. Version 1 (current release) runs on Python 2 with vendored dependencies, a complex plugin ecosystem, and no plan for security support. Version 2 (unstable) runs on Python 3 with the Flask ecosystem.


Server Setup

!MoinMoin requires a running web server running Python and uWSGI. The below walkthrough skims over security and configuration details.

NGINX

Create a server location that passes into the !MoinMoin socket. then enable and start the NGINX service.

server {
        listen 80 default_server;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        location / {
                include /etc/nginx/uwsgi_params;
                uwsgi_pass unix:///var/www/moin/moin.sock;
                uwsgi_modifier1 30;
        }
}

Often, uWSGI apps recommend adding uwsgi_modifier1 30 to rewrite PATH_INFO and SCRIPT_NAME. This is a deprecated measure, and is unstable for Python 3+. Instead, configure uWSGI.

See here for more details on setting up NGINX.

Let's Encrypt

Use the NGINX plugin for certbot.

sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install python-certbot-nginx
sudo certbot --nginx -d wiki.dominic-ricottone.com

See here for more details on setting up SSL.

uWSGI

sudo apt install uwsgi uwsgi-plugin-python

See here for more details on setting up uWSGI.


MoinMoin Setup

Python Dependencies

To insulate the !MoinMoin instance from the wider web server, it should be installed inside a virtual environment.

sudo apt install python-pip
sudo pip install virtualenv
sudo virtualenv /var/www/moin/pythonenv

!MoinMoin and its dependencies can now be installed safely.

#download
cd /tmp
wget http://static.moinmo.in/files/moin-1.9.10.tar.gz
tar zxvf moin-1.9.10.tar.gz
cd ./moin-1.9.10

#install
source /var/www/moin/pythonenv/bin/activate
python ./setup.py install

Configuration

Unpack key directories and files from the downloaded !MoinMoin package.

cp -r /tmp/wiki /var/www/moin
cp /tmp/config/wikiconfig.py /var/www/moin/wiki/
cp /tmp/server/moin.wsgi /var/www/moin/wiki/

Insert the below into wikiconfig.py, after import os but before from MoinMoin.config import multiconfig, url_prefix_static.

import sys
sys.path.insert(0, '/var/www/moin/pythonenv/lib/python2.7/site-packages/')
sys.path.insert(0, '/var/www/moin/wiki/')

Create a new file, uwsgi.ini.

[uwsgi]
uid = moin
gid = www-data
socket = /var/www/moin/moin.sock
chmod-socket = 660
plugin = python

chdir = /var/www/moin/wiki
wsgi-file = /var/www/moin/wiki/moin.wsgi

master
workers = 3
max-requests = 200
harakiri = 60
die-on-term

Permissions

You know you'll have permissions errors eventually. Preempt them.

chown www-data:www-data -R /var/www/moin
chmod g+w,o-rwx -R /var/www/moin

Service File

Create a service file at /etc/systemd/system/moinmoin.service. It should call uWSGI with the configuration we just setup.

[Unit]
Description=Start uwsgi for MoinMoin wiki
After=network.target

[Service]
Type=simple
User=www-data
ExecStart=/usr/bin/uwsgi --ini /var/www/moin/wiki/uwsgi.ini

[Install]
WantedBy=multi-user.target

Enable and start the service, and enjoy your wiki!


CategoryRicottone

Python/MoinMoin (last edited 2023-04-08 20:48:33 by DominicRicottone)