Last active
November 12, 2019 07:28
-
-
Save kai-chi/d6e1efacae5c7020bcb62294f17ba5e8 to your computer and use it in GitHub Desktop.
Deploy new hopsworks-ear with one click. Run the "deploy-hopsworks.sh" script and enjoy few minutes of free time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
BRANCH=$1 | |
echo "Executing on vm. Branch: $BRANCH" | |
cd /home/vagrant/hopsworks | |
git fetch origin | |
git reset --hard "origin/$BRANCH" | |
mvn -pl \!hopsworks-IT -U clean install -DskipTests -P-web | |
sudo su | |
echo "AS_ADMIN_PASSWORD=adminpw" > /tmp/glassfish_pass | |
/srv/hops/glassfish/versions/current/bin/asadmin -u adminuser --passwordfile /tmp/glassfish_pass undeploy hopsworks-ear | |
/srv/hops/glassfish/versions/current/bin/asadmin -u adminuser --passwordfile /tmp/glassfish_pass deploy /home/vagrant/hopsworks/hopsworks-ear/target/hopsworks-ear.ear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################################### | |
# Prerequisites: | |
# 1. change variables in the script to your filesystem | |
# 2. locally checkout the hopsworks branch you want to work on | |
# 3. you must be able to connect to your vm with "ssh vm" | |
# 4. in the vm, checkout hopsworks' working branch to /home/vagrant/hopsworks | |
########################################################### | |
BUILD_ON_VM_SCRIPT=<path_to_the_second_script> | |
LOCAL_HOPSWORKS_DIR=<path_to_your_local_hopsworks> | |
BRANCH=<branch_name> | |
start=$(date +%s) | |
echo "Hopsworks local directory: $LOCAL_HOPSWORKS_DIR" | |
echo "Script to run on the vm directory: $BUILD_ON_VM_SCRIPT" | |
echo "Branch name: $BRANCH" | |
cd "$LOCAL_HOPSWORKS_DIR" || exit | |
#check if there are no compile errors | |
mvn compile -DskipTests -P-web || exit | |
git commit -am "update_$(date +"%DT%T")" | |
git push origin $BRANCH | |
ssh vm 'bash -s' < $BUILD_ON_VM_SCRIPT $BRANCH | |
end=$(date +%s) | |
echo "Script executed in $((end-start)) seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment