Skip to content
Snippets Groups Projects
Commit c8aa5675 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Storing before reverting VirtualPC

parent 55a9d801
Branches
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
# Author Tor-Einar Skog <tor-einar.skog@nibio.no>
CODE_USER=wildfly
INITIAL_DIRECTORY=$(pwd)
# Locale update
# We want the server to user UTF-8 as standard
......@@ -73,9 +74,11 @@ cd ../VIPSLogic
sudo -H -u $CODE_USER bash -c "mvn install -DskipTests"
# Download and unzip Wildfly 16
cd ..
WILDFLY_VERSION=16.0.0.Final
sudo -H -u $CODE_USER bash -c "https://download.jboss.org/wildfly/$WILDFLY_VERSION/$WILDFLY_VERSION.tar.gz"
sudo -H -u $CODE_USER bash -c "tar xzf $WILDFLY_VERSION.tar.gz"
sudo -H -u $CODE_USER bash -c "wget https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz"
sudo -H -u $CODE_USER bash -c "tar xzf wildfly-$WILDFLY_VERSION.tar.gz"
sudo -H -u $CODE_USER bash -c "rm wildfly-$WILDFLY_VERSION.tar.gz"
# Edit standalone.xml, the Wildfly config file
printf "\nWILDFLY CONFIGURATION\n"
......@@ -88,25 +91,33 @@ do
read -p "MD5 salt (to make the one-way encryption much harder to break. Type 10-20 random characters) [*]: " md5salt
done
WILDFLY_HOME=/home/$CODE_USER/$WILDFLY_VERSION
WILDFLY_HOME=/home/$CODE_USER/wildfly-$WILDFLY_VERSION
WILDFLY_CONFIG_PATH=$WILDFLY_HOME/standalone/configuration
cd wildfly_config
cd $INITIAL_DIRECTORY/wildfly_config
sudo -H -u $CODE_USER bash -c "python3 init_standalone_xml.py --smtpserver $smtpserver --md5salt $md5salt --dbpassword $vipslogic_password --path $WILDFLY_CONFIG_PATH"
# Add the required modules for VIPSLogic to Wildfly
# PostgreSQL
# etc
# All modules needed to run VIPSLogic AND VIPSCore are added
cp -r modules/* $WILDFLY_HOME/modules
sudo -H -u $CODE_USER bash -c "cp -r modules/* $WILDFLY_HOME/modules"
# Set up WildFly as a systemd service
mkdir /etc/wildfly
cp systemd_templates/wildfly.conf /etc/wildfly
cp systemd_templates/wildfly.service /etc/systemd/system
sed -i -e "s,WILDFLY_PATH_REPLACE_WITH_SED,$WILDFLY_HOME," /etc/systemd/system/wildfly.service
cp systemd_templates/launch.sh $WILDFLY_HOME/bin
sed -i -e "s,WILDFLY_PATH_REPLACE_WITH_SED,$WILDFLY_HOME," $WILDFLY_HOME/bin/launch.sh
# Add VIPSLogic to the Wildfly deployments folder
sudo -H -u $CODE_USER bash -c "ln -s /home/$CODE_USER/VIPSLogic/target/VIPSLogic-1.0-SNAPSHOT.war $WILDFLY_HOME/standalone/deployments/"
# Install and configure Apache
# Run (test?) WildFly with VIPSLogic deployed
$WILDFLY_HOME/bin/standalone.sh
# If successful, this will migrate the vipslogic database to its correct state
# Next up is adding organization information
......@@ -128,7 +139,7 @@ read -p "Web map default center longitude (WGS84):" longitude
read -p "Web map default center latitude (WGS84):" latitude
read -p "Default timezone (See https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html): " timezone
printf "\nINITIAL ADMIN USER INFO"
printf "\nINITIAL ADMIN USER INFO\n"
while [ "$user_email" == "" ]
do
read -p "Email [*]: " user_email
......@@ -139,3 +150,5 @@ do
read -p "Last name [*]: " last_name
done
# Install and configure Apache
......@@ -17,10 +17,10 @@ args = parser.parse_args()
path = args.path
# Make a copy of the original file
copyfile(path + "standalone.xml", path + "standalone_original.xml")
copyfile(path + "/standalone.xml", path + "/standalone_original.xml")
# The destination document
standalone_dom = parse(path + "standalone.xml")
standalone_dom = parse(path + "/standalone.xml")
# The system properties to add to destination (standalone.xml)
vsp_dom = parse("vipslogic_system_properties.xml")
......@@ -56,6 +56,6 @@ for driver in drivers_elm.getElementsByTagName("driver"):
# Write to file
outputfile = open(path + "standalone.xml", "w")
outputfile = open(path + "/standalone.xml", "w")
outputfile.write(standalone_dom.toxml())
outputfile.close()
#!/usr/bin/python3
# Sets up Wildfly as a systemd service in Ubuntu
# (c) 2019 NIBIO
# Author: Tor-Einar Skog <tor-einar.skog@nibio.no>
from shutil import copyfile
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("--path")
args = parser.parse_args()
path = args.path
# Copy wildfly conf
os.makedirs("/etc/wildfly")
copyfile(wildfly.conf, path + "/
#!/bin/bash
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="WILDFLY_PATH_REPLACE_WITH_SED"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3
fi
# The configuration you want to run
WILDFLY_CONFIG=standalone.xml
# The mode you want to run
WILDFLY_MODE=standalone
# The address to bind to
WILDFLY_BIND=0.0.0.0
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
Before=httpd.service
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=WILDFLY_PATH_REPLACE_WITH_SED/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment