diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9a24f57 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.bash eol=lf diff --git a/01_postgres/down.bash b/01_postgres/down.bash new file mode 100755 index 0000000..db5a021 --- /dev/null +++ b/01_postgres/down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker-compose down diff --git a/01_postgres/up.bash b/01_postgres/up.bash new file mode 100755 index 0000000..e856240 --- /dev/null +++ b/01_postgres/up.bash @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting PostgreSQL..." +docker compose up --detach + +>&2 echo "Connecting to the CLI as postgres..." +docker exec -it 7dbs_postgres_db psql -U postgres -W --dbname=7dbs diff --git a/02_hbase/cluster_down.bash b/02_hbase/cluster_down.bash new file mode 100755 index 0000000..2f18608 --- /dev/null +++ b/02_hbase/cluster_down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker-compose -f docker-images/docker-compose-distributed-local.yml down diff --git a/02_hbase/cluster_setup.bash b/02_hbase/cluster_setup.bash new file mode 100755 index 0000000..316b8d2 --- /dev/null +++ b/02_hbase/cluster_setup.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker volume create --name=hadoop_namenode +docker volume create --name=hadoop_datanode +docker volume create --name=hadoop_historyserver diff --git a/02_hbase/cluster_teardown.bash b/02_hbase/cluster_teardown.bash new file mode 100755 index 0000000..699b2f2 --- /dev/null +++ b/02_hbase/cluster_teardown.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker volume rm hadoop_namenode +docker volume rm hadoop_datanode +docker volume rm hadoop_historyserver diff --git a/02_hbase/cluster_up.bash b/02_hbase/cluster_up.bash new file mode 100755 index 0000000..000d0f5 --- /dev/null +++ b/02_hbase/cluster_up.bash @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting HBase (local cluster)..." +docker-compose -f docker-images/docker-compose-distributed-local.yml up --detach + +# Connect to HBase shell +>&2 echo "To connect to the shell: /opt/hbase-1.2.6/bin/hbase shell" +>&2 echo "To access scripts: /tmp/scripts/" +docker exec -it hbase-master /bin/bash diff --git a/02_hbase/local_down.bash b/02_hbase/local_down.bash new file mode 100755 index 0000000..cb232fc --- /dev/null +++ b/02_hbase/local_down.bash @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker-compose -f docker-images/docker-compose-standalone.yml down + +docker volume rm docker-hbase_hadoop_namenode +docker volume rm docker-hbase_hadoop_datanode +docker volume rm docker-hbase_hadoop_historyserver +docker volume rm docker-hbase_hbase_data +docker volume rm docker-hbase_hbase_zookeeper_data diff --git a/02_hbase/local_up.bash b/02_hbase/local_up.bash new file mode 100755 index 0000000..f1adb2b --- /dev/null +++ b/02_hbase/local_up.bash @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting HBase (local standalone)..." +docker-compose -f docker-images/docker-compose-standalone.yml up --detach + +# Connect to HBase shell +docker exec -it hbase /opt/hbase-1.2.6/bin/hbase shell diff --git a/03_mongodb/cluster_down.bash b/03_mongodb/cluster_down.bash new file mode 100755 index 0000000..0691a58 --- /dev/null +++ b/03_mongodb/cluster_down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker-compose -f cluster/mongo-cluster-docker/docker-compose.1.yml -f cluster/mongo-cluster-docker/docker-compose.2.yml -f cluster/mongo-cluster-docker/docker-compose.cnf.yml -f cluster/mongo-cluster-docker/docker-compose.shard.yml -f cluster/docker-compose.gui.yml down diff --git a/03_mongodb/cluster_up.bash b/03_mongodb/cluster_up.bash new file mode 100755 index 0000000..9b62c61 --- /dev/null +++ b/03_mongodb/cluster_up.bash @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker-compose -f cluster/mongo-cluster-docker/docker-compose.1.yml -f cluster/mongo-cluster-docker/docker-compose.2.yml -f cluster/mongo-cluster-docker/docker-compose.cnf.yml -f cluster/mongo-cluster-docker/docker-compose.shard.yml -f cluster/docker-compose.gui.yml up --detach + +# No authentication needed +>&2 echo "Connecting to the CLI..." +sleep 5 +docker exec -it mongo-router mongo diff --git a/03_mongodb/local_down.bash b/03_mongodb/local_down.bash new file mode 100755 index 0000000..fc0bc11 --- /dev/null +++ b/03_mongodb/local_down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker-compose down \ No newline at end of file diff --git a/03_mongodb/local_up.bash b/03_mongodb/local_up.bash new file mode 100755 index 0000000..85dc2aa --- /dev/null +++ b/03_mongodb/local_up.bash @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting MongoDB..." +docker-compose up --detach + +>&2 echo "Opening GUI (mongo-express)" + +>&2 echo "Connecting to the CLI..." +sleep 5 +>&2 echo "Username: mongo; Password: gonmo" +docker exec -it 7dbs_mongo_db mongo --username mongo --password gonmo diff --git a/04_couchdb/cluster/cluster_down.bash b/04_couchdb/cluster/cluster_down.bash new file mode 100755 index 0000000..0b6bbff --- /dev/null +++ b/04_couchdb/cluster/cluster_down.bash @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker compose down + +rm -rf couch1data +rm -rf couch2data +rm -rf couch3data diff --git a/04_couchdb/cluster/cluster_up.bash b/04_couchdb/cluster/cluster_up.bash new file mode 100755 index 0000000..4885b83 --- /dev/null +++ b/04_couchdb/cluster/cluster_up.bash @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +mkdir -p couch1data +mkdir -p couch2data +mkdir -p couch3data + +docker build --file couch-cookie/Dockerfile --tag couch_cluster:latest couch-cookie +docker compose up -d + +sleep 15 +./setup_clustering.sh diff --git a/04_couchdb/cluster/couch-cookie/build.bash b/04_couchdb/cluster/couch-cookie/build.bash new file mode 100755 index 0000000..c4a5f3c --- /dev/null +++ b/04_couchdb/cluster/couch-cookie/build.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker build --tag couch_cluster:latest . \ No newline at end of file diff --git a/04_couchdb/connect_couchdb.bash b/04_couchdb/connect_couchdb.bash new file mode 100755 index 0000000..8950156 --- /dev/null +++ b/04_couchdb/connect_couchdb.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +#docker exec -it 7dbs_couch_db bash + +docker compose --file docker-compose-linux.yml exec couch bash diff --git a/04_couchdb/connect_curl.bash b/04_couchdb/connect_curl.bash new file mode 100755 index 0000000..5804aca --- /dev/null +++ b/04_couchdb/connect_curl.bash @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +# docker run -it --entrypoint sh --network 04_couchdb_default 04_couchdb_firstrun +docker compose --file docker-compose-linux.yml run --entrypoint sh firstrun diff --git a/04_couchdb/docker-compose-linux.yml b/04_couchdb/docker-compose-linux.yml new file mode 100644 index 0000000..4756ce0 --- /dev/null +++ b/04_couchdb/docker-compose-linux.yml @@ -0,0 +1,27 @@ +version: '3.1' + +services: + couch: + container_name: 7dbs_couch_db + hostname: 7dbs_couch_db + image: couchdb:2.3.1 + ports: + - 8084:5984 + restart: always + volumes: + - ./scripts:/tmp + environment: + COUCHDB_USER: couchdb + COUCHDB_PASSWORD: bouchdc + firstrun: + container_name: 7dbs_couch_firstrun + build: + context: couch-firstrun + dockerfile: Dockerfile + depends_on: + - couch + restart: "no" + environment: + COUCHDB_USER: couchdb + COUCHDB_PASSWORD: bouchdc + NODENAME: couch-single \ No newline at end of file diff --git a/04_couchdb/local_down.bash b/04_couchdb/local_down.bash new file mode 100755 index 0000000..4a12fc2 --- /dev/null +++ b/04_couchdb/local_down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker compose --file docker-compose-linux.yml down diff --git a/04_couchdb/local_up.bash b/04_couchdb/local_up.bash new file mode 100755 index 0000000..aa03e93 --- /dev/null +++ b/04_couchdb/local_up.bash @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting CouchDB..." +docker compose --file docker-compose-linux.yml up --detach + +>&2 echo "Opening GUI (Fauxton) at 'http://localhost:8084/_utils/#login'" diff --git a/05_neo4j/.gitignore b/05_neo4j/.gitignore new file mode 100644 index 0000000..5eb6531 --- /dev/null +++ b/05_neo4j/.gitignore @@ -0,0 +1,2 @@ +data/ +logs/ diff --git a/05_neo4j/docker-compose-linux.yml b/05_neo4j/docker-compose-linux.yml new file mode 100644 index 0000000..ce36ce7 --- /dev/null +++ b/05_neo4j/docker-compose-linux.yml @@ -0,0 +1,16 @@ +version: '3.1' + +services: + neo: + container_name: 7dbs_neo4j_db + hostname: 7dbs_neo4j_db + image: neo4j:3.5.8 + ports: + - 8085:7474 + - 7687:7687 + restart: always + volumes: + - ./data:/data + - ./logs:/logs + environment: + NEO4J_AUTH: neo4j/geo4a diff --git a/05_neo4j/local_clean.bash b/05_neo4j/local_clean.bash new file mode 100755 index 0000000..ee3c3a0 --- /dev/null +++ b/05_neo4j/local_clean.bash @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +# Because the files created inside the container may have have a different +# user id than the user outside the container, the user outside the container +# cannot delete the files in data and logs without elevated privileges. +# Instead, we again run the container, and delete from within the container +# with the same user id that created them. +docker compose --file docker-compose-linux.yml run --entrypoint rm neo -rf /data/* /logs/* +rm -rf data logs diff --git a/05_neo4j/local_down.bash b/05_neo4j/local_down.bash new file mode 100755 index 0000000..4a12fc2 --- /dev/null +++ b/05_neo4j/local_down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker compose --file docker-compose-linux.yml down diff --git a/05_neo4j/local_up.bash b/05_neo4j/local_up.bash new file mode 100755 index 0000000..c01c135 --- /dev/null +++ b/05_neo4j/local_up.bash @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting Neo4j..." +mkdir -p "data" +mkdir -p "logs" +docker compose --file docker-compose-linux.yml up --detach + +>&2 echo "Opening GUI at 'http://localhost:8085'" diff --git a/06_dynamodb/down.bash b/06_dynamodb/down.bash new file mode 100755 index 0000000..9644063 --- /dev/null +++ b/06_dynamodb/down.bash @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker stop 7dbs_dynamo_cli +docker rm 7dbs_dynamo_cli +docker compose down +docker network rm dynamo_net diff --git a/06_dynamodb/up.bash b/06_dynamodb/up.bash new file mode 100755 index 0000000..28ab355 --- /dev/null +++ b/06_dynamodb/up.bash @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting DynamoDB (local)..." +docker network create -d bridge --subnet 173.106.0.0/24 dynamo_net + +docker build -t aws-cli:1.16.173 ./aws_cli +docker compose up --detach + +>&2 echo "Opening dynamo-admin at 'http://localhost:8086'" + +>&2 echo "Connecting to the CLI..." +>&2 echo "All Dynamo commands need the following appended: --endpoint-url http://db:8000" +docker run \ + -it \ + --name 7dbs_dynamo_cli \ + --network dynamo_net \ + -e "AWS_ACCESS_KEY_ID=dummy" \ + -e "AWS_SECRET_ACCESS_KEY=dummy" \ + -e "AWS_DEFAULT_REGION=eu-west-1" \ + -e "AWS_DEFAULT_OUTPUT=json" \ + aws-cli:1.16.173 \ + sh diff --git a/07_redis/cluster/down.bash b/07_redis/cluster/down.bash new file mode 100755 index 0000000..63389f9 --- /dev/null +++ b/07_redis/cluster/down.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker compose -f docker-compose-cluster.yml down +docker compose down +docker network rm redis_net diff --git a/07_redis/cluster/up.bash b/07_redis/cluster/up.bash new file mode 100755 index 0000000..7b288de --- /dev/null +++ b/07_redis/cluster/up.bash @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting Redis Cluster..." +docker network create -d bridge --subnet 173.17.0.0/24 redis_net +docker compose up --detach + +>&2 echo "Attempting to Cluster Redis instances..." +docker compose -f docker-compose-cluster.yml up + +>&2 echo "Opening rebrow (for visual representation) at 'http://localhost:8097'" + +>&2 echo "Connecting to the CLI..." +# docker exec -it 7dbs_redis_db redis-cli diff --git a/07_redis/down.bash b/07_redis/down.bash new file mode 100755 index 0000000..ccc563c --- /dev/null +++ b/07_redis/down.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +docker compose down diff --git a/07_redis/up.bash b/07_redis/up.bash new file mode 100755 index 0000000..d9b286c --- /dev/null +++ b/07_redis/up.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd "${SCRIPT_DIR}" + +>&2 echo "Starting Redis..." +docker compose up --detach + +>&2 echo "Opening rebrow (for visual representation) at 'http://localhost:8087'" + +>&2 echo "Connecting to the CLI..." + +docker compose exec db redis-cli