Setup
The emurestapi shim is a multi-threaded, multi-tenanted HTTP based server implementing the EMu REST API on top of Texpress. Its most common use is to provide EMu based services for EMu implementations. The server is designed to be plug compatible with Axiell Flow. The server may also be used for other projects requiring a REST based API to EMu.
Installation
The emurestapi shim including the server and configuration files can be downloaded from the Axiell Nexus Repository. The download is available in both zip and tgz formats. The following instructions describe the installation process where emurestapi is to be used in a production environment.
- Check either OpenJDK 8 or OpenJDK 11 is installed on the server.
- Add user emu to the password file with a home directory of /home/emu. A password should be set and a login shell of bash used.
- Add group emuadmin to the group file.
- Create the home directory /home/emu and set the directory ownership to user emu and group emuadmin.
- Login (or su) as user emu.
- Download the latest version (3.1.2) of the emurestapi installation archive using wget in either zip or tgz format.
- Unarchive the installation file using unzip or tar based on the file type downloaded. The
emurestapi-3.1.2
directory will be created. - Create a symbolic link from
emurestapi-3.1.2
torestapi
with the commandln -s emurestapi-3.1.2 restapi
. - See the configuration section for the registering of tenants and server options.
The system is now installed and can be run by executing restapi/bin/emurestapi
. The server will run in the foreground if started this way. It is recommended the server starts when the operating system is booted. Consult the relevant section below for the operating system on which emurestapi is installed.
FreeBSD
A FreeBSD startup file can be found in the restapi/rc directory. The file is called emurestapi.freebsd. To install the startup file:
- Login as user root
- Enter
cp ~emu/restapi/rc/emurestapi.freebsd /usr/local/etc/rc/emurestapi
- Enter
chmod 755 /usr/local/etc/rc/emurestapi
- Enter
vi /usr/local/etc/rc/emurestapi
- Change all instances of
EMUPATH
to~emu
(expanded). - Save the file.
- Edit
/etc/rc.conf
and addemurestapi_enable="YES"
- Start the service by executing
service emurestapi start
The shim should now be running and will be started whenever the system is rebooted. The shim can be stopped by entering service emurestapi stop
.
Linux (systemd)
If the version of Linux on which emurestapi is installed uses systemd then the following instructions should be followed:
- Login as user root
- Enter
cp ~emu/restapi/rc/emurestapi.systemd /etc/systemd/system/emurestapi.service
- Enter
vi /etc/systemd/system/emurestapi.service
- Change all instances of
EMUPATH
to~emu
(expanded). - Save the file.
- Enter
systemctl daemon reload
- Enter
systemctl enable emurestapi
- Enter
systemctl start emurestapi
The shim should now be running and will be started whenever the system is rebooted. The shim can be stopped by entering systemctl stop emurestapi
.
Solaris
A Solaris startup script can be found in the restapi/rc directory. The file is called emurestapi.solaris. To install the startup file:
- Login as user root
- Enter
cp ~emu/restapi/rc/emurestapi.solaris /etc/rc3.d/S97emurestapi
- Enter
vi /etc/rc3.d/S97emurestapi
- Change all instances of
EMUPATH
to~emu
(expanded). - Save the file.
- Enter
chmod 755 /etc/rc3.d/S97emurestapi
- Start the serive by executing
/etc/rc3.d/S97emurestapi start
Upgrade
If emurestapi has already been installed then the following instructions should be used to update to the latest version:
- Stop the running version of emurestapi.
- Login (or su) as user emu.
- Download the latest version (3.1.2) of the emurestapi installation archive using wget in either zip or tgz
- Unarchive the installation file using unzip or tar based on the file type downloaded. The
emurestapi-3.1.2
directory will be created. - Enter
rm -f restapi
- Enter
ln -s emurestapi-3.1.2 restapi
- Enter
cp emurestapi-oldversion/conf/tenants.conf restapi/conf/tenants.conf
- Enter
cp emurestapi-oldversion/conf/restapi.conf restapi/conf/restapi.conf
(if changes made to server configuration) - Login (or su) as user root
- Start up emurestapi (using service for FreeBSD, systemctl for Linux or
/etc/rc3.d/S97emurestapi start
for Solaris).
Development
If development work is to be undertaken then a local copy of the emurestapi source is required. The following commands will download the source, build the shim and documentation and run the server.
git clone git@gitto.axiell.com:alm/alm-r-d/emu/emurestapi.git
cd emurestapi
sbt compile makeSite run
The documentation can be found under emurestapi/target/site
.