diff --git a/docker/docker-compose-manual-binaries.yml b/docker/docker-compose-manual-binaries.yml index 7cf0523..d330b07 100644 --- a/docker/docker-compose-manual-binaries.yml +++ b/docker/docker-compose-manual-binaries.yml @@ -120,12 +120,15 @@ services: volumes: - ./run_database_hammer.sh:/opt/run_database_hammer.sh:Z entrypoint: sh - replicas: 3 + deploy: + mode: replicated + replicas: 1 command: - /opt/run_database_hammer.sh depends_on: - - nwaku_postgres - - nwaku_sqlite + - postgres + networks: + - simulation waku-store-query-generator: image: ivansete/waku-store-request-maker:19e645 diff --git a/docker/run_database_hammer.sh b/docker/run_database_hammer.sh index a845a80..b33fd1d 100644 --- a/docker/run_database_hammer.sh +++ b/docker/run_database_hammer.sh @@ -3,23 +3,20 @@ ## This script is aimed to generate traffic to the database and simulate ## simulate multiple Waku nodes connected to the same database. -## Install the `dig` command -apk --no-cache add bind-tools - ## Install postgresql-client for psql command apk --no-cache add postgresql-client ## The port numbers and host names are defined in the 'docker-compose.yml' file -nwaku-postgres-IP=$(dig +short postgres) -target-postgres="http://${nwaku-postgres-IP}:5432" -echo "This is publisher: ${target-postgres}; ${target_sqlite}" +echo "This is database hammer" + +export PGPASSWORD=test123 +QUERY_LAST_FIVE_MINUTES=$(echo 'SELECT * FROM messages ORDER BY storedAt DESC LIMIT 100;') -query-last-five-minutes="SELECT storedAt, contentTopic, payload, pubsubTopic, version, timestamp, id FROM messages WHERE storedAt >= EXTRACT(EPOCH FROM (NOW() - INTERVAL '5 minutes')) * 1000 ORDER BY storedAt DESC;" while true do echo "Before making query" - psql -h ${nwaku-postgres-IP} -U postgres -W test123 -U postgres -c "${query-last-five-minutes}" + psql -h postgres -p 5432 -U postgres -U postgres -w -c "${QUERY_LAST_FIVE_MINUTES}" sleep 10 done