Commit 27b57b1e authored by Guillaume Cornut's avatar Guillaume Cornut
Browse files

fix: Fix gnpis application context path.

parent b2329ba4
......@@ -111,7 +111,7 @@ build-gnpis:
# Restarting service with the updated jar and the according Spring profiles enabled
- ssh root@${SERVER_IP} "systemctl restart bootapp@${APP_NAME}-${ENV}"
- eval $(ssh-agent -k)
- echo "Deploy and index done. Application should be available at http://${SERVER_IP}:${APP_PORT}/${APP_NAME}-${ENV}"
- echo "Deploy and index done. Application should be available at http://${SERVER_IP}:${APP_PORT}/${APP_CONTEXT}"
.variables-rare-beta: &variables-rare-beta
variables:
......@@ -121,6 +121,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_DEV_HOST}
ES_PORT: ${ES_DEV_PORT}
APP_CONTEXT: ${APP_NAME}-${ENV}
.variables-rare-staging: &variables-rare-staging
variables:
......@@ -130,6 +131,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_PROD_HOST}
ES_PORT: ${ES_PROD_PORT}
APP_CONTEXT: ${APP_NAME}-${ENV}
.variables-rare-prod: &variables-rare-prod
variables:
......@@ -139,6 +141,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_PROD_HOST}
ES_PORT: ${ES_PROD_PORT}
APP_CONTEXT: ${APP_NAME}-${ENV}
.variables-wheatis-beta: &variables-wheatis-beta
variables:
......@@ -148,6 +151,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_DEV_HOST}
ES_PORT: ${ES_DEV_PORT}
APP_CONTEXT: ${APP_NAME}-${ENV}
.variables-wheatis-staging: &variables-wheatis-staging
variables:
......@@ -157,6 +161,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_PROD_HOST}
ES_PORT: ${ES_PROD_PORT}
APP_CONTEXT: ${APP_NAME}-${ENV}
.variables-wheatis-prod: &variables-wheatis-prod
variables:
......@@ -164,6 +169,7 @@ build-gnpis:
APP_NAME: wheatis
APP_PORT: ${PROD_WHEATIS_PORT}
SERVER_IP: ${SERVER_IP}
APP_CONTEXT: ${APP_NAME}-${ENV}
.variables-gnpis-beta: &variables-gnpis-beta
variables:
......@@ -173,6 +179,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_DEV_HOST}
ES_PORT: ${ES_DEV_PORT}
APP_CONTEXT: data-discovery-${ENV}
.variables-gnpis-staging: &variables-gnpis-staging
variables:
......@@ -182,6 +189,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_PROD_HOST}
ES_PORT: ${ES_PROD_PORT}
APP_CONTEXT: data-discovery-${ENV}
.variables-gnpis-prod: &variables-gnpis-prod
variables:
......@@ -191,6 +199,7 @@ build-gnpis:
SERVER_IP: ${SERVER_IP}
ES_HOST: ${ES_PROD_HOST}
ES_PORT: ${ES_PROD_PORT}
APP_CONTEXT: data-discovery
deploy-rare-to-beta:
stage: staging
......@@ -325,7 +334,7 @@ deploy-gnpis-to-prod:
- "curl -s -XDELETE ${ES_HOST}:${ES_PORT}/${APP_NAME}-${ENV}-* ; echo"
# Should better handle those index switches by using the strategy proposed in the README file
- "./scripts/createIndexAndAliases4CI.sh -host ${ES_HOST} -app ${APP_NAME} -env ${ENV} ; sleep 1 ; echo"
- "./scripts/harvestCI.sh -host ${SERVER_IP} -port ${APP_PORT} -app ${APP_NAME} -env ${ENV} ; echo"
- "./scripts/harvestCI.sh -url http://${SERVER_IP}:${APP_PORT}/${APP_CONTEXT} -app ${APP_NAME} -env ${ENV} ; echo"
environment:
# take care that some variables cannot be expanded according to where they are
# defined. Info: https://forgemia.inra.fr/help/ci/variables/where_variables_can_be_used.md
......
......@@ -418,12 +418,12 @@ This readme will be useful :
data-discovery:
elasticsearch-prefix: 'gnpis-dev-'
resource-dir: /tmp/gnpis-dev/resources
resource-dir: /tmp/data-discovery-dev/resources
server:
port: 8280
servlet:
context-path: /gnpis-dev
context-path: /data-discovery-dev
##### `data` folder
......@@ -476,8 +476,8 @@ And edit them as desired.
{
context: [
"/gnpis-dev/api",
"/gnpis-dev/actuator"
"/data-discovery-dev/api",
"/data-discovery-dev/actuator"
],
target: "http://localhost:8280",
secure: false
......@@ -524,7 +524,7 @@ In our case, after launching the test, we kept getting `Permission denied` error
./scripts/createIndexAndAliases.sh
./scripts/harvestGnpis.sh
5. App is running at : http://localhost:8280/gnpis-dev/
5. App is running at : http://localhost:8280/data-discovery-dev/
Check out the [main readme](https://forgemia.inra.fr/urgi-is/data-discovery/blob/master/README.md) for more details.
......
......@@ -77,9 +77,9 @@ spring:
data-discovery:
elasticsearch-prefix: 'gnpis-dev-'
resource-dir: /tmp/gnpis-dev/resources
resource-dir: /tmp/data-discovery-dev/resources
server:
port: 8280
servlet:
context-path: /gnpis-dev
context-path: /data-discovery-dev
......@@ -150,7 +150,7 @@
"with": "src/environments/environment.gnpis.ts"
}
],
"baseHref": "/gnpis-dev/",
"baseHref": "/data-discovery-dev/",
"stylePreprocessorOptions": {
"includePaths": [
"src/assets/gnpis/"
......
......@@ -17,8 +17,8 @@ const PROXY_CONFIG = [
},
{
context: [
"/gnpis-dev/api",
"/gnpis-dev/actuator"
"/data-discovery-dev/api",
"/data-discovery-dev/actuator"
],
target: "http://localhost:8280",
secure: false
......
......@@ -7,13 +7,12 @@ DESCRIPTION:
Script used to index data in Data Discovery portals (RARe, WheatIS and GnpIS)
USAGE:
$0 -host <host name> -port <port value> -app <application name> -env <environment name> -copy [-h|--help]
$0 -url <app url> -app <application name> -env <environment name> -copy [-h|--help]
PARAMS:
-host the host name of the targeted application
-port the port value of the targeted application
-url the application url (ex: http://HOST:PORT/CONTEXT_PATH)
-app the name of the targeted application: rare, wheatis or gnpis
-env the environement name of the targeted application (dev, beta, prod ...)
-env the environment name of the targeted application (dev, beta, prod ...)
-copy to set if the data files needs to be copied on the application host
-h or --help print this help
......@@ -22,10 +21,9 @@ EOF
}
BASEDIR=$(dirname "$0")
APP_HOST=""
APP_PORT=""
APP_URL=""
APP_NAME=""
ENV=""
APP_ENV=""
COPY_FILES=0
# any params
......@@ -36,10 +34,9 @@ while [ -n "$1" ]; do
case $1 in
-h) help;shift 1;;
--help) help;shift 1;;
-host) APP_HOST=$2;shift 2;;
-port) APP_PORT=$2;shift 2;;
-url) APP_URL=$2;shift 2;;
-app) APP_NAME=$2;shift 2;;
-env) ENV=$2;shift 2;;
-env) APP_ENV=$2;shift 2;;
-copy) COPY_FILES=1;shift 1;;
--) shift;break;;
-*) echo "Unknown option: $1" && echo && help && echo;exit 1;;
......@@ -47,13 +44,13 @@ while [ -n "$1" ]; do
esac
done
if [ -z "$APP_HOST" ] || [ -z "$APP_PORT" ] || [ -z "$APP_NAME" ] || [ -z "ENV" ]; then
if [ -z "$APP_URL" ] || [ -z "$APP_NAME" ] || [ -z "$APP_ENV" ]; then
echo "ERROR: host, port, app and env parameters are mandatory!"
echo && help
exit 4
fi
INDEX_DATA_DIR="/tmp/$APP_NAME-$ENV/resources"
INDEX_DATA_DIR="/tmp/$APP_NAME-$APP_ENV/resources"
if [ $COPY_FILES -eq 0 ]; then
echo "WARN: Harvester will index JSON already present in $INDEX_DATA_DIR on the application server..."
fi
......@@ -76,12 +73,11 @@ if [ $COPY_FILES -eq 1 ]; then
fi
{
curl -f -i -X POST -u ${APP_NAME}:f01a7031fc17 \
"http://${APP_HOST}:${APP_PORT}/${APP_NAME}-${ENV}/api/harvests"
curl -f -i -X POST -u ${APP_NAME}:f01a7031fc17 "${APP_URL}/api/harvests"
} || {
code=$?
echo -e "A problem occured (code=$code) when trying to index data \n"\
"\tfrom $INDEX_DATA_DIR\n"\
"\ton app http://${APP_HOST}:${APP_PORT}/${APP_NAME}-${ENV}"
"\ton app ${APP_URL}"
exit $code
}
......@@ -3,4 +3,4 @@
# delegates to parameterized script
BASEDIR=$(dirname "$0")
sh $BASEDIR/harvestCI.sh -host localhost -port 8280 -app gnpis -env dev -copy
sh $BASEDIR/harvestCI.sh -url http://localhost:8280/data-discovery-dev -app gnpis -env dev -copy
......@@ -3,4 +3,4 @@
# delegates to parameterized script
BASEDIR=$(dirname "$0")
sh $BASEDIR/harvestCI.sh -host localhost -port 8080 -app rare -env dev -copy
sh $BASEDIR/harvestCI.sh -url http://localhost:8080/rare-dev -app rare -env dev -copy
......@@ -3,4 +3,4 @@
# delegates to parameterized script
BASEDIR=$(dirname "$0")
sh $BASEDIR/harvestCI.sh -host localhost -port 8180 -app wheatis -env dev -copy
sh $BASEDIR/harvestCI.sh -url http://localhost:8180/wheatis-dev -app wheatis -env dev -copy
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment