-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a83c0c
commit 1178be0
Showing
7 changed files
with
165 additions
and
24 deletions.
There are no files selected for viewing
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
Empty file.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
trap "trap_ctrlc" 2 | ||
|
||
ROOT_DIR=$(pwd) | ||
SKIP_BROWSER="0" | ||
function local_read_args() { | ||
while (( "$#" )); do | ||
opt="$1" | ||
case $opt in | ||
-h|-\?|--\?--help) | ||
PRINT_USAGE=1 | ||
QUICKSTART_ARGS="$SCRIPT $1" | ||
break | ||
;; | ||
-b|--branch) | ||
BRANCH="$2" | ||
QUICKSTART_ARGS+=" $1 $2" | ||
shift | ||
;; | ||
-o|--override) | ||
RECREATE_TAR="1" | ||
QUICKSTART_ARGS=" $SCRIPT" | ||
;; | ||
--skip-setup) | ||
SKIP_SETUP=true | ||
;; | ||
*) | ||
QUICKSTART_ARGS+=" $1" | ||
#echo $1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
if [[ -z $BRANCH ]]; then | ||
echo "Usage: $0 -b/--branch <branch> [--skip-setup]" | ||
exit 1 | ||
fi | ||
} | ||
|
||
if [[ $(docker pull dtr.predix.io/predix-edge/predix-edge-mosquitto-amd64:latest) ]]; then | ||
echo "pull successfully" | ||
else | ||
read -p "Enter your DTR user name> " DTR_USERNAME | ||
read -p "Enter your DTR password> " -s DTR_PASSWORD | ||
docker login dtr.predix.io -u $DTR_USERNAME -p $DTR_PASSWORD | ||
docker pull dtr.predix.io/predix-edge/predix-edge-mosquitto-amd64:latest | ||
fi | ||
|
||
#docker pull predixadoption/edge-hello-world:latest | ||
pwd | ||
if [[ "$RECREATE_TAR" == "1" || ! -e "images.tar" ]]; then | ||
echo "Creating a images.tar with required images" | ||
docker save -o images.tar predixadoption/edge-hello-world:latest | ||
fi | ||
if [[ "$RECREATE_TAR" == "1" || ! -e "app.tar.gz" ]]; then | ||
rm -rf app.tar.gz | ||
echo "Creating app.tar.gz with docker-compose.yml" | ||
tar -czvf app.tar.gz images.tar docker-compose.yml | ||
fi | ||
|
||
if [[ "$RECREATE_TAR" == "1" || ! -e "config.zip" ]]; then | ||
rm -rf config.zip | ||
echo "Compressing the configurations." | ||
cd config | ||
zip -X -r ../config.zip *.json | ||
cd ../ | ||
fi | ||
|
||
read -p "Enter the IP Address of Edge OS> " IP_ADDRESS | ||
read -p "Enter the username for Edge OS> " LOGIN_USER | ||
read -p "Enter your user password> " -s LOGIN_PASSWORD | ||
|
||
pwd | ||
expect -c " | ||
spawn scp -o \"StrictHostKeyChecking=no\" app.tar.gz config.zip scripts/quickstart-run-wind-workbench.sh $LOGIN_USER@$IP_ADDRESS:/mnt/data/downloads | ||
set timeout 50 | ||
expect { | ||
\"Are you sure you want to continue connecting\" { | ||
send \"yes\r\" | ||
expect \"assword:\" | ||
send "$LOGIN_PASSWORD\r" | ||
} | ||
\"assword:\" { | ||
send \"$LOGIN_PASSWORD\r\" | ||
} | ||
} | ||
expect \"*\# \" | ||
spawn ssh -o \"StrictHostKeyChecking=no\" root@$IP_ADDRESS | ||
set timeout 5 | ||
expect { | ||
\"Are you sure you want to continue connecting\" { | ||
send \"yes\r\" | ||
expect \"assword:\" | ||
send \"$LOGIN_PASSWORD\r\" | ||
} | ||
"assword:" { | ||
send \"$LOGIN_PASSWORD\r\" | ||
} | ||
} | ||
expect \"*\# \" | ||
send \"su eauser /mnt/data/downloads/quickstart-run-wind-workbench.sh\r\" | ||
set timeout 50 | ||
expect \"*\# \" | ||
send \"exit\r\" | ||
" | ||
|
||
# Automagically open the application in browser, based on OS | ||
if [[ $SKIP_BROWSER == 0 ]]; then | ||
app_url="http://$IP_ADDRESS:9098" | ||
|
||
case "$(uname -s)" in | ||
Darwin) | ||
# OSX | ||
open $app_url | ||
;; | ||
Linux) | ||
# OSX | ||
xdg-open $app_url | ||
;; | ||
CYGWIN*|MINGW32*|MINGW64*|MSYS*) | ||
# Windows | ||
start "" $app_url | ||
;; | ||
esac | ||
fi | ||
########### custom logic ends here ########### | ||
|
||
#scp app.tar.gz config.zip scripts/quickstart-run-wind-workbench.sh root@$IP_ADDRESS:/mnt/data/downloads |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
trap "trap_ctrlc" 2 | ||
|
||
ROOT_DIR=$(pwd) | ||
|
||
APPLICATION_ID="edge-hello-world" | ||
|
||
curl http://localhost/api/v1/applications --unix-socket /var/run/edge-core/edge-core.sock -X POST -F "file=@/mnt/data/downloads/app.tar.gz" -H "app_name: $APPLICATION_ID" | ||
|
||
mkdir -p /var/lib/edge-agent/app/$APPLICATION_ID/conf/ | ||
|
||
unzip /mnt/data/downloads/config.zip -d /var/lib/edge-agent/app/$APPLICATION_ID/conf/ | ||
|
||
#chown -R eauser /var/lib/edge-agent/app/$APPLICATION_ID/ | ||
|
||
if [[ $(docker service ls -f "name=$APPLICATION_ID_edge-hello-world" -q | wc -l) > 0 ]]; then | ||
/opt/edge-agent/app-stop --appInstanceId=$APPLICATION_ID | ||
fi | ||
|
||
/opt/edge-agent/app-start --appInstanceId=$APPLICATION_ID |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"name": "Wind Workbench", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"private": false, | ||
"dependencies": { | ||
"local-setup": "https://github.com/PredixDev/local-setup#1.0.96", | ||
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.146", | ||
"wind-workbench": "https://github.com/PredixDev/wind-workbench#1.0.4" | ||
"local-setup": "https://github.com/PredixDev/local-setup#1.0.99", | ||
"predix-scripts": "https://github.com/PredixDev/predix-scripts#1.1.149", | ||
"wind-workbench": "https://github.com/PredixDev/wind-workbench#1.0.5" | ||
}, | ||
"author": "susheelchoudhari" | ||
} |