[Archivesspace_Users_Group] Running archivesspace from systemd

Helms, Christopher J chris.helms at library.gatech.edu
Wed Jan 31 12:29:12 EST 2018


At Georgia Tech I have had success with the following recipe under RHEL 7. It runs with the default ArchiesSpace ports, proxied via Apache to the outside world.

Create the file /etc/systemd/system/archivesspace.service


# Systemd unit file for ArchivesSpace

#



[Unit]

Description=ArchivesSpace Application

After=syslog.target network.target



[Service]

Type=forking

ExecStart=/var/www/archivesspace/v2.2.2/archivesspace.sh start

ExecStop=/var/www/archivesspace/v2.2.2/archivesspace.sh stop

PIDFile=/var/www/archivesspace/v2.2.2/data/.archivesspace.pid

User=aspace

Group=aspace





[Install]

WantedBy=multi-user.target



Then reload systemd.
$ sudo systemctl daemon-reload

After an upgrade I can stop the application, update version numbers, reload the daemon, then start the newly deployed version.


# systemctl status archivesspace

● archivesspace.service - ArchivesSpace Application

   Loaded: loaded (/etc/systemd/system/archivesspace.service; enabled; vendor preset: disabled)

   Active: active (running) since Wed 2018-01-31 09:54:26 EST; 2h 28min ago

 Main PID: 115350 (java)

   CGroup: /system.slice/archivesspace.service

           └─115350 java -Darchivesspace-daemon=yes -Djava.security.egd=file:/dev/./urandom -Xmx1024m -Xss2m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8 -cp l...



Jan 31 09:54:26 archivesspace-stage.library.gatech.edu systemd[1]: Starting ArchivesSpace Application...

Jan 31 09:54:26 archivesspace-stage.library.gatech.edu archivesspace.sh[115326]: ArchivesSpace base directory: /var/www/archivesspace/v2.2.2

Jan 31 09:54:26 archivesspace-stage.library.gatech.edu systemd[1]: Started ArchivesSpace Application.


--
Christopher J. Helms
Application Developer Mgr | Library IT&D
Georgia Institute of Technology
Phone: (404) 385-6277



From: <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Flannon Jackson <flannon at nyu.edu>
Reply-To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Date: Friday, January 26, 2018 at 5:16 PM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Re: [Archivesspace_Users_Group] Running archivesspace from systemd

Hi Blake,
I was able to get my issues sorted out and I've now got archivesspace 2.2.2 running on Centos 7.  I've got it set up in a vagrant box if you want to have a look.  If you've got virtualbox and vagrant set up on your local machine then you can get it running like this,
  $ git clone git at github.com:NYULibraries/vagrant-archivesspace.git
  $ cd vagrant-archivesspace
  $ vagrant up
  $ vagrant ssh
  $ sudo systemctl start archivesspace.service
It'll install archivesspace in /opt/archviesspace, and the unit file will be at /ets/systemd/system/archivesspace.service.  All the config details, usernames, passwords and such, can be found in

  /etc/puppetlabs/code/environments/development/data/archivesspace.yaml

Once archivesspace is up and running you'll be able to connect via your browser at localhost:8080.  If you've already got something running on your local machine on any of the archivesspace ports you'll need to change the port mappings in the Vagrantfile before you run `vagrant up`.
-f



On Fri, Jan 26, 2018 at 1:49 PM, Blake Carver <blake.carver at lyrasis.org<mailto:blake.carver at lyrasis.org>> wrote:
Has anyone had any luck with systemd yet?



________________________________________
From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> <archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> on behalf of Flannon Jackson <flannon at nyu.edu<mailto:flannon at nyu.edu>>
Sent: Monday, August 7, 2017 2:01:15 PM
To: Archivesspace Users Group
Subject: [Archivesspace_Users_Group] Running archivesspace from systemd

Hi All,

I'm trying to run the archivesspace daemon from a systemd unit file but I'm getting an odd delay.  If I start archivesspace manually by running "$ sudo archivesspace.sh start" things run normally, but when I start archivesspace from systemctl then any operation on port 8080 delays from 10 to 20 seconds before it returns results.

If anyone is running archivesspace from systemctl and can offer any advice it would be appreciated.

The details of my deployment are as follow,

OS  :                 Centos 7.3.10
Java:                 OpenJDK 1.8.0_141
archivesspace:  2.0.0 | 2.0.1 | 2.1.0  (i've tried all three with the same results)

My unit file is as follows,

  [Unit]
  Description=Archivesspace Service
  After=syslog.target network.target

  [Service]
  Type=forking
  ExecStart=/opt/archivesspace/archivesspace.sh start
  PIDFile=/opt/archivesspace/data/.archivesspace.pid
  User=aspace
  Group=aspace
  TimeoutStopSec=10
  Restart=on-failure

  [Install]
  WantedBy=multi-user.target

Initially I tried running it as user aspace.  When that didn't work I also tried as root, but that didn't change anything.

Currently I'm running archivesspace 1.5.2 on Centos 6 and the archivesspace daemon gets started from a wrapper script in init.d, so I thought that if I replicated that structure and had a wrapper script to run from the unit fil,e and set the type to either simple, or oneshot or idle, that that might do it.  So I tried it like this,

  [Unit]
  Description=Archivesspace Service
  After=syslog.target network.target

  [Service]
  Type=simple
  ExecStart=/opt/archivesspace/aspace-start.sh
  PIDFile=/opt/archivesspace/data/.archivesspace.pid
  User=root
  Group=root

  [Install]
  WantedBy=multi-user.target

But basically nothing changed -- archivesspace started fine but I still had the crazy delay.   I'm thinking at this point that rather than having a unit file that calls archivesspace.sh that I need to write a unit file that replaces the functionality of archivesspace.sh and calls archivesspace directly.  As you've probably noticed, archivesspace.sh is not exactly a trivial shell script, so before I get started I wanted to see if anyone else has had any luck getting archivesspace running on systemd.

Thanks,

Flannon
_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group at lyralists.lyrasis.org<mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20180131/de5f05fa/attachment-0001.html>


More information about the Archivesspace_Users_Group mailing list