Monday, September 2, 2019¶
RuntimeError: populate() isn’t reentrant¶
Hobbit was not responding, the apache error log said:
mod_wsgi (pid=18156): Exception occurred processing WSGI script '/usr/local/python/lino_sites/hobbit/apache/wsgi.py'. Traceback (most recent call last): File "/usr/local/python/lino_sites/hobbit/apache/wsgi.py", line 13, in <module> from lino_local import setup_wsgi ; setup_wsgi(globals()) File "/usr/local/python/lino_local.py", line 21, in setup_wsgi globals_dict.update(application = get_wsgi_application()) File "/mnt/disk/jane/env3/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/mnt/disk/jane/env3/lib/python3.7/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/mnt/disk/jane/env3/lib/python3.7/site-packages/django/apps/registry.py", line 83, in populate raise RuntimeError("populate() isn't reentrant") RuntimeError: populate() isn't reentrant
The problem vanished after running
reload_services.sh. This sporadic
populate() isn't reentrant error is a bit mysterious. Might be
related to Apache’s mod_wsgi, so maybe it will vanish when we move to nginx.
Supervisor failing on SR¶
While Apache now restarted without problem, supervisor reports an error. The supervisor log file says:
CRIT Supervisor running as root (no user in config file)
I saw another warning in sudo journalctl -xe:
Sep 02 01:11:01 ovh2 cron: (*system*certbot) WRONG FILE OWNER (/etc/cron.d/certbot)
And indeed the file was owned by tonis. So I said:
$ sudo chown root:root /etc/cron.d/certbot
But the error message is still coming. I saw that sudo systemctl status supervisor.service said:
Sep 02 01:16:58 ovh2 systemd: supervisor.service: Found left-over process 11154 (soffice.bin) in control group while starting unit. Ignoring. Sep 02 01:16:58 ovh2 systemd: This usually indicates unclean termination of a previous run, or service implementation deficiencies. Sep 02 01:16:58 ovh2 systemd: supervisor.service: Found left-over process 11160 (python) in control group while starting unit. Ignoring. Sep 02 01:16:58 ovh2 systemd: This usually indicates unclean termination of a previous run, or service implementation deficiencies. Sep 02 01:16:58 ovh2 systemd: Starting LSB: Start/stop supervisor... Sep 02 01:16:59 ovh2 supervisor: Starting supervisor: Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut Sep 02 01:16:59 ovh2 supervisor: For help, use /usr/bin/supervisord -h Sep 02 01:16:59 ovh2 systemd: supervisor.service: Control process exited, code=exited, status=2/INVALIDARGUMENT Sep 02 01:16:59 ovh2 systemd: supervisor.service: Failed with result 'exit-code'. Sep 02 01:16:59 ovh2 systemd: Failed to start LSB: Start/stop supervisor.
I guess that a reboot might be a simple workaround for this time, so I did:
$ sudo reboot
reload_services.sh reports no error. Except for a warning
which says “Forcefully stopping supervisor: supervisord.” which I ignore for
I also saw that the
/var/log/supervisor/supervisord.log file was very
big because we don’t rotate it. So I created a file
getlino doesn’t configure logrotate¶
I opened and fixed #3179: the Installer now has a new method
getlino.utils.Installer.write_logrotate_conf() because the logrotate
config for supervisor is the same as the one for the individual lino.log files.
Currently the logrotate config options are mostly hard-coded because we use the
same values on all our production servers.
It seems that monit creates its own logrotate config file, so we don’t touch that one.
getlino’s first usage in real world¶
Hamza and I continued to configure the new Debian Buster server for Lino Welfare Eupen. It is a kind of historic moment. We imagine that we a re third-party hosting provider trying to setup a production server without knowing very much about Lino
We updated the getlino documentation and did another release with minor changes. Some default values were not yet optimally.
Note that a normal system admin would have problems to answer the first questions asked by getlino:
contrib (Whether to configure a contributor environment) [True]: n
sites_base (Base directory for Lino sites on this server) [/usr/local/lino]:
Maybe contrib should be False by default.
$ sudo -H getlino configure –server-domain lino –admin-email email@example.com –admin-name “Luc Saffre”
3140 (Write tests for getlino)
getlino should also run on other distros than debian 10
getlino does not set a mysql root password
We manually added the go alias to their
Use a Consumer Price Index for computing inflation¶
I evaluated thre Python packages: cpi, easymoney and economics. - cpi works only for the US. - easymoney is quite complex and “only for information purposes” - but economics is a very simple interface to the worldbank API.
>>> from economics import Inflation >>> import datetime
>>> i = Inflation(country='BEL', reference=datetime.date(2002,8,1)) >>> i = Inflation(country='BEL', reference=2002) >>> i.inflate(100, target=datetime.date(2018,7,1)) 134.9855356585091
>>> i = Inflation(country='BEL', reference=2002) >>> i.inflate(100, target=2018) 134.9855356585091
Okay one limitation is that they seem to have only yearly data about Belgium. But that works for me. Thanks!