How to automating dataverse server restart ?
Introduction
[edit]Automating the restart process of a Dataverse server is essential for ensuring uninterrupted access to your data repository and collaborative research platform. By automating the restart procedure, you can minimize downtime caused by server failures, system upgrades, or maintenance activities. This guide provides a comprehensive walkthrough to set up automated restarts for your Dataverse server using systemd services on a Linux environment.
Prerequisites
[edit]1. Dataverse Server Installation: Ensure that you have Dataverse server installed on your system and that it's configured to start and stop using scripts.
2. Root or Sudo Access: You need administrative privileges to create and manage systemd services.
3. Familiarity with Shell Scripting: Basic understanding of shell scripting is required to create start and stop scripts for the Dataverse server.
Steps
[edit]Step.1: Open file /etc/systemd/system/payara.service with editor and put below content in it
[Unit] Description = Payara Server After = syslog.target network.target
[Service] Type = forking ExecStart = /usr/bin/java -jar /usr/local/payara5/glassfish/lib/client/appserver-cli.jar start-domain ExecStop = /usr/bin/java -jar /usr/local/payara5/glassfish/lib/client/appserver-cli.jar stop-domain ExecReload = /usr/bin/java -jar /usr/local/payara5/glassfish/lib/client/appserver-cli.jar restart-domain User=dataverse LimitNOFILE=32768 Environment="LANG=en_US.UTF-8" TimeoutStartSec=120s
[Install] WantedBy = multi-user.target
Step.2: open file vi /etc/init.d/payara and copy the the below script.
#! /bin/sh
# chkconfig: 2345 99 01
# description: Payara App Server
set -e
ASADMIN=/usr/local/payara5/bin/asadmin
case "$1" in
start)
echo -n "Starting Payara"
# Increase file descriptor limit:
ulimit -n 32768
# Allow "memory overcommit":
# (basically, this allows to run exec() calls from inside the
# app, without the Unix fork() call physically hogging 2X
# the amount of memory Payara is already using)
echo 1 > /proc/sys/vm/overcommit_memory
#echo
#echo "PAYARA IS UNDER MAINTENANCE;"
#echo "PLEASE DO NOT USE service init script."
#echo
LANG=en_US.UTF-8; export LANG
$ASADMIN start-domain domain1
echo "."
;;
stop)
echo -n "Stopping Payara"
#echo
#echo "PAYARA IS UNDER MAINTENANCE;"
#echo "PLEASE DO NOT USE service init script."
#echo
$ASADMIN stop-domain domain1
echo "."
;;
*)
echo "Usage: /etc/init.d/payara {start|stop}"
exit 1
esac
exit 0
Step.3: Run command to enable service to start on server reboot
sudo chkconfig payara on
Now it will be enabled and Dataverse server will RESTART automatically when the server is rebooted after an upgrade or update.
Conclusion
[edit]Automating the restart process of your Dataverse server streamlines server management and enhances system reliability. By following the steps outlined in this guide, you can establish a robust automated restart mechanism using systemd services, ensuring minimal downtime and uninterrupted access to your research data and collaboration platform. With automated restarts in place, you can confidently manage your Dataverse server, knowing that it will seamlessly recover from system reboots and failures, thereby facilitating continuous data sharing and collaboration among researchers.