Skip to content

Commit

Permalink
Added quick install option
Browse files Browse the repository at this point in the history
  • Loading branch information
pct960 committed Aug 22, 2019
1 parent 6483c20 commit 9f9b69e
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 215 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ language: python
python: 2.7

install:
- ./single-node/install
- ./single-node/quick_install

before_script:
- sleep 300
- sleep 10

script:
- ./tests/single-node/test functional --random
Expand Down
40 changes: 40 additions & 0 deletions misc/download_asset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Script to download asset file from tag release using GitHub API v3.
# See: http://stackoverflow.com/a/35688093/55075
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"

# Check dependencies.
set -e
type curl grep sed tr >&2
xargs=$(which gxargs || which xargs)

# Validate settings.
[ -f ~/.secrets ] && source ~/.secrets
[ "$GITHUB_API_TOKEN" ] || { echo "Error: Please define GITHUB_API_TOKEN variable." >&2; exit 1; }
[ $# -ne 4 ] && { echo "Usage: $0 [owner] [repo] [tag] [name]"; exit 1; }
[ "$TRACE" ] && set -x
read owner repo tag name <<<$@

# Define variables.
GH_API="https://api.github.com"
GH_REPO="$GH_API/repos/$owner/$repo"
GH_TAGS="$GH_REPO/releases/tags/$tag"
AUTH="Authorization: token $GITHUB_API_TOKEN"
WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
CURL_ARGS="-LJO#"

# Validate token.
curl -o /dev/null -sH "$AUTH" $GH_REPO || { echo "Error: Invalid repo, token or network issue!"; exit 1; }

# Read asset tags.
response=$(curl -sH "$AUTH" $GH_TAGS)
# Get ID of the asset based on given name.
eval $(echo "$response" | grep -C3 "name.:.\+$name" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
#id=$(echo "$response" | jq --arg name "$name" '.assets[] | select(.name == $name).id') # If jq is installed, this can be used instead.
[ "$id" ] || { echo "Error: Failed to get asset id, response: $response" | awk 'length($0)<100' >&2; exit 1; }
GH_ASSET="$GH_REPO/releases/assets/$id"

# Download asset file.
echo "Downloading asset..." >&2
curl $CURL_ARGS -H 'Accept: application/octet-stream' "$GH_ASSET?access_token=$GITHUB_API_TOKEN"
echo "$0 done." >&2
10 changes: 0 additions & 10 deletions setup/broker/broker_install.sh

This file was deleted.

12 changes: 0 additions & 12 deletions setup/broker/broker_reset.sh

This file was deleted.

6 changes: 0 additions & 6 deletions setup/broker/broker_start.sh

This file was deleted.

9 changes: 0 additions & 9 deletions setup/dbconnector/dbconnector_install.sh

This file was deleted.

12 changes: 0 additions & 12 deletions setup/dbconnector/dbconnector_quick_install.sh

This file was deleted.

12 changes: 0 additions & 12 deletions setup/dbconnector/dbconnector_start.sh

This file was deleted.

5 changes: 0 additions & 5 deletions setup/elk/elk_install.sh

This file was deleted.

13 changes: 0 additions & 13 deletions setup/elk/elk_start.sh

This file was deleted.

64 changes: 0 additions & 64 deletions setup/pgsql/daemon.py

This file was deleted.

20 changes: 0 additions & 20 deletions setup/pgsql/pgsql_install.sh

This file was deleted.

3 changes: 0 additions & 3 deletions setup/pgsql/pgsql_reset.sh

This file was deleted.

9 changes: 0 additions & 9 deletions setup/pgsql/pgsql_start.sh

This file was deleted.

9 changes: 0 additions & 9 deletions setup/vertx/vertx_install.sh

This file was deleted.

12 changes: 0 additions & 12 deletions setup/vertx/vertx_quick_install.sh

This file was deleted.

13 changes: 0 additions & 13 deletions setup/vertx/vertx_start.sh

This file was deleted.

38 changes: 34 additions & 4 deletions single-node/quick_install
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
set -e
YELLOW='\033[1;33m'
NC='\033[0m'
GITHUB_API_TOKEN="80cdc31286b3aabd3b7e82ac010b7e45cde0efd2"
owner="rbccps-iisc"
repo="iudx-resource-server"
name="jars.tar.gz"

directory=`dirname $0`
cd $directory
Expand All @@ -23,10 +27,36 @@ echo "SINGLE_NODE=true" >> .env
echo "MONGO_INITDB_ROOT_USERNAME=root" >> .env
echo "MONGO_INITDB_ROOT_PASSWORD="$mongo_passwd >> .env

#if [ ! -f ../iudx-api-server/target/iudx-api-server-0.0.1-SNAPSHOT-fat.jar ]
#then
##wget from release here
#fi
if [ ! -f ../iudx-api-server/target/iudx-api-server-0.0.1-SNAPSHOT-fat.jar ]
then
GH_API="https://api.github.com"
GH_REPO="$GH_API/repos/$owner/$repo"
GH_TAGS="$GH_REPO/releases/latest"
AUTH="Authorization: token $GITHUB_API_TOKEN"
WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
CURL_ARGS="-LJ#"

# Validate token.
curl -o /dev/null -sH "$AUTH" $GH_REPO || { echo "Error: Invalid repo, token or network issue!"; exit 1; }

# Read asset tags.
response=$(curl -sH "$AUTH" $GH_TAGS)
# Get ID of the asset based on given name.
eval $(echo "$response" | grep -C3 "name.:.\+$name" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
[ "$id" ] || { echo "Error: Failed to get asset id, response: $response" | awk 'length($0)<100' >&2; exit 1; }
GH_ASSET="$GH_REPO/releases/assets/$id"

# Download asset file.
echo "Downloading jar files from the latest release..." >&2
curl $CURL_ARGS -H 'Accept: application/octet-stream' "$GH_ASSET?access_token=$GITHUB_API_TOKEN" > jars.tar.gz
tar -zxf jars.tar.gz
mkdir -p ../iudx-api-server/target/
mkdir -p ../iudx-authenticator/target/
mv jars/iudx-api-server-0.0.1-SNAPSHOT-fat.jar ../iudx-api-server/target/
mv jars/iudx-authenticator-0.0.1-SNAPSHOT-fat.jar ../iudx-authenticator/target/
rm -rf jars
rm jars.tar.gz
fi

docker-compose down -v
docker-compose up -d
Expand Down

0 comments on commit 9f9b69e

Please sign in to comment.