Closed cdisabatino closed 4 years ago
It's good, I found. With the "start" parameter.
Here is the command "java -jar /opt/salava-production/salava-3.6.2-standalone.jar --config /opt/salava/resources/config/ start".
I still have to create a service that starts with the server. Thank you
Hi, Here's what I did for the dedicated team to test the application. I will probably do otherwise for the final production. It can serve for someone else.
The installed server is CentOS7.
I did a backup of the application and the databases (DB test and production) before starting.
I created the JAR with the commands below :
cd /opt/salava
lein uberjar
I then tested the JAR :
java -jar /opt/salava/target/salava-3.5.6-standalone.jar --config /opt/salava-production/config/ start
Creation of directories. I make a copy of the JAR and the configuration directory to avoid problems if I update the application from the Github repository. I also create the log directory :
mkdir /opt/salava-production /var/log/salava
cp /opt/salava/target/salava-3.6.2-standalone.jar /opt/salava-production
cp -r /opt/salava/resources/config/ /opt/salava-production/
Script used to start the application and created a log file. I do not use this script manually, it is used by the dedicated service created (see below) :
vi /opt/salava-production/startSalava.sh
#!/bin/bash
#
JAR=/opt/salava-production/salava-3.6.2-standalone.jar
CONFIG_DIRECTORY=/opt/salava-production/config/
LOG_FILE=/var/log/salava/salava.log
#
echo "Starting salava server ...
JAR: $JAR
CONFIG_DIRECTORY: $CONFIG_DIRECTORY
LOG_FILE: $LOG_FILE
"
# Start application
`/usr/bin/java -jar $JAR --config $CONFIG_DIRECTORY start > $LOG_FILE 2>&1`
echo "Read log file: $LOG_FILE
End script"
exit
chmod +x /opt/salava-production/startSalava.sh
Creation of the service :
vi /usr/lib/systemd/system/salava.service
[Unit]
Description=Salava service
[Service]
Type=simple
ExecStart=/bin/bash /opt/salava-production/startSalava.sh
[Install]
WantedBy=multi-user.target
The commands available to manage the service :
systemctl status salava
systemctl start salava
systemctl stop salava
systemctl enable salava
systemctl disable salava
If the procedure is validated by develloppers, it can be added in the Salava documentation...
Have a good day, Christophe
Hello. Everything is working properly. I wish to deploy in production. According to the documentation, I can export a "jar" with the command "lein uberjar". The export proceeds without errors. When I want to execute the exported "jar", I have the message "fatal: --config must be specified". If I add the "--config" parameter, I have the message "no action".
I use the command "java -jar /opt/salava/target/salava-3.6.2-standalone.jar --config /opt/salava/resources/config/".
How can I create a script that automatically runs the application when the server starts ?
Thank you, Christophe