diff --git a/.env b/.env index 2186a513b1..95d01c4ab8 100644 --- a/.env +++ b/.env @@ -197,7 +197,7 @@ ENABLE_STORAGE_PROVIDER=true CLOUD_STORAGE_PROVIDER_NAME=aws # AWS S3 (replace with your own configuration and credentials) -AWS_ACCESS_KEY_ID=test-key -AWS_SECRET_ACCESS_KEY=test-secret +AWS_ACCESS_KEY_ID=test +AWS_SECRET_ACCESS_KEY=test AWS_REGION=eu-west-1 AWS_BUCKET_NAME=sample-bucket diff --git a/docker-compose.localstack.yml b/docker-compose.localstack.yml index 40930d65b7..f17af893a0 100644 --- a/docker-compose.localstack.yml +++ b/docker-compose.localstack.yml @@ -2,15 +2,12 @@ version: '3.4' services: localstack: container_name: local_stack - image: localstack/localstack + image: localstack/localstack:3.3 network_mode: bridge environment: - SERVICES=s3 # we only need s3 bucket - DEBUG=1 - - DEFAULT_REGION=${AWS_REGION} - - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} - - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} - - LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT} + - LOCALSTACK_HOST=${LOCALSTACK_HOST} ports: - 4566:4566 volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 961989233b..582718fb1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,9 @@ services: - ACCOUNT_URI=${COLOSSUS_1_TRANSACTOR_URI} - OTEL_EXPORTER_OTLP_ENDPOINT=${TELEMETRY_ENDPOINT} - OTEL_RESOURCE_ATTRIBUTES=service.name=colossus-1,deployment.environment=production + - AWS_BUCKET_NAME=test-bucket-1 + - LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT} + - LOCALSTACK_ENABLED=${LOCALSTACK_ENABLED} entrypoint: ['/joystream/entrypoints/storage.sh'] command: [ @@ -114,6 +117,9 @@ services: environment: # ACCOUNT_URI overrides command line arg --accountUri - ACCOUNT_URI=${COLOSSUS_2_TRANSACTOR_URI} + - AWS_BUCKET_NAME=test-bucket-2 + - LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT} + - LOCALSTACK_ENABLED=${LOCALSTACK_ENABLED} entrypoint: ['yarn', 'storage-node'] command: [ diff --git a/tests/network-tests/.gitignore b/tests/network-tests/.gitignore index a98fa023c0..9e7dcaacd5 100644 --- a/tests/network-tests/.gitignore +++ b/tests/network-tests/.gitignore @@ -1,3 +1,4 @@ output.json data/ **/generated/* +.venv/ \ No newline at end of file diff --git a/tests/network-tests/run-tests.sh b/tests/network-tests/run-tests.sh index 2f6cf61106..beae3217f0 100755 --- a/tests/network-tests/run-tests.sh +++ b/tests/network-tests/run-tests.sh @@ -17,16 +17,15 @@ function cleanup() { if [ "${NO_STORAGE}" != true ]; then docker-compose -f ../../docker-compose.storage-squid.yml down -v + docker-compose -f ../../docker-compose.localstack.yml down -v fi docker-compose -f ../../docker-compose.yml down -v - docker-compose -f ../../docker-compose.localstack.yml down -v } trap cleanup EXIT ERR SIGINT SIGTERM -export JOYSTREAM_NODE_TAG=${JOYSTREAM_NODE_TAG:-latest} -RUNTIME_PROFILE=TESTING ../../scripts/runtime-code-shasum.sh +export JOYSTREAM_NODE_TAG=`RUNTIME_PROFILE=TESTING ../../scripts/runtime-code-shasum.sh` CHAIN=dev docker compose -f ../../docker-compose.yml up -d joystream-node sleep 30 diff --git a/tests/network-tests/start-storage.sh b/tests/network-tests/start-storage.sh index addbfa9948..8e6eb5cffb 100755 --- a/tests/network-tests/start-storage.sh +++ b/tests/network-tests/start-storage.sh @@ -6,32 +6,38 @@ TMP=$0 THIS_DIR=$(dirname $TMP) echo "Staring storage infrastructure" -export LOCALSTACK_ENABLED=true # Start Storage-Squid docker-compose -f $THIS_DIR/../../docker-compose.storage-squid.yml up -d -HOST_IP=$($THIS_DIR/get-host-ip.sh) +HOST_IP=`$THIS_DIR/get-host-ip.sh` export COLOSSUS_1_URL="http://${HOST_IP}:3333" export DISTRIBUTOR_1_URL="http://${HOST_IP}:3334" export COLOSSUS_2_URL="http://${HOST_IP}:3335" export DISTRIBUTOR_2_URL="http://${HOST_IP}:3336" -export LOCALSTACK_ENDPOINT="http://${HOST_IP}:4566" $THIS_DIR/run-test-scenario.sh initStorageAndDistribution # give QN time to catch up so nodes can get their initial state sleep 30 +# Start localstack if ENABLE_LOCALSTACK is set to true +export LOCALSTACK_ENABLED=true +export LOCALSTACK_HOST="${HOST_IP}:4566" +export LOCALSTACK_ENDPOINT="http://${LOCALSTACK_HOST}" +docker-compose -f $THIS_DIR/../../docker-compose.localstack.yml up -d localstack && sleep 15 +python3 -m venv .venv +pip install awscli-local +source .venv/bin/activate +awslocal s3api create-bucket --bucket test-bucket-1 --endpoint ${LOCALSTACK_ENDPOINT} +awslocal s3api create-bucket --bucket test-bucket-2 --endpoint ${LOCALSTACK_ENDPOINT} +deactivate + # Start colossus & argus docker-compose -f $THIS_DIR/../../docker-compose.yml up -d colossus-1 docker-compose -f $THIS_DIR/../../docker-compose.yml up -d distributor-1 docker-compose -f $THIS_DIR/../../docker-compose.yml up -d colossus-2 docker-compose -f $THIS_DIR/../../docker-compose.yml up -d distributor-2 -# Start localstack if ENABLE_LOCALSTACK is set to true -docker-compose -f $THIS_DIR/../../docker-compose.localstack.yml up -d localstack -awslocal s3api create-bucket --bucket $AWS_BUCKET_NAME --endpoint http://localhost:4566 - # allow a few seconds for nodes to startup and display first few log entries # to help debug tests sleep 30