EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #09810


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Ubuntu - Indexer as a service


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 Service
After=network.target apache2.service

[Service]
Type=forking
ExecStart=/usr/bin/perl -T /opt/eprints3/bin/epindexer start
ExecStop=/usr/bin/perl -T /opt/eprints3/bin/epindexer stop
PIDFile=/opt/eprints3/var/indexer.pid
Restart=always
User=root
Group=root

[Install]
WantedBy=multi-user.target

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?).

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