OpenTreeOfLife / germinator

miscellaneous scripts and data for concerns that span more than one of the Open Tree code repositories: integration tests, system statistics, etc.
BSD 2-Clause "Simplified" License
21 stars 7 forks source link

Use systemd to manage daemons (for restarts, etc.) #139

Closed jimallman closed 4 years ago

jimallman commented 6 years ago

This branch started with persistent "sweepers" to remove expired session files that pile up in our various web2py apps. Now it also puts our neo4j instances under systemd management , and it can easily handle others (redis, celery) as needed.

We extend our existing deployment tools with a final daemon-installation script that runs as user admin. This walks the list of components/commands sent to push.sh, and installs (or updates) any daemons needed to support each one.

Note that we're using classic SysV init.d scripts in some cases, but these have been tweaked to take advantage of modern systemd and its logging features.

jimallman commented 6 years ago

This has been used to deploy to devapi and devtree, and everything seems to be working.

N.B. that the first time this is used to update an existing server, neo4j services may fail to start as they bump into the old neo4j instance running on the same port. In this case, you need to kill the active neo4j process(es), then try deploying again. This will not affect newly established servers.

jimallman commented 6 years ago

Note that we're still not ready for full functionality after a system restart. It looks like we'd need to add daemon management for redis, celery, and possibly other services. Thoughts?

jar398 commented 6 years ago

Thoughts: this is not hard - I've written init.d scripts before and they can be very simple. (And there are lots of examples to copy from.) And virtuoso almost certainly provides one. Just a matter of doing the work.

mtholder commented 4 years ago

This has some conflicts, and some is not relevant anymore. I'm going to close it but keep the branch for documentation and ideas when we reinstate the session sweeper

jimallman commented 4 years ago

FWIW, the modified+tested session sweepers will return in one of these pending PRs: https://github.com/OpenTreeOfLife/germinator/pull/155/files#diff-e18d0b490e82c2b4dc0baab43d336c5dR73