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)
After reading here and here I’d say that we can ignore this warning. But the error message is still coming.
I saw another warning in sudo journalctl -xe:
Sep 02 01:11:01 ovh2 cron[20502]: (*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[1]: supervisor.service: Found left-over process 11154 (soffice.bin) in control group while starting unit. Ignoring.
Sep 02 01:16:58 ovh2 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Sep 02 01:16:58 ovh2 systemd[1]: supervisor.service: Found left-over process 11160 (python) in control group while starting unit. Ignoring.
Sep 02 01:16:58 ovh2 systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Sep 02 01:16:58 ovh2 systemd[1]: Starting LSB: Start/stop supervisor...
Sep 02 01:16:59 ovh2 supervisor[18340]: 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[18340]: For help, use /usr/bin/supervisord -h
Sep 02 01:16:59 ovh2 systemd[1]: supervisor.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Sep 02 01:16:59 ovh2 systemd[1]: supervisor.service: Failed with result 'exit-code'.
Sep 02 01:16:59 ovh2 systemd[1]: 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
Indeed now reload_services.sh
reports no error. Except for a warning
which says “Forcefully stopping supervisor: supervisord.” which I ignore for
this time.
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
/etc/logrotate.d/supervisor
.
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.
standup meeting¶
Tonis: - #3180 write a test case using atelier sheller for testing Django migrations. - #3181 Hobbit doesn’t accept time values like “230” or “2230”
getlino’s first usage in real world¶
Hamza and I continued to configure the new Debian Buster server for The Eupen variant of Lino Welfare. 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 luc@saffre-rumma.net –admin-name “Luc Saffre”
TODO getlino:
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 /etc/bash.bashrc
.
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!