The EuroAP platform can run as a service on all supported operating systems. The following demonstration shows how to run EuroAP as a systemd service under the EuroLinux 8 operating system. Since EuroAP is functionally compatible with the Red Hat® JBoss® EAP, this tutorial is also applicable in a JBoss® context.
To begin, download the EuroAP archive from the EuroLinux Customer Portal and extract it to the current directory
unzip EuroAP*
Move the extracted directory to the /opt
directory:
sudo mv EuroAP-*/ /opt/EuroAP
Install the required version of OpenJDK:
sudo dnf install -y java-11-openjdk
Add the euroap
system user and create a password for them:
sudo useradd euroap && sudo passwd euroap
We grant this user the owner privileges of the /opt/EuroAP
directory with the command:
chown -R euroap:euroap /opt/EuroAP
We create a EuroAP application user from the system user euroap
’s level:
su euroap -c /opt/EuroAP/bin/add-user.sh
Navigate to the init.d
subdirectory of the project:
cd /opt/EuroAP/bin/init.d
and run the command that copies the configuration file and launcher script:
sudo cp *.sh euroap.sh && sudo cp *.conf euroap.conf
In the euroap.conf
configuration file uncomment and edit the JBOSS_HOME
variable directing it to the /opt/EuroAP
directory, as well as the JBOSS_USER
variable assigning it the euroap
user. In addition, uncomment the variables JBOSS_MODE=standalone
and JBOSS_CONFIG=standalone.xml
and save the file.
Perform an automatic editing of the JBOSS_NAME
variable in the launcher script:
sudo sed -i "s/JBOSS_NAME='.*'/JBOSS_NAME='euroap'/g" euroap.sh
Copy the modified service configuration file to the /etc/default
directory:
sudo cp /opt/EuroAP/bin/init.d/euroap.conf /etc/default
Then copy the launcher script to the /etc/init.d/
directory:
sudo cp /opt/EuroAP/bin/init.d/euroap.sh /etc/init.d
We give the script running the service the initrc_t
SELinux context:
sudo /sbin/restorecon -v /etc/rc.d/init.d/euroap.sh
After running the command, a message should be displayed:
Relabeled /etc/rc.d/init.d/euroap.sh from unconfined_u:object_r:etc_t:s0 to unconfined_u:object_r:initrc_exec_t:s0
Next, we create the euroap.service
file in the /etc/systemd/system
directory:
sudo vim /etc/systemd/system/euroap.service
and add the following content to it:
[Unit]
Description=EuroAP Systemctl script
After=NetworkManager.service
[Service]
Type=forking
ExecStart=/etc/init.d/euroap.sh start
ExecStop=/opt/EuroAP/bin/init.d/euroap.sh stop
ExecReload=/opt/EuroAP/bin/init.d/euroap.sh restart
[Install]
WantedBy=multi-user.target
Save and close this file and reload systemd daemon:
sudo systemctl daemon-reload
Now we can start our new service using the standard command:
sudo systemctl start euroap
After a few seconds or so, check that EuroAP hosts its administration panel. To do so, visit http://localhost:9990.
We can display the status of the service with the standard systemd command:
sudo systemctl status euroap
Below is an example of the result of this command:
● euroap.service - EuroAP Systemctl script
Loaded: loaded (/etc/systemd/system/euroap.service; static; vendor preset: disabled)
Active: active (running) since Fri 2023-02-24 05:48:22 EST; 36min ago
Process: 34267 ExecStart=/etc/init.d/euroap.sh start (code=exited, status=0/SUCCESS)
Main PID: 34286 (standalone.sh)
Tasks: 56 (limit: 23512)
Memory: 329.3M
CGroup: /system.slice/euroap.service
├─34286 /bin/sh /opt/EuroAP/bin/standalone.sh -c standalone.xml
└─34405 java -D[Standalone] -server -Xlog:gc*:file=/opt/EuroAP/standalone/log/gc.log:time,uptimemillis:filecount=5,filesize=3M -Xms1303m -X>
Feb 24 05:48:18 el8 systemd[1]: Starting EuroAP Systemctl script...
Feb 24 05:48:18 el8 runuser[34284]: pam_unix(runuser:session): session opened for user euroap by (uid=0)
Feb 24 05:48:18 el8 runuser[34284]: pam_unix(runuser:session): session closed for user euroap
Feb 24 05:48:18 el8 euroap.sh[34267]: Starting euroap: /
Feb 24 05:48:22 el8 euroap.sh[34267]: [ OK ]
Feb 24 05:48:22 el8 systemd[1]: Started EuroAP Systemctl script.
We can stop the service with the standard systemd command:
sudo systemctl stop euroap
We can also set the service to start with the start of the operating system with the standard systemd command:
sudo systemctl enable euroap --now
Summary
By configuring EuroAP as a systemd service, it is possible to easily manage EuroAP's resources, such as RAM, CPU and disk memory. The systemd service also ensures uninterrupted operation of EuroAP after a server restart. Systemd provides tools to easily manage application logs and allows you to control the application process, including monitoring its status, stopping, resuming and restarting. As you can see, the solution has many advantages for easy, efficient and secure management of the EuroAP application in a server environment.