Installation | Topics | Beyond Lino
Run dist-upgrade
on a Lino server¶
Basic recipe¶
Before running apt dist-upgrade
on Lino server, you must make sure to
have (1) a snapshot of each production site and (2) a
requirements.txt
file for each virtualenv on this server. On a
Lino server there is at least one master virtualenv, usually named master
and located in /usr/local/lino/shared/env/master
.
Make sure that you know which production sites are installed on the server and which virtualenv each of them uses. Here are some hints:
How to find out which virtualenvs are installed on a server:
$ find /usr/local -type l -name python
How to find out which Lino sites are installed on a server:
$ ls /usr/local/lino $ ls /etc/nginx/sites-enabled $ ls /etc/supervisor/conf.d
Make a
requirements.txt
of the master virtualenv:$ sudo su # cd /usr/local/lino/shared/env # . master/bin/activate # pip freeze > requirements.txt
Stop the supervisor service:
$ sudo systemctl stop supervisor
Run
make_snapshot.sh
for every production site:$ go XXXX $ ./make_snapshot.sh
Run
apt dist-upgrade
After running
apt dist-upgrade
, rebuild every virtualenv as described in the sections below that applies to your situation.Restart the supervisor service:
$ sudo systemctl start supervisor
Rebuild virtualenvs on a demo server¶
Deactivate any virtualenv and change directory into the master virtualenv’s parent directory:
$ deactivate $ cd /usr/local/lino/shared/env
Rename the old virtualenv and create a new one of same name:
$ mv master master1 $ python -m venv master
Copy the
pull.sh
from old to new env:$ cp master1/bin/pull.sh master/bin/pull.sh
Move the
repositories
andstatic_root
directories from old to new env:$ mv master1/repositories master/ $ mv master1/static_root master/
Activate the new virtualenv:
$ . master/bin/activate
Stop the supervisor service:
$ sudo systemctl stop supervisor
Run the pull script:
$ pull.sh
Restart the supervisor service:
$ sudo systemctl start supervisor
Rebuild virtualenvs on a production server¶
Reinstall the master virtualenv with getlino:
$ sudo su
# deactivate
# cd /usr/local/lino/shared/env
# mv XXXX XXXX.old
# python3 -m venv XXXX
# . XXXX/bin/activate
# pip install getlino
# Ctrl+D
On each production site, use the requirements.txt
file that was part of
the snapshot:
$ go XXXX
$ deactivate
$ mv env env.old
$ python3 -m venv env
$ a
$ pip install -r snapshot/requirements.txt
$ pm buildcache
Cheat sheet¶
Here are some more little howtos that might be useful in certain situations.
How to find out which Lino sites are installed on a server if you aren’t sure
whether all Lino sites have been installed under the standard location
/usr/local/lino
:
$ grep server_name /etc/nginx/sites-enabled/*
$ grep "\[fcgi-program:" /etc/supervisor/conf.d/*
How to see the master virtualenv of a Lino server:
$ sudo -i which python
How to see the currently active virtualenv:
echo $VIRTUAL_ENV
How to list all Lino sites that use the currently active virtualenv:
$ find -L /usr/local/lino -samefile $VIRTUAL_ENV
(In other words, you list the directories that are symbolic links to the currently active virtualenv.)
How to see the MySQL databases and users:
$ sudo mysql -e "show databases;"
$ sudo mysql -e "select host, user from mysql.user;"
Show information about the currently active virtualenv:
$ cat $VIRTUAL_ENV/pyvenv.cfg
The output should look similar to the following below:
home = /usr/local/lino/shared/env/master/bin
include-system-site-packages = true
version = 3.8.3
Take a note of the major and minor part of the version number (in our case: 3.8)