From 89bbdafc19abc7bd18ad1bb74c87b9c03f5cecee Mon Sep 17 00:00:00 2001 From: 1ambda <1amb4a@gmail.com> Date: Wed, 8 Dec 2021 08:40:55 +0900 Subject: [PATCH] feat: Add new compose file for aws storage --- Makefile | 24 ++++++++++++++++++ docker-compose.aws.yml | 49 ++++++++++++++++++++++++++++++++++++ docker-compose.metastore.yml | 4 +-- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 docker-compose.aws.yml diff --git a/Makefile b/Makefile index afe1a41..45b56b6 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,17 @@ compose.presto: compose.prepare -f docker-compose.presto.yml \ up --build +.PHONY: compose.aws +compose.aws: compose.aws + @ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose" + @ docker stop $(docker ps -a -q) || true + @ docker rm -f $(docker ps -a -q) || true + @ docker volume rm $(docker volume ls -f dangling=true -q) || true + @ docker compose -f docker-compose.aws.yml rm -fsv || true + @ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \ + -f docker-compose.aws.yml \ + up --build + .PHONY: compose.clean compose.clean: @ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Starting: Cleaning docker resources" @@ -85,6 +96,19 @@ compose.clean: @ echo "\n-----------------------------------------" @ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Finished: Cleaning docker resources" +.PHONY: compose.storage-all +compose.storage-all: compose.storage-all + @ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose" + @ docker stop $(docker ps -a -q) || true + @ docker rm -f $(docker ps -a -q) || true + @ docker volume rm $(docker volume ls -f dangling=true -q) || true + @ docker compose -f docker-compose.aws.yml rm -fsv || true + @ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \ + -f docker-compose.storage.yml \ + -f docker-compose.aws.yml \ + -f docker-compose.kafka.yml \ + up --build + ## ## Storage CLIs ## diff --git a/docker-compose.aws.yml b/docker-compose.aws.yml new file mode 100644 index 0000000..d4c0ab2 --- /dev/null +++ b/docker-compose.aws.yml @@ -0,0 +1,49 @@ +version: '3.7' +services: + dynamodb-local: + image: amazon/dynamodb-local:latest + container_name: dynamodb-local + ports: + - "8000:8000" + + dynamodb-admin: + image: aaronshaf/dynamodb-admin + ports: + - "8001:8001" + environment: + DYNAMO_ENDPOINT: "http://dynamodb-local:8000" + AWS_REGION: "ap-northeast-2" + AWS_ACCESS_KEY_ID: accesskey + AWS_SECRET_ACCESS_KEY: secretkey + depends_on: + - dynamodb-local + + minio: + image: minio/minio:latest + container_name: minio + environment: + - MINIO_ACCESS_KEY=accesskey + - MINIO_SECRET_KEY=secretkey + - MINIO_ROOT_USER=admin + - MINIO_ROOT_PASSWORD=admin12345 + volumes: + - ./_volume/docker-minio:/data + ports: + - "9000:9000" + - "9001:9001" + command: server /data --console-address ":9001" + + minio-script: + image: minio/mc + container_name: minio-script + depends_on: + - minio + entrypoint: > + /bin/sh -c " + sleep 10s; + /usr/bin/mc alias set myminio http://minio:9000 admin admin12345; + /usr/bin/mc mb myminio/udon-data-lake || true; + /usr/bin/mc admin user add myminio accesskey accesskey || true; + /usr/bin/mc admin policy set myminio readwrite user=accesskey || true; + exit 0; + " diff --git a/docker-compose.metastore.yml b/docker-compose.metastore.yml index 7c098a3..13fd213 100644 --- a/docker-compose.metastore.yml +++ b/docker-compose.metastore.yml @@ -44,8 +44,8 @@ services: /bin/sh -c " /usr/bin/mc alias set myminio http://minio:9000 admin admin12345; /usr/bin/mc mb myminio/udon-data-lake || true; - /usr/bin/mc admin user add myminio accesskey secretkey || true; - /usr/bin/mc admin policy set myminio readwrite user=accesskey || true; + /usr/bin/mc admin user add myminio accesskey accesskey || true; + /usr/bin/mc admin policy set myminio readwrite user=secretkey || true; exit 0; "