Difference between revisions of "Metro server installation"
(→Installation) |
(→More modern approach) |
||
Line 100: | Line 100: | ||
[Install] | [Install] | ||
WantedBy=multi-metro.target | WantedBy=multi-metro.target | ||
+ | </pre> | ||
+ | |||
To start the demon you run | To start the demon you run | ||
− | + | systemctl start metro.service | |
− | systemctl start metro.service | + | |
To start at boot you enable it | To start at boot you enable it | ||
− | + | systemctl enable metro.service | |
− | systemctl enable metro.service | + | |
− | + | ||
− | + |
Revision as of 10:02, 11 April 2019
The Metro service and be installed on hardware, a VM, or even a Docker instance, though to date, no one has done that. The server is dependent on Java in all cases. Specific dependencies are discussed in the Windows or Unix section. Because MeCard.jar
is a Java application and so will work on both 32 and 64 bit OSes without change, but the supporting daemon/service support application needs to match the OS.
Contents
General notes
The Metro server is a Java application, or appliance that manages the communication between [https://melibraries.ca] and your library's ILS. There are a number of supporting libraries that are shipped with the MeCard.jar
file that manage command line arguments, JDBC connections, the Daemon service etc. Some are not required for all sites but all are shipped for simplicity.
- commons-cli-1.2.jar - included for reading and interpreted to
- gson-2.2.4.jar - included for possible web services use.
- commons-codec-1.8.jar - included for possible web services use.
- fluent-hc-4.3.4.jar - included for possible web services use.
- httpcore-4.3.2.jar - included for possible web services use.
- sqljdbc42.jar - included for Horizon and Polaris sites.
- commons-daemon-1.1.0.jar - used for running the MeCard.jar as a daemon on Unix or a service on Windows.
Windows
There are several batch files used to install the Metro service. They are simple and use Apache's prunsrv.exe
, 32 or 64 bit depending on whether you are using a 32 or 64 bit version of Windows. For more information see here for examples.
Installation
There is an installation exe that does install the Metro server (MeCard.jar) on Windows. It was created by Inno Setup compiler.
Unix variants
On Unix, the daemon is jsvc, which should be installed on the host metro server machine.
Installation
Read the jsvc page to install on Unix. Once done the daemon can be started and stopped by creating a /etc/init.d/metro
file with permissions -rwxr-xr-x 1 root root
. See here
Init.d script
/etc/init.d$ cat metro #!/bin/sh ### BEGIN INIT INFO # Provides: metro # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts and stops the ME server after reboot. ### END INIT INFO # Author: Andrew Nisbet <anisbet@epl.ca> # # Setup variables DESC="Starts and stops the ME service for Edmonton Public Library (EPL)" DAEMON=/usr/bin/jsvc # This is meant to fix a Debian bug found in kernal release # 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 # that causes jsvc to fail on startup. export JSVC_EXTRA_OPTS="$JSVC_EXTRA_OPTS -Xss1280k" JAVA_HOME=/usr/lib/jvm/default-java # lrwxrwxrwx 1 root root 24 Feb 25 2016 /usr/lib/jvm/default-java -> java-1.8.0-openjdk-amd64/ #JAVA_HOME=/usr/lib/jvm/java-7-openjdk #/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java CLASS_PATH="/home/its/metro/dist/lib/commons-daemon-1.0.15.jar":"/home/its/metro/dist/MeCard.jar" WDPATH=/home/its/metro/logs PID=$WDPATH/metro.pid CLASS=mecard.MetroService USER=its LOG_OUT=$WDPATH/metro.out LOG_ERR=$WDPATH/metro.err # -c tells the service where the config files are located. Valid values are "" or "-c <path>". #ARGS="-c ../" ARGS="-c /home/its/metro/config" do_exec() { $DAEMON -home "$JAVA_HOME" -cp $CLASS_PATH -user $USER -outfile $LOG_OUT -errfile $LOG_ERR -pidfile $PID $1 $CLASS $ARGS } case "$1" in start) do_exec ;; stop) do_exec "-stop" ;; restart) if [ -f "$PID" ]; then do_exec "-stop" do_exec else echo "service not running, will do nothing" exit 1 fi ;; *) echo "usage: $0 {start|stop|restart}" >&2 exit 3 ;; esac
More modern approach
You create a unit /etc/systemd/system/metro.service
(from https://unix.stackexchange.com/questions/426862/proper-way-to-run-shell-script-as-a-daemon).
[Unit] Description=MeCard registration Daemon. [Service] ExecStart=/usr/bin/metro Restart=on-failure [Install] WantedBy=multi-metro.target
To start the demon you run
systemctl start metro.service
To start at boot you enable it
systemctl enable metro.service