From 10015c1229b107c7135de50a42d1f7a2b4d31d9c Mon Sep 17 00:00:00 2001 From: Theofilos Kakantousis Date: Mon, 7 Jan 2019 15:36:33 +0100 Subject: [PATCH] HOPSWORKS-862 (#102) --- .../hopsworks/api/app/ApplicationService.java | 2 +- scripts/README.md | 16 --- scripts/dev-deploy-frontend.sh | 28 ----- scripts/js.sh | 110 ------------------ scripts/scp-deploy-frontend.sh | 4 +- scripts/update-tables.sh | 37 ------ 6 files changed, 3 insertions(+), 194 deletions(-) delete mode 100644 scripts/README.md delete mode 100755 scripts/dev-deploy-frontend.sh delete mode 100755 scripts/js.sh delete mode 100755 scripts/update-tables.sh diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/app/ApplicationService.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/app/ApplicationService.java index 41ae6fb27c..040b3164f3 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/app/ApplicationService.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/app/ApplicationService.java @@ -349,7 +349,7 @@ private String checkAndGetProjectUser(byte[] keyStore, char[] keyStorePwd) throw return commonName; } catch (Exception ex) { - throw new UserException(RESTCodes.UserErrorCode.AUTHENTICATION_FAILURE, Level.SEVERE, null, ex.getMessage()); + throw new UserException(RESTCodes.UserErrorCode.AUTHENTICATION_FAILURE, Level.SEVERE, null, ex.getMessage(), ex); } } diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index e44e1955ac..0000000000 --- a/scripts/README.md +++ /dev/null @@ -1,16 +0,0 @@ - -## update-tables.sh - -This script is used to synchronize updates in ../sql/hopsworks.sql to the Chef cookbooks. -Run this script if you update ../sql/hopsworks.sql -You need to be a committer on the hopshadoop/hopsworks-chef project on github to be able to run this script. - - -## deploy-war.sh - -This script creates a new release for hopsworks.war on our http server. You need to have your public -key registered with the server to be authorized to execute this script. - -## dev-deploy-frontend.sh - -This script is a way to do frontend development without having to republish your war file on glassfish for every update. diff --git a/scripts/dev-deploy-frontend.sh b/scripts/dev-deploy-frontend.sh deleted file mode 100755 index a56a3c439f..0000000000 --- a/scripts/dev-deploy-frontend.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Deploy the frontend to the glassfish home directory and run bower - -cd .. - -# Check if GLASSFISH_HOME is set -if [ -z "$GLASSFISH_HOME" ]; then - echo "GLASSFISH_HOME is not set. Set it to the directory in which your glassfish instance is installed." - exit 1 -fi - -# Copy the app folder to the right location -cp -r yo/app/ $GLASSFISH_HOME/glassfish/domains/domain1/docroot/ -# Copy the bower.json -cp yo/bower.json $GLASSFISH_HOME/glassfish/domains/domain1/docroot/ - -#change directory to the glassfish docroot -cd $GLASSFISH_HOME/glassfish/domains/domain1/docroot -#install bower components -bower install -#Edit the index.html -cd app/ -perl -pi -e "s/bower_components/..\/bower_components/g" index.html -perl -pi -e "s/getLocationBase\(\)/'http:\/\/localhost:8080\/hopsworks'/g" scripts/services/RequestInterceptorService.js - -#Open a new firefox tab -#firefox -new-tab http://localhost:8080/app -google-chrome -new-tab http://localhost:8080/app diff --git a/scripts/js.sh b/scripts/js.sh deleted file mode 100755 index 5731b727c5..0000000000 --- a/scripts/js.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# Deploy the frontend to the glassfish home directory and run bower - -set -e - -if [ "$1" == "-help" ] ; then - echo "usage: $0 [hostname][full_pathname_to_karamel-chef]" - exit 1 -fi - -usr=${USER} -vagrant_user=vagrant -SERVER="127.0.0.1" -dir="/home/$usr/NetBeansProjects/karamel-chef" -SSH_PORT=22 - - -if [ $# -eq 1 ] ; then - SERVER=$1 -fi - - -if [ $# -eq 2 ] ; then - SERVER=$1 - dir=$2 -fi - -if [ ! -f ${HOME}/.ssh/id_rsa.pub ] ; then - echo "No ssh keypair found. " - echo "Generating a passwordless ssh keypair with ssh-keygen at ${HOME}/.ssh/id_rsa(.pub)" - ssh-keygen -b 2048 -f ${HOME}/.ssh/id_rsa -t rsa -q -N '' - if [ $? -ne 0 ] ; then - echo "Problem generating a passwordless ssh keypair with the following command:" - echo "ssh-keygen -b 2048 -f ${HOME}/.ssh/id_rsa -t rsa -q -N ''" - echo "Exiting with error." - exit 12 - fi -fi - -public_key=$(cat ${HOME}/.ssh/id_rsa.pub) - -grep "$public_key" ${HOME}/.ssh/authorized_keys -if [ $? -ne 0 ] ; then - echo "Enabling ssh into localhost (needed by Karamel)" - echo "Adding ${usr} public key to ${HOME}/.ssh/authorized_keys" - cat ${HOME}/.ssh/id_rsa.pub >> ${HOME}/.ssh/authorized_keys -fi - -# 2. check if openssh server installed - -echo "Check if openssh server installed and that ${usr} can ssh without a password into ${usr}@localhost" - -ssh -p $SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${usr}@localhost "echo 'ssh connected'" - -if [ $? -ne 0 ] ; then - echo "Ssh server needs to be running on localhost. Starting one..." - sudo service ssh restart - if [ $? -ne 0 ] ; then - echo "Installing ssh server." - sudo apt-get install openssh-server -y - sleep 2 - sudo service ssh status - if [ $? -ne 0 ] ; then - echo "Error: could not install/start a ssh server. Install an openssh-server (or some other ssh server) and re-run this install script." - echo "Exiting..." - exit 2 - fi - fi - ssh -p $SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${usr}@localhost "echo 'hello'" - if [ $? -ne 0 ] ; then - echo "Error: could not ssh to $usr@localhost" - echo "You need to setup you machine so that $usr can ssh to localhost" - echo "Exiting..." - exit 3 - fi -fi - - -stuff=`ssh ${usr}@${SERVER} "cd $dir && ./run.sh ports | grep ^22 "` -vagrant_port=`echo $stuff | sed -e 's/22 -> //'` - -webbie=`ssh ${usr}@${SERVER} "cd $dir && ./run.sh ports | grep ^8080 "` -web_port=`echo $webbie | sed -e 's/8080 -> //'` - -echo "vagrant port: $vagrant_port" -echo "web port: $web_port" - -export PORT=${vagrant_port} -export WEBPORT=${web_port} -export SERVER=$SERVER -export key=insecure_private_key -export usr=$usr - -basedir=/srv/hops/domains/domain1 - -scp ${usr}@${SERVER}:/home/${usr}/.vagrant.d/${key} . - -ssh -o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i $key -p $PORT vagrant@${SERVER} "cd ${basedir} && sudo chown -R ${vagrant_user}:${vagrant_user} docroot && sudo chmod -R 775 * && sudo chown -R ${vagrant_user}:${vagrant_user} ~/.local || echo 'no .local'" - -#echo "ssh -o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i $key -p $PORT vagrant@${SERVER} \"cd ${basedir} && sudo chmod -R 775 *\"" - -scp -o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i $key -P ${PORT} -r ../hopsworks-web/yo/app/ vagrant@${SERVER}:${basedir}/docroot - -scp -o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i $key -P ${PORT} ../hopsworks-web/yo/bower.json vagrant@${SERVER}:${basedir}/docroot/app - -ssh -o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i $key -p $PORT vagrant@${SERVER} "cd ${basedir}/docroot/app && bower install" - -#ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i $key -p $PORT vagrant@${SERVER} "cd ${basedir}/docroot/app && perl -pi -e \"s/getApiLocationBase\(\)/'http:\/\/${SERVER}:${WEBPORT}\/hopsworks-api/api\/'/g\" scripts/services/RequestInterceptorService.js" - -google-chrome -new-tab http://${SERVER}:$WEBPORT/app diff --git a/scripts/scp-deploy-frontend.sh b/scripts/scp-deploy-frontend.sh index 5f4809d017..ef083dd943 100755 --- a/scripts/scp-deploy-frontend.sh +++ b/scripts/scp-deploy-frontend.sh @@ -1,6 +1,6 @@ #!/bin/bash # Deploy the frontend to the glassfish home directory and run bower -export SERVER=localvm +export SERVER=vm export WEBPORT=35139 export key=private_key @@ -8,6 +8,6 @@ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnl scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -r ../hopsworks-web/yo/app/ vagrant@${SERVER}:/srv/hops/domains/domain1/docroot scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes ../hopsworks-web/yo/bower.json vagrant@${SERVER}:/srv/hops/domains/domain1/docroot/app - +scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes ../hopsworks-web/yo/.bowerrc vagrant@${SERVER}:/srv/hops/domains/domain1/docroot/app ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes vagrant@${SERVER} "cd /srv/hops/domains/domain1/docroot/app && bower install && perl -pi -e \"s/getLocationBase\(\)/'http:\/\/${SERVER}:${WEBPORT}\/hopsworks'/g\" scripts/services/RequestInterceptorService.js" diff --git a/scripts/update-tables.sh b/scripts/update-tables.sh deleted file mode 100755 index c4ae101eb4..0000000000 --- a/scripts/update-tables.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -set -e -if [ ! -d ../../hopsworks-chef ] ; then - - echo "Run this script from the ./hopsworks/scripts directory." - echo "You must checkout the project: 'hopshadoop/hopsworks-chef' into the same root directory as the 'hopsworks' project" - echo "This script will then update the sql tables in the 'hopsworks-chef' project" - exit 1 -fi - - -pushd . -cd ../../hopsworks-chef -git checkout develop -git pull -popd - -diff ../sql/hopsworks.sql ../../hopsworks-chef/templates/default/tables.sql.erb - -if [ $? -eq 0 ] ; then - echo "hopsworks.sql is update-to-date. No changes made." - exit 0 -fi - - -cp ../sql/hopsworks.sql ../../hopsworks-chef/templates/default/tables.sql.erb - -pushd . -cd ../../hopsworks-chef -git commit -am "Updating hopsworks.sql" -git push -popd - -echo "Updated sql tables" - -exit 0