Skip to content
Finn Årup Nielsen edited this page May 14, 2024 · 19 revisions

Status

Setup on Wikimedia Toolforge

become wembedder
webservice --backend=kubernetes python3.9 shell
source ~/www/python/venv/bin/activate
cd ~/www/python/wembedder ; git pull
pip install -r ~/www/python/wembedder/requirements.txt
logout
webservice --backend=kubernetes -m 2G python3.9 restart # Takes several minutes
tail -f ~/uwsgi.log  # look at web log

Documentation available at https://wikitech.wikimedia.org/wiki/Help:Tool_Labs/Web#python_.28Python3_.2B_Kubernetes.29.

Within the container the default startup of the uwsgi process(es) have the form

/usr/bin/uwsgi --plugin python,python3 --http-socket :8000 --chdir /data/project/wembedder/www/python/src --logto /data/project/wembedder/uwsgi.log --callable app --manage-script-name --workers 4 --mount /wembedder=/data/project/wembedder/www/python/src/app.py --die-on-term --strict --master --venv /data/project/wembedder/www/python/venv

Get information about a pod:

kubectl describe pod `kubectl get pods | tail -n 1 | awk '{print $1}'`

Get information about a node:

kubectl describe node `kubectl describe pods -l name=wembedder | head -n 3 | tail -n 1 | awk '{print $2}' | awk -F"/" '{print $1}'`

Login to pod:

kubectl exec -it `kubectl describe pods -l name=wembedder | head -n 1 | awk '{print $2}'` -- /bin/bash

Update of Python version

webservice stop
webservice --backend=kubernetes python3.7 shell
cd ~/www/python
python3.7 -m virtualenv -p /usr/bin/python3.7 venv3.7/
source venv3.7/bin/activate
pip install -r wembedder/requirements.txt
rm venv
ln -s venv3.7 venv
logout
webservice --backend=kubernetes -m 2G python3.7 restart
tail -f uwsgi.log
Clone this wiki locally