- Update the application.yml, which fixes runtime errors.

- Update the installAndRun.sh, to be able to only build the project (if desired to only produce the JAR), and also to handle errors better.
This commit is contained in:
Lampros Smyrnaios 2022-12-01 14:56:52 +02:00
parent b3758da868
commit 4a32d0278b
2 changed files with 41 additions and 21 deletions

View File

@ -1,43 +1,58 @@
cd "${0%/*}" || (echo "Could not change-dir to this script's dir!" && exit) # Change the working directory to the script's directory, when running from other location.
# This script can create the local "dnet-repository" and copy the "settings-dnet.xml" file there.
# It also builds the project, using the aforementioned settings file.
# Then it can run the project locally.
# By giving different options, the user can either install and run locally, just install or just run the project.
# For error-handling, we cannot use the "set -e" since: it has problems https://mywiki.wooledge.org/BashFAQ/105
# So we have our own function, for use when a single command fails.
handle_error () {
echo -e "$1"; exit $2
}
# Change the working directory to the script's directory, when running from another location.
cd "${0%/*}" || handle_error "Could not change-dir to this script's dir!" 1
if [[ $# -gt 1 ]]; then
echo -e "Wrong number of arguments given: ${#}\nPlease execute it like: installAndRun.sh <1 | 0 (optional)>"; exit 1
echo -e "Wrong number of arguments given: ${#}\nPlease execute it like: installAndRun.sh <1 | 2 | 0 (optional)> "; exit 2
fi
justRun=0
justOneTask=0
if [[ $# -eq 1 ]]; then # If we have just 1 argument.
numbers_re='^[0-9]+$'
if ! [[ $1 =~ $numbers_re ]]; then # If the first argument is not numeric.
echo -e "Invalid, non-numeric argument given: ${1}\nPlease execute it like: installAndRun.sh <1 | 0 (optional)>"; exit 2
echo -e "Invalid, non-numeric argument given: ${1}\nPlease execute it like: installAndRun.sh <1 | 2 | 0 (optional)>"; exit 3
fi
if [[ $1 -ne 0 && $1 -ne 1 ]]; then # If the 1st argument does NOT equal to < 0 > or < 1 >.
echo -e "Invalid argument given: ${1}\nPlease execute it like: installAndRun.sh <1 | 0 (optional)>"; exit 3
if [[ $1 -lt 0 || $1 -gt 2 ]]; then # If the 1st argument does NOT equal to < 0 >, < 1 > or < 2 >.
echo -e "Invalid argument given: ${1}\nPlease execute it like: installAndRun.sh <1 | 2 | 0 (optional)>"; exit 4
fi
justRun=$1 # Assign <1> or <0>
justOneTask=$1 # Assign <1>, <2> or <0>
fi
dnet_repo=~/.m2/repository-dnet45
settings_file=settings-dnet45.xml
if [[ justRun -eq 1 ]]; then
if [[ justOneTask -eq 1 ]]; then
if [ ! -f ${dnet_repo}"/"${settings_file} ]; then
echo -e "The file \"~/.m2/repository-dnet45/settings-dnet45.xml\" does not exist! Exiting.." && exit 4
echo -e "The file \"${dnet_repo}/${settings_file}\" does not exist! Exiting.."; exit 5
fi
else
if [ ! -d ${dnet_repo} ]; then
mkdir ${dnet_repo} || (echo -e "The directory \"~/.m2/repository-dnet45/\" could not be created! Exiting.." && exit 5)
mkdir ${dnet_repo} || exit 6
echo "Created the \"dnet_repo\": ${dnet_repo}"
fi
if [ ! -f ${dnet_repo}"/"${settings_file} ]; then
cp ${settings_file} ${dnet_repo}"/"${settings_file} || (echo -e "The file \"settings-dnet45.xml\" could not be copied in directory \"~/.m2/repository-dnet45\"! Exiting.." && exit 6)
cp ${settings_file} ${dnet_repo}"/"${settings_file} || handle_error "The file \"${settings_file}\" could not be copied in directory \"${dnet_repo}\"! Exiting.." 7
echo "Copied the \"settings_file\" to: ${dnet_repo}/${settings_file}"
fi
mvn clean install -s ${dnet_repo}"/"${settings_file}
mvn clean install -s ${dnet_repo}"/"${settings_file} || handle_error "The project could not be built. Exiting.." 8
fi
java -jar ./target/uoa-repository-manager-service.jar
if [[ justOneTask -ne 2 ]]; then # If we do NOT want to "justInstall".
java -jar ./target/uoa-repository-manager-service.jar || handle_error "The project failed to execute or its execution was interrupted. Exiting.." 9
fi

View File

@ -1,14 +1,19 @@
server:
port: 8480
servlet:
context-path: /uoa-repository-manager-service
services:
provide:
dev-machine: 88.197.53.71
aai:
baseURL: https://aai.openaire.eu
oidc:
domain: .openaire.eu
id: XX
issuer: ${services.provide.aai.baseURL}/oidc/
redirectURL: http://88.197.53.69/api/openid_connect_login
redirectURL: http://localhost:${server.port}${server.servlet.context-path}/openid_connect_login
secret: XX
webURL: http://88.197.53.69/join
webURL: http://localhost:4200/join
registry:
coid: XX
password: XX
@ -17,21 +22,21 @@ services:
username: provide_openaire
adminEmail: XX
analyticsURL: https://analytics.openaire.eu/addsite.php?
baseUrl: https://beta.provide.openaire.eu/
baseUrl: https://dev-openaire.d4science.org/openaire
broker:
api: api/
openaire: openaireBroker
port: 8080
url: https://broker1-dev-dnet.d4science.org
clients:
dsm: https://beta.services.openaire.eu/openaire
dsm: https://dev-openaire.d4science.org/openaire
search: https://beta.services.openaire.eu/search/v2/api
usageEvents: http://beta.lbs.openaire.eu:8080/ajax/summary
usagestats: https://services.openaire.eu/usagestats
db:
driverClassName: org.postgresql.Driver
password: dnetPwd
url: jdbc:postgresql://localhost:5432/repomanager
url: jdbc:postgresql://${services.provide.dev-machine}:5432/repomanager
username: dnet
iSLookUpService:
url: https://dev-openaire.d4science.org:443/is/services/isLookUp
@ -46,8 +51,8 @@ services:
replyTo: XX
username: XX
redis:
host: localhost
password: 2106875370
host: vereniki.athenarc.gr
password: XX
port: 6379
topic_types:
url: https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json
@ -60,4 +65,4 @@ services:
results:
url: https://beta.provide.openaire.eu/compatibility/browseHistory/
validatorService:
url: http://88.197.53.69:8080/uoa-validator-service/services/validatorWebService
url: http://${services.provide.dev-machine}:8080/uoa-validator-service/services/validatorWebService