EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #09811
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Ubuntu - Indexer as a service
- To: <eprints-tech@ecs.soton.ac.uk>, James Kerwin <jkerwin2101@gmail.com>
- Subject: Re: [EP-tech] Ubuntu - Indexer as a service
- From: David R Newman <drn@ecs.soton.ac.uk>
- Date: Wed, 7 Aug 2024 16:19:46 +0100
Hi James,
This is what I current user on Rocky Linux 8 and 9:
[Unit]
Description=EPrints Indexer
After=crond.service mariadb.service
Requires=mariadb.service
[Service]
Type=forking
PIDFile=/opt/eprints3/var/indexer.pid
TimeoutStartSec=0
User=eprints
ExecStart=/opt/eprints3/site_lib/bin/epindexer_systemd_start
ExecStop=/opt/eprints3/bin/indexer stop
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target
cd `dirname $0`
cd ../../
if [ -e var/indexer.pid ]; then
pid=`ps aux | awk 'BEGIN{FS="[\t ]+"}{ print $11 }' | grep "indexer" | head -n 1`
if [ "$pid" != "" ]; then
bin/indexer stop
sleep 5
fi
rm -f var/indexer.pid var/indexer.tick
fi
bin/indexer start
CAUTION: This e-mail originated outside the University of Southampton.CAUTION: This e-mail originated outside the University of Southampton.Hi everyone,
Wondering if anyone can check if this is a sane thing to do.
This has been bugging me for some time since we upgraded from Ubuntu 14 to 20/22 (I've lost track at the moment).
Whenever the server was restarted the eprints Indexer would stall. Then after an hour or so say "Indexer has stopped..."
I've been learning about systemd and turning /opt/eprints3/epindexer into a service.
I wanted it to be bound to Apache, which hasn't quite worked. I got it to a point where issuing: systemctl [stop/start] epindexer on the command line would give the desired action. When Apache stopped the indexer would stop (e.g. the indexer.pid file in /opt/eprints3/var would disappear). Unfortunately it didn't restart when Apache was started (although it did at least tell me it wasn't running, which is a help in itself).I did think of binding it to MySQL since that seems to restart without a problem after Apache goes down-up.
I've now got it to a point where Apache can be restarted, the indexer.pid file remains in place, but the indexer resumes its actions when Apache is back up. This is the service file I've made in /etc/systemd/system/epindexer.service:
[Unit]Description=EP Indexer ServiceAfter=network.target apache2.service
[Service]Type=forkingExecStart=/usr/bin/perl -T /opt/eprints3/bin/epindexer startExecStop=/usr/bin/perl -T /opt/eprints3/bin/epindexer stopPIDFile=/opt/eprints3/var/indexer.pidRestart=alwaysUser=rootGroup=root
It did previously have either "BindsTo=apache2.service" or "PartOf=apache2.service" on line 4, but this appeared to hinder more than help. I have just realised that depending on how I start the indexer the indexer.pid and indexer.tick have different owners (eprints from command line and www-data when I click the button. Both files have rw-rw-r-- permissions and eprints is in the www-data group and www-data is in the eprints group - I don't know if I'm on to something with this - maybe change the user in epindexer to www-data?).[Install]WantedBy=multi-user.target
Does this look sufficient? It's only on a Test server at the moment, but would look to put this on the live server if it doesn't raise any red flags. If any fellow Ubuntu users have had success with this I am all ears.
Appreciate this is not exactly EPrints, but it's such a niche question I thought it right to ask here.
Thanks,James
*** Options: https://wiki.eprints.org/w/Eprints-tech_Mailing_List *** Archive: https://www.eprints.org/tech.php/ *** EPrints community wiki: https://wiki.eprints.org/
- Follow-Ups:
- Re: [EP-tech] Ubuntu - Indexer as a service
- From: James Kerwin <jkerwin2101@gmail.com>
- Re: [EP-tech] Ubuntu - Indexer as a service
- References:
- [EP-tech] Ubuntu - Indexer as a service
- From: James Kerwin <jkerwin2101@gmail.com>
- [EP-tech] Ubuntu - Indexer as a service
- Prev by Date: [EP-tech] Ubuntu - Indexer as a service
- Next by Date: Re: [EP-tech] Ubuntu - Indexer as a service
- Previous by thread: [EP-tech] Ubuntu - Indexer as a service
- Next by thread: Re: [EP-tech] Ubuntu - Indexer as a service
- Index(es):