misp-modules icon indicating copy to clipboard operation
misp-modules copied to clipboard

Update installation documentation to match Poetry2

Open jfstenuit opened this issue 9 months ago • 1 comments

The documentation for the installation is misleading and confusing, mixing old venv/pip install and poetry.

This is a pitty, as the new poetry way of install works like a charm when you get to understand its logic.

I would suggest the following process :

As root, create the poetry2 environment for www-data :

cd /var/www
for dn in .cache .local misp-modules; do
sudo mkdir /var/www${dn}
sudo chown www-data:www-data /var/www/${dn}
done

Switch to www-data user with sudo -u www-data -s

Download Poetry2 and install it in www-data 's environment (don't use system-suplied poetry, likely outdated).

curl -sSL https://install.python-poetry.org | python3 -
export PATH="/var/www/.local/bin:$PATH"
poetry --version

Download misp-modules and install it :

cd /var/www
git clone https://github.com/MISP/misp-modules.git
poetry install -E all

Get path to poetry's venv :

poetry env info --path

Use the poetry venv path to create the systemd file in /etc/systemd/system/misp-modules.service:

[Unit]
Description=System-wide instance of the MISP Modules
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/misp-modules
ExecStart=/var/www/.cache/pypoetry/virtualenvs/misp-modules-a47tzaLC-py3.12/bin/misp-modules -l 127.0.0.1

[Install]
WantedBy=multi-user.target

jfstenuit avatar Apr 03 '25 16:04 jfstenuit

Should be equivalent to python -m venv venv && source ./venv/bin/activate && pip install misp-modules[all] and then use the python interpreter inside venv/bin for the systemd unit, shouldn't be?

ostefano avatar Apr 04 '25 11:04 ostefano