diff --git a/deploy/docker-compose-new/deploy.sh b/deploy/docker-compose-new/deploy.sh index 63f6e33..4b8f7e3 100755 --- a/deploy/docker-compose-new/deploy.sh +++ b/deploy/docker-compose-new/deploy.sh @@ -4,10 +4,10 @@ DIR=$( cd "$(dirname "$0")" || exit; pwd -P ) ROOT_DIR=$DIR/../../ pushd "$ROOT_DIR" || exit -echo "Building Simulator..." -if [[ "$(docker images -q xmidt/simulator:latest 2> /dev/null)" == "" ]]; then - docker build -t xmidt/simulator:latest $ROOT_DIR/simulator -fi +# echo "Building Simulator..." +# if [[ "$(docker images -q xmidt/simulator:latest 2> /dev/null)" == "" ]]; then +# docker build -t xmidt/simulator:latest $ROOT_DIR/simulator +# fi popd echo "Running services..." @@ -25,29 +25,29 @@ if [[ $? -ne 0 ]]; then exit 1 fi -sleep 10 -AWS_ACCESS_KEY_ID=accessKey AWS_SECRET_ACCESS_KEY=secretKey aws dynamodb --endpoint-url http://localhost:8000 describe-table --table-name gifnoc --region us-east-2 --output text > /dev/null 2> /dev/null -if [[ $? -ne 0 ]]; then - AWS_ACCESS_KEY_ID=accessKey AWS_SECRET_ACCESS_KEY=secretKey aws dynamodb --endpoint-url http://localhost:8000 create-table \ - --table-name gifnoc \ - --attribute-definitions \ - AttributeName=bucket,AttributeType=S \ - AttributeName=expires,AttributeType=N \ - AttributeName=id,AttributeType=S \ - --key-schema \ - AttributeName=bucket,KeyType=HASH \ - AttributeName=id,KeyType=RANGE \ - --global-secondary-indexes \ - "[{\"IndexName\": \"Expires-index\",\"KeySchema\":[{\"AttributeName\":\"bucket\",\"KeyType\":\"HASH\"}, {\"AttributeName\":\"expires\",\"KeyType\":\"RANGE\"}], \ - \"ProvisionedThroughput\": {\"ReadCapacityUnits\": 10, \"WriteCapacityUnits\": 5 },\"Projection\":{\"ProjectionType\":\"ALL\"}}]" \ - --provisioned-throughput \ - ReadCapacityUnits=10,WriteCapacityUnits=5 \ - --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ - --region us-east-2 \ - --output text +# sleep 10 +# AWS_ACCESS_KEY_ID=accessKey AWS_SECRET_ACCESS_KEY=secretKey aws dynamodb --endpoint-url http://localhost:8000 describe-table --table-name gifnoc --region us-east-2 --output text > /dev/null 2> /dev/null +# if [[ $? -ne 0 ]]; then +# AWS_ACCESS_KEY_ID=accessKey AWS_SECRET_ACCESS_KEY=secretKey aws dynamodb --endpoint-url http://localhost:8000 create-table \ +# --table-name gifnoc \ +# --attribute-definitions \ +# AttributeName=bucket,AttributeType=S \ +# AttributeName=expires,AttributeType=N \ +# AttributeName=id,AttributeType=S \ +# --key-schema \ +# AttributeName=bucket,KeyType=HASH \ +# AttributeName=id,KeyType=RANGE \ +# --global-secondary-indexes \ +# "[{\"IndexName\": \"Expires-index\",\"KeySchema\":[{\"AttributeName\":\"bucket\",\"KeyType\":\"HASH\"}, {\"AttributeName\":\"expires\",\"KeyType\":\"RANGE\"}], \ +# \"ProvisionedThroughput\": {\"ReadCapacityUnits\": 10, \"WriteCapacityUnits\": 5 },\"Projection\":{\"ProjectionType\":\"ALL\"}}]" \ +# --provisioned-throughput \ +# ReadCapacityUnits=10,WriteCapacityUnits=5 \ +# --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ +# --region us-east-2 \ +# --output text - AWS_ACCESS_KEY_ID=accessKey AWS_SECRET_ACCESS_KEY=secretKey aws dynamodb \ - --endpoint-url http://localhost:8000 --region us-east-2 update-time-to-live \ - --table-name gifnoc --time-to-live-specification "Enabled=true, AttributeName=expires" \ - --output text -fi +# AWS_ACCESS_KEY_ID=accessKey AWS_SECRET_ACCESS_KEY=secretKey aws dynamodb \ +# --endpoint-url http://localhost:8000 --region us-east-2 update-time-to-live \ +# --table-name gifnoc --time-to-live-specification "Enabled=true, AttributeName=expires" \ +# --output text +# fi diff --git a/deploy/docker-compose-new/docker-compose.yml b/deploy/docker-compose-new/docker-compose.yml index 0f18fc5..78f97b8 100644 --- a/deploy/docker-compose-new/docker-compose.yml +++ b/deploy/docker-compose-new/docker-compose.yml @@ -7,7 +7,7 @@ services: depends_on: - dynamodb environment: - - "AWS_ENDPOINT=http://dynamodb:8000" + - "AWS_ENDPOINT=http://dynamodb:4566" - "TRACING_PROVIDER_NAME=zipkin" - "TRACING_PROVIDER_ENDPOINT=http://zipkin:9411/api/v2/spans" - "ACCESS_LEVEL_CAPABILITY=x1:issuer:test:.*:all" @@ -65,7 +65,14 @@ services: networks: - xmidt ports: - - "9000:9000" + - "4566:4566" + healthcheck: + test: + ["CMD-SHELL",'if [ "$(curl -s -o /dev/null -I -w ''%{http_code}'' http://localhost:4566)" == "400" ]; then exit 0; else exit 1; fi',] + interval: 5s + timeout: 30s + retries: 3 + start_period: 5s petasos: container_name: petasos depends_on: @@ -187,6 +194,28 @@ services: - xmidt ports: - "6100-6103:6100-6103" + awscli-dynamo: + image: amazon/aws-cli + networks: + - xmidt + depends_on: + dynamodb: + condition: service_healthy + ports: + - "4577:4577" + environment: + AWS_ACCESS_KEY_ID: accessKey + AWS_SECRET_ACCESS_KEY: secretKey + AWS_REGION: local + command: "dynamodb --endpoint-url http://dynamodb:4566 create-table \ + --table-name gifnoc \ + --attribute-definitions \ + AttributeName=bucket,AttributeType=S \ + AttributeName=expires,AttributeType=N \ + AttributeName=id,AttributeType=S \ + --key-schema \ + AttributeName=bucket,KeyType=HASH \ + AttributeName=id,KeyType=RANGE" zipkin: image: openzipkin/zipkin networks: