Differences between revisions 6 and 7
Revision 6 as of 2021-11-20 20:56:17
Size: 3575
Comment:
Revision 7 as of 2021-11-20 21:32:05
Size: 2638
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from MoinMoinSetup
Line 14: Line 13:
!MoinMoin requires a running web server and uWSGI. The source files for !MoinMoin are available for download [[http://static.moinmo.in/files|here]].
Line 18: Line 17:
=== NGINX === === Prerequisites ===
Line 20: Line 19:
See [[NGINX]] for installation and configure for an uWSGI server. !MoinMoin requires a uswgi (the protocol) server. See [[UWSGI|here]] for details on running `uWSGI` (the server), and [[Python/UWSGI|here]] for details on configuring the Python plugin.
Line 22: Line 21:
{{{
server {
        listen 80 default_server;
!MoinMoin 1 has a complicated dependency structure and runs in the unsupported Python 2 runtime. To insulate the instance, it should ''at minimum'' be installed inside a virtual environment. See [[Python/Virtualenv|here]] for details on installing `virtualenv`.
Line 26: Line 23:
        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, [[UWSGI|configure uWSGI]].

Optionally but '''''strongly recommended''''', install an SSL/TLS certificate. See [[Encryption/Certbot|here]] for details on that process.
Alternatively, consider running the !MoinMoin inside a [[Docker|Docker container]].
Line 43: Line 27:
=== uWSGI === === Virtual Environment ===
Line 45: Line 29:
See [[Python|here]] for installation (if even necessary) of Python. Unpack the !MoinMoin tarball into a fresh directory, such as `/app/example.com`. Move into that directory, instantiate a virtual environment, and activate it now. Run `python ./steup.py install`.
Line 47: Line 31:
Then follow-up [[UWSGI|here]] for more details on setting up uWSGI.



=== MoinMoin ===



==== Python Dependencies ====

To insulate the !MoinMoin instance from the wider web server, it should be installed inside a virtual environment.
For `systemd(1)`-capable systems, [[Linux/Systemd|create, start, and enable]] the following service file:
Line 60: Line 34:
sudo apt install python-pip
sudo pip install virtualenv
sudo virtualenv /var/www/moin/pythonenv
}}}
[Unit]
Description=Start uwsgi for MoinMoin wiki
After=network.target
Line 65: Line 38:
!MoinMoin and its dependencies can now be installed safely. [Service]
Type=simple
User=www-data
ExecStart=/usr/bin/uwsgi --ini /app/example.com/wiki/uwsgi.ini
Line 67: Line 43:
{{{
#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
[Install]
WantedBy=multi-user.target
Line 81: Line 49:
==== Minimum Running Configuration ==== === Container ===
Line 83: Line 51:
In order to run, !MoinMoin expects a specific directories and scripts. Unpack these from the downloaded package.


----



== Configuratio
n ==

!MoinMoin expects a specific directories and scripts. Unpack these from the downloaded package.
Line 86: Line 63:
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/
cp -r /tmp/wiki /app/example.com
cp /tmp/config/wikiconfig.py /app/example.com/wiki/
cp /tmp/server/moin.wsgi /app/example.com/wiki/
Line 91: Line 68:
Insert the below into `wikiconfig.py`, after `import os` but before `from MoinMoin.config import multiconfig, url_prefix_static`. Insert the below into `wikiconfig.py` after `import os` but before `from MoinMoin.config import multiconfig, url_prefix_static`.
Line 95: Line 72:
sys.path.insert(0, '/var/www/moin/pythonenv/lib/python2.7/site-packages/')
sys.path.insert(0, '/var/www/moin/wiki/')
sys.path.insert(0, '/app/example.com/.venv/lib/python2.7/site-packages/')
sys.path.insert(0, '/app/example.com/wiki/')
Line 105: Line 82:
socket = /var/www/moin/moin.sock
chmod-socket = 660
socket = :9000
Line 109: Line 85:
chdir = /var/www/moin/wiki
wsgi-file = /var/www/moin/wiki/moin.wsgi
chdir = /app/example.com/wiki
wsgi-file = /app/example.com/wiki/moin.wsgi
Line 121: Line 97:
==== 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
}}}


Line 134: Line 99:
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.

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.


Installation

The source files for !MoinMoin are available for download here.

Prerequisites

!MoinMoin requires a uswgi (the protocol) server. See here for details on running uWSGI (the server), and here for details on configuring the Python plugin.

!MoinMoin 1 has a complicated dependency structure and runs in the unsupported Python 2 runtime. To insulate the instance, it should at minimum be installed inside a virtual environment. See here for details on installing virtualenv.

Alternatively, consider running the !MoinMoin inside a Docker container.

Virtual Environment

Unpack the !MoinMoin tarball into a fresh directory, such as /app/example.com. Move into that directory, instantiate a virtual environment, and activate it now. Run python ./steup.py install.

For systemd(1)-capable systems, create, start, and enable the following service file:

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

[Service]
Type=simple
User=www-data
ExecStart=/usr/bin/uwsgi --ini /app/example.com/wiki/uwsgi.ini

[Install]
WantedBy=multi-user.target

Container


Configuration

!MoinMoin expects a specific directories and scripts. Unpack these from the downloaded package.

cp -r /tmp/wiki /app/example.com
cp /tmp/config/wikiconfig.py /app/example.com/wiki/
cp /tmp/server/moin.wsgi /app/example.com/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, '/app/example.com/.venv/lib/python2.7/site-packages/')
sys.path.insert(0, '/app/example.com/wiki/')

Create a new file, uwsgi.ini.

[uwsgi]
uid = moin
gid = www-data
socket = :9000
plugin = python

chdir = /app/example.com/wiki
wsgi-file = /app/example.com/wiki/moin.wsgi

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

Service File


Configuration

Follow the on-screen instructions to setup a superuser, install language packs and addons, and set the front page.


CategoryRicottone

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