Last active
July 2, 2019 06:14
-
-
Save yanmendes/c6180e47b4610f88adcb4cc37006a9be to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
su postgres <<'EOF' | |
psql -c "create database kepler_test owner pguser" | |
psql -d kepler_test < /bdsetup/kepler.dump | |
EOF |
This file contains hidden or 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 | |
# This script does the following: | |
# - docker initialization: creates the "bigdawg" docker network if not already created | |
# - image pull: pulls postgres, scidb, and accumulo base images from dockerhub | |
# - container run: runs the above containers | |
# - data prep: download and insert data into running containers | |
docker rm -f bigdawg-postgres-catalog | |
docker rm -f bigdawg-postgres-swift | |
docker rm -f bigdawg-postgres-kepler | |
echo | |
echo "==============================================================" | |
echo "===== Creating the bigdawg docker network if not present =====" | |
echo "==============================================================" | |
$(docker network inspect bigdawg &>/dev/null) || { docker network create bigdawg; } | |
echo | |
echo "========================================" | |
echo "===== Pulling images from Dockerhub=====" | |
echo "========================================" | |
docker pull bigdawg/postgres | |
echo | |
echo "=============================" | |
echo "===== Running containers=====" | |
echo "=============================" | |
docker run -d -h bigdawg-postgres-catalog --net=bigdawg -p 5400:5400 -p 8080:8080 -e "PGPORT=5400" -e "BDHOST=bigdawg-postgres-catalog" --name bigdawg-postgres-catalog bigdawg/postgres | |
docker run -d -h bigdawg-postgres-kepler --net=bigdawg -p 5401:5401 -e "PGPORT=5401" -e "BDHOST=bigdawg-postgres-kepler" --name bigdawg-postgres-kepler bigdawg/postgres | |
docker run -d -h bigdawg-postgres-swift --net=bigdawg -p 5402:5402 -e "PGPORT=5402" -e "BDHOST=bigdawg-postgres-swift" --name bigdawg-postgres-swift bigdawg/postgres | |
echo | |
echo "========================" | |
echo "===== Loading data =====" | |
echo "========================" | |
# Download the swift dump | |
if [ -f "swift.dump" ] | |
then | |
echo "Swift dump already exists. Skipping download" | |
else | |
echo "Downloading the swift dump" | |
curl -L -o swift.dump https://drive.google.com/uc?id=146L0rDu3U2jN4KM65YcfS-Ob1QYKaz3A | |
fi | |
# Download the Kepler dump | |
if [ -f "kepler.dump" ] | |
then | |
echo "Kepler dump already exists. Skipping download" | |
else | |
echo "Downloading the kepler dump" | |
curl -L -o kepler.dump https://drive.google.com/uc?id=1c7nHHCfwqXcDtdhHNrdMPHe-cgxCW52N | |
fi | |
# postgres-catalog | |
docker exec -u root bigdawg-postgres-catalog mkdir -p /src/main/resources | |
docker cp ../src/main/resources/PostgresParserTerms.csv bigdawg-postgres-catalog:/src/main/resources | |
docker cp cluster_setup/postgres-catalog/bdsetup bigdawg-postgres-catalog:/ | |
docker exec bigdawg-postgres-catalog /bdsetup/setup.sh | |
# postgres-swift | |
docker exec -u root bigdawg-postgres-swift mkdir -p /bdsetup | |
docker cp swift_setup.sh bigdawg-postgres-swift:/bdsetup/ | |
docker cp swift.dump bigdawg-postgres-swift:/bdsetup/ | |
docker exec --user=root bigdawg-postgres-swift /bdsetup/swift_setup.sh | |
# postgres-kepler | |
docker exec -u root bigdawg-postgres-kepler mkdir -p /bdsetup | |
docker cp kepler_setup.sh bigdawg-postgres-kepler:/bdsetup/ | |
docker cp kepler.dump bigdawg-postgres-kepler:/bdsetup/ | |
docker exec --user=root bigdawg-postgres-kepler /bdsetup/kepler_setup.sh | |
echo | |
echo "=======================================" | |
echo "===== Starting BigDAWG Middleware =====" | |
echo "=======================================" | |
docker exec -d bigdawg-postgres-swift java -classpath "istc.bigdawg-1.0-SNAPSHOT-jar-with-dependencies.jar" istc.bigdawg.Main bigdawg-postgres-swift | |
docker exec -d bigdawg-postgres-kepler java -classpath "istc.bigdawg-1.0-SNAPSHOT-jar-with-dependencies.jar" istc.bigdawg.Main bigdawg-postgres-kepler | |
docker exec -it bigdawg-postgres-catalog java -classpath "istc.bigdawg-1.0-SNAPSHOT-jar-with-dependencies.jar" istc.bigdawg.Main bigdawg-postgres-catalog | |
echo | |
echo "=================" | |
echo "===== Done. =====" | |
echo "=================" |
This file contains hidden or 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 | |
su postgres <<'EOF' | |
psql -c "create database swift owner pguser" | |
psql -d swift < /bdsetup/swift.dump | |
EOF |
This file contains hidden or 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
echo | |
echo "===========================" | |
echo "===== Updating catalog. ===" | |
echo "===========================" | |
curl -X POST -d "bdcatalog(update catalog.engines set host='bigdawg-postgres-swift' where host='bigdawg-postgres-data1');" http://localhost:8080/bigdawg/query/ | |
curl -X POST -d "bdcatalog(update catalog.engines set host='bigdawg-postgres-kepler' where host='bigdawg-postgres-data2');" http://localhost:8080/bigdawg/query/ | |
curl -X POST -d "bdcatalog(update catalog.databases set name='swift' where name='mimic2');" http://localhost:8080/bigdawg/query/ | |
curl -X POST -d "bdcatalog(update catalog.databases set name='kepler' where name='mimic2_copy');" http://localhost:8080/bigdawg/query/ | |
# This runs but nothing happens :( | |
curl -X POST -d "bdcatalog(INSERT INTO catalog.objects values(49, 'port', 'id,direction', 3, 3));" http://localhost:8080/bigdawg/query/ | |
echo | |
echo "=================" | |
echo "===== Done. =====" | |
echo "=================" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment