Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPS Backend single server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS setup
VIPS Backend single server
Commits
7bd9a037
Commit
7bd9a037
authored
5 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Alpha v 2
parent
5becd906
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vips-backend-single-server.sh
+84
-53
84 additions, 53 deletions
vips-backend-single-server.sh
wildfly_config/modules/no/nibio/vips/modelcontainer/main/module.xml
+2
-1
2 additions, 1 deletion
...nfig/modules/no/nibio/vips/modelcontainer/main/module.xml
with
86 additions
and
54 deletions
vips-backend-single-server.sh
+
84
−
53
View file @
7bd9a037
...
@@ -3,35 +3,13 @@
...
@@ -3,35 +3,13 @@
# (c) 2019 NIBIO
# (c) 2019 NIBIO
# Author Tor-Einar Skog <tor-einar.skog@nibio.no>
# Author Tor-Einar Skog <tor-einar.skog@nibio.no>
# The Linux user where we deploy the application server (WildFly) and the VIPS software components
CODE_USER
=
wildfly
CODE_USER
=
wildfly
INITIAL_DIRECTORY
=
$(
pwd
)
INITIAL_DIRECTORY
=
$(
pwd
)
# Locale update
# Locale update
# We want the server to user UTF-8 as standard
# We want the server to user UTF-8 as standard
locale-gen en_US.UTF-8
locale-gen en_US.UTF-8
# dpkg-reconfigure locales # probably double work, remove if not needed
# Database install and setup
# If you have a separate data disk for the database,
# then you need to perform some manual steps after installing
# postgresql. They are not described here.
apt-get
--assume-yes
install
postgresql postgis
# Initialize the VIPSLogic database
printf
"
\n\n
Initializing the VIPSLogic database
\n
"
printf
"We need some input from you before doing that
\n
"
printf
"Required fields are marked with [*]"
printf
"
\n
DATABASE USER INFORMATION
\n
"
printf
"We will create a postgresql user 'vipslogic' which will own the 'vipslogic' database
\n
"
while
[
"
$vipslogic_password
"
==
""
]
do
read
-sp
"Password for vipslogic [*]: "
vipslogic_password
done
sudo
-H
-u
postgres bash
-c
"psql -v vipslogic_password=
\"
'
$vipslogic_password
'
\"
-f db/vipslogic_init_1.sql"
printf
"Done with database initialization part 1 (of 3)"
printf
"
\n\n
BUILD THE APPLICATION
\n
"
printf
"
\n\n
BUILD THE APPLICATION
\n
"
printf
"
\n
Installing OpenJDK11 and build tool Maven
\n
"
printf
"
\n
Installing OpenJDK11 and build tool Maven
\n
"
...
@@ -57,28 +35,17 @@ while [ "$vipscommon_deploy_password" == "" ]
...
@@ -57,28 +35,17 @@ while [ "$vipscommon_deploy_password" == "" ]
do
do
read
-p
"GitLab deploy password for VIPSCommon [*]: "
vipscommon_deploy_password
read
-p
"GitLab deploy password for VIPSCommon [*]: "
vipscommon_deploy_password
done
done
while
[
"
$vipscore_deploy_token
"
==
""
]
do
read
-p
"GitLab deploy token for VIPSCore [*]: "
vipscore_deploy_token
done
while
[
"
$vipscore_deploy_password
"
==
""
]
do
read
-p
"GitLab deploy password for VIPSCore [*]: "
vipscore_deploy_password
done
while
[
"
$vipscoremanager_deploy_token
"
==
""
]
do
read
-p
"GitLab deploy token for VIPSCoreManager [*]: "
vipscoremanager_deploy_token
done
while
[
"
$vipscoremanager_deploy_password
"
==
""
]
do
read
-p
"GitLab deploy password for VIPSCoreManager [*]: "
vipscoremanager_deploy_password
done
printf
"
\n
We also need to create a user for compiling and running the code
\n
"
# Add local user for code deployment and running of the Wildfly Application server
# Add local user for code deployment and running of the Wildfly Application server
printf
"
\n
We also need to create a user for compiling and running the code.
\n
"
adduser
$CODE_USER
adduser
$CODE_USER
printf
"
\n
-------------------------------------------------------
\n
"
printf
" DOWNLOADING AND BUILDING VIPSLogic"
printf
"
\n
-------------------------------------------------------
\n
"
# Clone VIPSCommon and VIPSLogic from GitLab
# Clone VIPSCommon and VIPSLogic from GitLab
# For some reason we have to add this even though done manually before running the script
# For some reason we have to add this even though done manually before running the script
echo
$(
echo
-n
| openssl s_client
-showcerts
-connect
gitlab.nibio.no:443 2>/dev/null |
sed
-ne
'/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
)
>>
/etc/ssl/certs/ca-certificates.crt
echo
$(
echo
-n
| openssl s_client
-showcerts
-connect
gitlab.nibio.no:443 2>/dev/null |
sed
-ne
'/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
)
>>
/etc/ssl/certs/ca-certificates.crt
...
@@ -94,13 +61,17 @@ sudo -H -u $CODE_USER bash -c "mvn install -DskipTests"
...
@@ -94,13 +61,17 @@ sudo -H -u $CODE_USER bash -c "mvn install -DskipTests"
# Download and unzip Wildfly 16
# Download and unzip Wildfly 16
printf
"
\n
--------------------------------------------------------------------
\n
"
printf
" Downloading and configuring the WildFly application server"
printf
"
\n
--------------------------------------------------------------------
\n
"
cd
..
cd
..
WILDFLY_VERSION
=
16.0.0.Final
WILDFLY_VERSION
=
16.0.0.Final
echo
"################## TRYING TO REMOVE WILDFLY"
#
echo "################## TRYING TO REMOVE WILDFLY"
echo
$(
pwd
)
#
echo $(pwd)
echo
"rm -rf wildfly-
$WILDFLY_VERSION
"
#
echo "rm -rf wildfly-$WILDFLY_VERSION"
sudo
-H
-u
$CODE_USER
bash
-c
"rm -rf wildfly-
$WILDFLY_VERSION
"
sudo
-H
-u
$CODE_USER
bash
-c
"rm -rf wildfly-
$WILDFLY_VERSION
"
echo
"################## TRied TO REMOVE WILDFLY"
#
echo "################## TRied TO REMOVE WILDFLY"
#exit 0
#exit 0
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
"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
"tar xzf wildfly-
$WILDFLY_VERSION
.tar.gz"
...
@@ -110,11 +81,11 @@ sudo -H -u $CODE_USER bash -c "rm wildfly-$WILDFLY_VERSION.tar.gz"
...
@@ -110,11 +81,11 @@ sudo -H -u $CODE_USER bash -c "rm wildfly-$WILDFLY_VERSION.tar.gz"
printf
"
\n
WILDFLY CONFIGURATION
\n
"
printf
"
\n
WILDFLY CONFIGURATION
\n
"
while
[
"
$smtpserver
"
==
""
]
while
[
"
$smtpserver
"
==
""
]
do
do
read
-p
"SMTP servername [*]: "
smtpserver
read
-p
"SMTP servername
(The mail server that VIPS can use for outgoing mail)
[*]: "
smtpserver
done
done
while
[
"
$md5salt
"
==
""
]
while
[
"
$md5salt
"
==
""
]
do
do
read
-p
"MD5 salt (to make the one-way encryption much harder to break. Type 10-20 random characters) [*]: "
md5salt
read
-p
"MD5 salt
for password encryption
(to make the one-way encryption much harder to break. Type 10-20 random characters) [*]: "
md5salt
done
done
WILDFLY_HOME
=
/home/
$CODE_USER
/wildfly-
$WILDFLY_VERSION
WILDFLY_HOME
=
/home/
$CODE_USER
/wildfly-
$WILDFLY_VERSION
...
@@ -144,6 +115,33 @@ chmod +x $WILDFLY_HOME/bin/launch.sh
...
@@ -144,6 +115,33 @@ chmod +x $WILDFLY_HOME/bin/launch.sh
# Add VIPSLogic to the Wildfly deployments folder
# 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/"
sudo
-H
-u
$CODE_USER
bash
-c
"ln -s /home/
$CODE_USER
/VIPSLogic/target/VIPSLogic-1.0-SNAPSHOT.war
$WILDFLY_HOME
/standalone/deployments/"
printf
"
\n\n
--------------------------------------------------------------------------------------------------------------"
printf
"
\n
The WildFly application server and VIPSLogic code has been installed. It now needs to be initialized and tested.
\n
"
printf
"
\n
Before that, we need to install and configure the PostgreSQL database.
\n
"
printf
"
\n\n
--------------------------------------------------------------------------------------------------------------"
# Database install and setup
# If you have a separate data disk for the database,
# then you need to perform some manual steps after installing
# postgresql. They are not described here.
apt-get
--assume-yes
install
postgresql postgis
# Initialize the VIPSLogic database
printf
"
\n\n
Initializing the VIPSLogic database
\n
"
printf
"We need some input from you before doing that
\n
"
printf
"Required fields are marked with [*]"
printf
"
\n
DATABASE USER INFORMATION
\n
"
printf
"We will create a postgresql user 'vipslogic' which will own the 'vipslogic' database
\n
"
while
[
"
$vipslogic_password
"
==
""
]
do
read
-sp
"Password for vipslogic [*]: "
vipslogic_password
done
sudo
-H
-u
postgres bash
-c
"psql -v vipslogic_password=
\"
'
$vipslogic_password
'
\"
-f db/vipslogic_init_1.sql"
# Run and test WildFly with VIPSLogic deployed
# Run and test WildFly with VIPSLogic deployed
# If successful, this will migrate the vipslogic database to its correct state
# If successful, this will migrate the vipslogic database to its correct state
...
@@ -169,7 +167,7 @@ do
...
@@ -169,7 +167,7 @@ do
echo
"HTTP response from server:
$response
"
echo
"HTTP response from server:
$response
"
done
done
echo
"WildFly started successfully. Installing Apache as frontend."
echo
"WildFly started successfully. Installing
the
Apache
web server
as frontend."
# Install the Apache web server as frontend
# Install the Apache web server as frontend
cd
$INITIAL_DIRECTORY
cd
$INITIAL_DIRECTORY
...
@@ -197,8 +195,11 @@ echo "Apache and WildFly correctly set up. Shutting down Wildfly"
...
@@ -197,8 +195,11 @@ echo "Apache and WildFly correctly set up. Shutting down Wildfly"
sudo
pkill
--newest
java
sudo
pkill
--newest
java
sleep
5s
sleep
5s
# Next up is adding organization information
# Next up is adding organization information
printf
"
\n
----------------------------------------------------------------------------
\n
"
printf
" Populating the VIPSLogic database with your organization's information "
printf
"
\n
----------------------------------------------------------------------------
\n
"
printf
"
\n
ORGANIZATION INFO
\n
"
printf
"
\n
ORGANIZATION INFO
\n
"
while
[
"
$organization_name
"
==
""
]
while
[
"
$organization_name
"
==
""
]
do
do
...
@@ -245,21 +246,51 @@ echo "---------------------------------------------------"
...
@@ -245,21 +246,51 @@ echo "---------------------------------------------------"
echo
" VIPSLogic installed successfully "
echo
" VIPSLogic installed successfully "
echo
" Next: Install VIPSCore and VIPSCoreManager "
echo
" Next: Install VIPSCore and VIPSCoreManager "
echo
"---------------------------------------------------"
echo
"---------------------------------------------------"
while
[
"
$vipscore_deploy_token
"
==
""
]
do
read
-p
"GitLab deploy token for VIPSCore [*]: "
vipscore_deploy_token
done
while
[
"
$vipscore_deploy_password
"
==
""
]
do
read
-p
"GitLab deploy password for VIPSCore [*]: "
vipscore_deploy_password
done
while
[
"
$vipscoremanager_deploy_token
"
==
""
]
do
read
-p
"GitLab deploy token for VIPSCoreManager [*]: "
vipscoremanager_deploy_token
done
while
[
"
$vipscoremanager_deploy_password
"
==
""
]
do
read
-p
"GitLab deploy password for VIPSCoreManager [*]: "
vipscoremanager_deploy_password
done
while
[
"
$naerstadmodel_deploy_token
"
==
""
]
do
read
-p
"GitLab deploy token for the Naerstad late blight model [*]: "
naerstadmodel_deploy_token
done
while
[
"
$naerstadmodel_deploy_password
"
==
""
]
do
read
-p
"GitLab deploy password for the Naerstad late blight model [*]: "
naerstadmodel_deploy_password
done
# Clone VIPSCore
and
VIPSCoreManager from GitLab
# Clone VIPSCore
,
VIPSCoreManager
and the Nærstad model
from GitLab
sudo
-H
-u
$CODE_USER
bash
-c
"git clone --single-branch --branch master https://
$vipscore_deploy_token
:
$vipscore_deploy_password
@gitlab.nibio.no/VIPS/VIPSCore.git ~/VIPSCore"
sudo
-H
-u
$CODE_USER
bash
-c
"git clone --single-branch --branch master https://
$vipscore_deploy_token
:
$vipscore_deploy_password
@gitlab.nibio.no/VIPS/VIPSCore.git ~/VIPSCore"
sudo
-H
-u
$CODE_USER
bash
-c
"git clone --single-branch --branch master https://
$vipscoremanager_deploy_token
:
$vipscoremanager_deploy_password
@gitlab.nibio.no/VIPS/VIPSCoreManager.git ~/VIPSCoreManager"
sudo
-H
-u
$CODE_USER
bash
-c
"git clone --single-branch --branch master https://
$vipscoremanager_deploy_token
:
$vipscoremanager_deploy_password
@gitlab.nibio.no/VIPS/VIPSCoreManager.git ~/VIPSCoreManager"
sudo
-H
-u
$CODE_USER
bash
-c
"git clone --single-branch --branch master https://
$naerstadmodel_deploy_token
:
$naerstadmodel_deploy_password
@gitlab.nibio.no/VIPS/Model_NAERSTADMO.git ~/Model_NAERSTADMO"
# Build the components
# Build the components
cd
/home/
$CODE_USER
/VIPSCore
cd
/home/
$CODE_USER
/VIPSCore
sudo
-H
-u
$CODE_USER
bash
-c
"mvn install -DskipTests"
sudo
-H
-u
$CODE_USER
bash
-c
"mvn install -DskipTests"
cd
../VIPSCoreManager
cd
../VIPSCoreManager
sudo
-H
-u
$CODE_USER
bash
-c
"mvn install -DskipTests"
sudo
-H
-u
$CODE_USER
bash
-c
"mvn install -DskipTests"
cd
../Model_NAERSTADMO
sudo
-H
-u
$CODE_USER
bash
-c
"mvn install -DskipTests"
# Link the components to the WildFly deployments folder
# Link the components to the WildFly deployments folder
sudo
-H
-u
$CODE_USER
bash
-c
"ln -s /home/
$CODE_USER
/VIPSCore/target/VIPSCore-1.0-SNAPSHOT.war
$WILDFLY_HOME
/standalone/deployments/"
sudo
-H
-u
$CODE_USER
bash
-c
"ln -s /home/
$CODE_USER
/VIPSCore/target/VIPSCore-1.0-SNAPSHOT.war
$WILDFLY_HOME
/standalone/deployments/"
sudo
-H
-u
$CODE_USER
bash
-c
"ln -s /home/
$CODE_USER
/VIPSCoreManager/target/VIPSCoreManager-1.0-SNAPSHOT.war
$WILDFLY_HOME
/standalone/deployments/"
sudo
-H
-u
$CODE_USER
bash
-c
"ln -s /home/
$CODE_USER
/VIPSCoreManager/target/VIPSCoreManager-1.0-SNAPSHOT.war
$WILDFLY_HOME
/standalone/deployments/"
# Copy the Naerstad model to the modelcontainer module
sudo
-H
-u
$CODE_USER
bash
-c
"cp /home/
$CODE_USER
/Model_NAERSTADMO/target/NaerstadModel-1.0-SNAPSHOT.jar
$WILDFLY_HOME
/modules/no/nibio/vips/modelcontainer/main/"
# Initializing the database for vipscoremanager
# Initializing the database for vipscoremanager
printf
"
\n
DATABASE USER INFORMATION for vipscoremanager
\n
"
printf
"
\n
DATABASE USER INFORMATION for vipscoremanager
\n
"
printf
"We will create a postgresql user 'vipscoremanager' which will own the 'vipscoremanager' database
\n
"
printf
"We will create a postgresql user 'vipscoremanager' which will own the 'vipscoremanager' database
\n
"
...
@@ -283,14 +314,13 @@ do
...
@@ -283,14 +314,13 @@ do
done
done
while
[
"
$corebatch_password
"
==
""
]
while
[
"
$corebatch_password
"
==
""
]
do
do
read
-p
"Core batch password (Allowing VIPSLogic to run models in VIPSCore) "
corebatch_password
read
-
s
p
"Core batch password (Allowing VIPSLogic to run models in VIPSCore) "
corebatch_password
done
done
cd
$INITIAL_DIRECTORY
/wildfly_config
cd
$INITIAL_DIRECTORY
/wildfly_config
sudo
-H
-u
$CODE_USER
bash
-c
"python3 init_standalone_xml_for_vipscoremanager_and_vipscore.py --md5salt
$md5salt_2
--dbpassword
$vipscoremanager_password
--corebatch_username VIPSLogic --corebatch_password
$corebatch_password
--path
$WILDFLY_CONFIG_PATH
"
sudo
-H
-u
$CODE_USER
bash
-c
"python3 init_standalone_xml_for_vipscoremanager_and_vipscore.py --md5salt
$md5salt_2
--dbpassword
$vipscoremanager_password
--corebatch_username VIPSLogic --corebatch_password
$corebatch_password
--path
$WILDFLY_CONFIG_PATH
"
# Testing Wildfly/VIPSCore/VIPSCoreManager
# Testing Wildfly/VIPSCore/VIPSCoreManager
# Run and test WildFly with VIPSLogic deployed
# Run and test WildFly with VIPSLogic deployed
# If successful, this will migrate the vipslogic database to its correct state
# If successful, this will migrate the vipslogic database to its correct state
...
@@ -321,8 +351,9 @@ sudo pkill --newest java
...
@@ -321,8 +351,9 @@ sudo pkill --newest java
sleep
5s
sleep
5s
# Adding organization info (after first Flyway init of VIPSCoreManager)
# Adding organization info (after first Flyway init of VIPSCoreManager)
cd
$INITIAL_DIRECTORY
passwordhash_2
=
$(
./md5pass.py
$corebatch_password
$md5salt_2
)
passwordhash_2
=
$(
./md5pass.py
$corebatch_password
$md5salt_2
)
PGPASSWORD
=
$vipscoremanager_password
psql
-U
vipscoremanager
-d
vipscoremanager
-h
localhost
-c
"BEGIN;INSERT INTO public.organization(organization_id,organization_name,parent_organization_id) VALUES(1,'
$organization_name
',NULL); INSERT INTO vips_core_user (vips_core_user_id, first_name, last_name, organization_id) VALUES (-10, '', 'VIPSLogic', 1); INSERT INTO vips_core_credentials (id, username, password, vips_core_user_id) VALUES (1, 'vipsbatch', '
$passwordhash_2
', -10);COMMIT;"
PGPASSWORD
=
$vipscoremanager_password
psql
-U
vipscoremanager
-d
vipscoremanager
-h
localhost
-c
"BEGIN;
TRUNCATE public.organization CASCADE;
INSERT INTO public.organization(organization_id,organization_name,parent_organization_id) VALUES(1,'
$organization_name
',NULL); INSERT INTO vips_core_user (vips_core_user_id, first_name, last_name, organization_id) VALUES (-10, '', 'VIPSLogic', 1); INSERT INTO vips_core_credentials (id, username, password, vips_core_user_id) VALUES (1, 'vipsbatch', '
$passwordhash_2
', -10);COMMIT;"
...
@@ -330,4 +361,4 @@ PGPASSWORD=$vipscoremanager_password psql -U vipscoremanager -d vipscoremanager
...
@@ -330,4 +361,4 @@ PGPASSWORD=$vipscoremanager_password psql -U vipscoremanager -d vipscoremanager
echo
"-----------------------------------"
echo
"-----------------------------------"
echo
" INSTALLATION COMPLETE"
echo
" INSTALLATION COMPLETE"
echo
"-----------------------------------"
echo
"-----------------------------------"
echo
"Now run sudo systemctl start wildfly.service to start the system"
echo
"Now run sudo systemctl start wildfly.service to start the system
. Then open up a web browser and go to http://
$servername
"
This diff is collapsed.
Click to expand it.
wildfly_config/modules/no/nibio/vips/modelcontainer/main/module.xml
+
2
−
1
View file @
7bd9a037
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
<resources>
<resources>
<!--resource-root path="."/-->
<!--resource-root path="."/-->
<!--resource-root path="GenericPathogenPlantInfectionModel-1.0-SNAPSHOT.jar"/-->
<!--resource-root path="GenericPathogenPlantInfectionModel-1.0-SNAPSHOT.jar"/-->
<!-- Insert resources here -->
<!-- Insert resources here -->
<resource-root
path=
"NaerstadModel-1.0-SNAPSHOT.jar"
/>
</resources>
</resources>
<dependencies>
<dependencies>
<module
name=
"no.nibio.vips.VIPSCommon"
export=
"false"
/>
<module
name=
"no.nibio.vips.VIPSCommon"
export=
"false"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment