diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml index 39b93decf2..d3af692bc0 100644 --- a/.github/workflows/performance-tests.yml +++ b/.github/workflows/performance-tests.yml @@ -6,6 +6,10 @@ concurrency: on: pull_request: + types: + - opened + - edited + - synchronize push: branches: - "main" @@ -55,7 +59,7 @@ jobs: sed -i.bak "s/AGENT_VERSION=.*/AGENT_VERSION=${AGENT_VERSION}/" "${ENV_FILE}" && rm -f "${ENV_FILE}.bak" cat "${ENV_FILE}" - - name: Start services for issuer + - name: Start services for issuer holder and verifier env: PORT: 8080 ADMIN_TOKEN: admin @@ -64,48 +68,16 @@ jobs: API_KEY_AUTO_PROVISIONING: false API_KEY_ENABLED: true DOCKERHOST: "host.docker.internal" - PG_PORT: 5432 + ISSUER_PORT: 8080 + HOLDER_PORT: 8090 + VERIFIER_PORT: 8100 NODE_REFRESH_AND_SUBMIT_PERIOD: 1s NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: 1s NODE_WALLET_MAX_TPS: 1000 uses: hoverkraft-tech/compose-action@v2.0.0 with: - compose-file: "./infrastructure/shared/docker-compose.yml" - compose-flags: "--env-file ./infrastructure/local/.env -p issuer" - up-flags: "--wait" - down-flags: "--volumes" - - - name: Start services for holder - env: - PORT: 8090 - ADMIN_TOKEN: admin - DEFAULT_WALLET_ENABLED: true - DEFAULT_WALLET_AUTH_API_KEY: default - API_KEY_AUTO_PROVISIONING: false - API_KEY_ENABLED: true - DOCKERHOST: "host.docker.internal" - PG_PORT: 5433 - uses: isbang/compose-action@v1.4.1 - with: - compose-file: "./infrastructure/shared/docker-compose.yml" - compose-flags: "--env-file ./infrastructure/local/.env -p holder" - up-flags: "--wait" - down-flags: "--volumes" - - - name: Start services for verifier - env: - PORT: 8100 - ADMIN_TOKEN: admin - DEFAULT_WALLET_ENABLED: true - DEFAULT_WALLET_AUTH_API_KEY: default - API_KEY_AUTO_PROVISIONING: false - API_KEY_ENABLED: true - DOCKERHOST: "host.docker.internal" - PG_PORT: 5434 - uses: isbang/compose-action@v1.4.1 - with: - compose-file: "./infrastructure/shared/docker-compose.yml" - compose-flags: "--env-file ./infrastructure/local/.env -p verifier" + compose-file: "./infrastructure/shared/docker-compose-combined.yml" + compose-flags: "--env-file ./infrastructure/local/.env" up-flags: "--wait" down-flags: "--volumes" diff --git a/infrastructure/shared/apisix/conf/apisix-holder.yaml b/infrastructure/shared/apisix/conf/apisix-holder.yaml new file mode 100644 index 0000000000..6da5996d67 --- /dev/null +++ b/infrastructure/shared/apisix/conf/apisix-holder.yaml @@ -0,0 +1,44 @@ +plugins: + - name: proxy-rewrite + - name: cors + +routes: + - uri: /cloud-agent/* + upstream_id: 4 + plugins: + cors: + allow_origins: "*" + proxy-rewrite: + regex_uri: ["^/cloud-agent/(.*)", "/$1"] + - uri: /docs/cloud-agent/api/* + upstream_id: 4 + plugins: + proxy-rewrite: + regex_uri: ["^/docs/cloud-agent/api/(.*)", "/docs/$1"] + - uri: /didcomm* + upstream_id: 3 + plugins: + cors: + allow_origins: "*" + proxy-rewrite: + regex_uri: ["^/didcomm(.*)", "/$1"] + - uri: /apidocs/* + upstream_id: 5 + plugins: + proxy-rewrite: + regex_uri: ["^/apidocs/(.*)", "/$1"] + +upstreams: + - id: 3 + nodes: + "cloud-agent-holder:8090": 1 # didcom and system + type: roundrobin + - id: 4 + nodes: + "cloud-agent-holder:8085": 1 # tapir + type: roundrobin + - id: 5 + nodes: + "swagger-ui-holder:8080": 1 + type: roundrobin + #END diff --git a/infrastructure/shared/apisix/conf/apisix-issuer.yaml b/infrastructure/shared/apisix/conf/apisix-issuer.yaml new file mode 100644 index 0000000000..8b8b7a4181 --- /dev/null +++ b/infrastructure/shared/apisix/conf/apisix-issuer.yaml @@ -0,0 +1,44 @@ +plugins: + - name: proxy-rewrite + - name: cors + +routes: + - uri: /cloud-agent/* + upstream_id: 4 + plugins: + cors: + allow_origins: "*" + proxy-rewrite: + regex_uri: ["^/cloud-agent/(.*)", "/$1"] + - uri: /docs/cloud-agent/api/* + upstream_id: 4 + plugins: + proxy-rewrite: + regex_uri: ["^/docs/cloud-agent/api/(.*)", "/docs/$1"] + - uri: /didcomm* + upstream_id: 3 + plugins: + cors: + allow_origins: "*" + proxy-rewrite: + regex_uri: ["^/didcomm(.*)", "/$1"] + - uri: /apidocs/* + upstream_id: 5 + plugins: + proxy-rewrite: + regex_uri: ["^/apidocs/(.*)", "/$1"] + +upstreams: + - id: 3 + nodes: + "cloud-agent-issuer:8090": 1 # didcom and system + type: roundrobin + - id: 4 + nodes: + "cloud-agent-issuer:8085": 1 # tapir + type: roundrobin + - id: 5 + nodes: + "swagger-ui-issuer:8080": 1 + type: roundrobin + #END diff --git a/infrastructure/shared/apisix/conf/apisix-verifier.yaml b/infrastructure/shared/apisix/conf/apisix-verifier.yaml new file mode 100644 index 0000000000..de43f6dede --- /dev/null +++ b/infrastructure/shared/apisix/conf/apisix-verifier.yaml @@ -0,0 +1,44 @@ +plugins: + - name: proxy-rewrite + - name: cors + +routes: + - uri: /cloud-agent/* + upstream_id: 4 + plugins: + cors: + allow_origins: "*" + proxy-rewrite: + regex_uri: ["^/cloud-agent/(.*)", "/$1"] + - uri: /docs/cloud-agent/api/* + upstream_id: 4 + plugins: + proxy-rewrite: + regex_uri: ["^/docs/cloud-agent/api/(.*)", "/docs/$1"] + - uri: /didcomm* + upstream_id: 3 + plugins: + cors: + allow_origins: "*" + proxy-rewrite: + regex_uri: ["^/didcomm(.*)", "/$1"] + - uri: /apidocs/* + upstream_id: 5 + plugins: + proxy-rewrite: + regex_uri: ["^/apidocs/(.*)", "/$1"] + +upstreams: + - id: 3 + nodes: + "cloud-agent-verifier:8090": 1 # didcom and system + type: roundrobin + - id: 4 + nodes: + "cloud-agent-verifier:8085": 1 # tapir + type: roundrobin + - id: 5 + nodes: + "swagger-ui-verifier:8080": 1 + type: roundrobin + #END diff --git a/infrastructure/shared/docker-compose-combined.yml b/infrastructure/shared/docker-compose-combined.yml new file mode 100644 index 0000000000..63db01d433 --- /dev/null +++ b/infrastructure/shared/docker-compose-combined.yml @@ -0,0 +1,359 @@ +--- +version: "3.8" + +services: + ########################## + # Database + ########################## + node-db: + image: postgres:13 + environment: + POSTGRES_MULTIPLE_DATABASES: "node_db" + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + volumes: + - pg_data_node_db:/var/lib/postgresql/data + - ./postgres/init-script.sh:/docker-entrypoint-initdb.d/init-script.sh + - ./postgres/max_conns.sql:/docker-entrypoint-initdb.d/max_conns.sql + ports: + - "127.0.0.1:5431:5432" + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres", "-d", "node_db"] + interval: 10s + timeout: 5s + retries: 5 + + issuer-db: + image: postgres:13 + environment: + POSTGRES_MULTIPLE_DATABASES: "pollux,connect,agent" + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + volumes: + - pg_data_issuer_db:/var/lib/postgresql/data + - ./postgres/init-script.sh:/docker-entrypoint-initdb.d/init-script.sh + - ./postgres/max_conns.sql:/docker-entrypoint-initdb.d/max_conns.sql + ports: + - "127.0.0.1:5432:5432" + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres", "-d", "agent"] + interval: 10s + timeout: 5s + retries: 5 + + holder-db: + image: postgres:13 + environment: + POSTGRES_MULTIPLE_DATABASES: "pollux,connect,agent" + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + volumes: + - pg_data_holder_db:/var/lib/postgresql/data + - ./postgres/init-script.sh:/docker-entrypoint-initdb.d/init-script.sh + - ./postgres/max_conns.sql:/docker-entrypoint-initdb.d/max_conns.sql + ports: + - "127.0.0.1:5433:5432" + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres", "-d", "agent"] + interval: 10s + timeout: 5s + retries: 5 + + verifier-db: + image: postgres:13 + environment: + POSTGRES_MULTIPLE_DATABASES: "pollux,connect,agent" + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + volumes: + - pg_data_verifier_db:/var/lib/postgresql/data + - ./postgres/init-script.sh:/docker-entrypoint-initdb.d/init-script.sh + - ./postgres/max_conns.sql:/docker-entrypoint-initdb.d/max_conns.sql + ports: + - "127.0.0.1:5434:5432" + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres", "-d", "agent"] + interval: 10s + timeout: 5s + retries: 5 + + # pgadmin: + # image: dpage/pgadmin4 + # environment: + # PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} + # PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} + # PGADMIN_CONFIG_SERVER_MODE: "False" + # volumes: + # - pgadmin:/var/lib/pgadmin + # ports: + # - "127.0.0.1:${PGADMIN_PORT:-5050}:80" + # depends_on: + # db: + # condition: service_healthy + # profiles: + # - debug + + ########################## + # Services + ########################## + + prism-node: + image: ghcr.io/input-output-hk/prism-node:${PRISM_NODE_VERSION} + environment: + NODE_PSQL_HOST: node-db:5432 + NODE_REFRESH_AND_SUBMIT_PERIOD: + NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: + NODE_WALLET_MAX_TPS: + depends_on: + node-db: + condition: service_healthy + + vault-server: + image: hashicorp/vault:latest + # ports: + # - "8200:8200" + environment: + VAULT_ADDR: "http://0.0.0.0:8200" + VAULT_DEV_ROOT_TOKEN_ID: ${VAULT_DEV_ROOT_TOKEN_ID} + command: server -dev -dev-root-token-id=${VAULT_DEV_ROOT_TOKEN_ID} + cap_add: + - IPC_LOCK + healthcheck: + test: ["CMD", "vault", "status"] + interval: 10s + timeout: 5s + retries: 5 + + cloud-agent-issuer: + image: ghcr.io/hyperledger/identus-cloud-agent:${AGENT_VERSION} + environment: + POLLUX_DB_HOST: issuer-db + POLLUX_DB_PORT: 5432 + POLLUX_DB_NAME: pollux + POLLUX_DB_USER: postgres + POLLUX_DB_PASSWORD: postgres + CONNECT_DB_HOST: issuer-db + CONNECT_DB_PORT: 5432 + CONNECT_DB_NAME: connect + CONNECT_DB_USER: postgres + CONNECT_DB_PASSWORD: postgres + AGENT_DB_HOST: issuer-db + AGENT_DB_PORT: 5432 + AGENT_DB_NAME: agent + AGENT_DB_USER: postgres + AGENT_DB_PASSWORD: postgres + POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL: http://${DOCKERHOST}:${ISSUER_PORT}/cloud-agent + DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${ISSUER_PORT}/didcomm + REST_SERVICE_URL: http://${DOCKERHOST}:${ISSUER_PORT}/cloud-agent + PRISM_NODE_HOST: prism-node + PRISM_NODE_PORT: 50053 + VAULT_ADDR: ${VAULT_ADDR:-http://vault-server:8200} + VAULT_TOKEN: ${VAULT_DEV_ROOT_TOKEN_ID:-root} + SECRET_STORAGE_BACKEND: postgres + DEV_MODE: true + DEFAULT_WALLET_ENABLED: + DEFAULT_WALLET_SEED: + DEFAULT_WALLET_WEBHOOK_URL: + DEFAULT_WALLET_WEBHOOK_API_KEY: + DEFAULT_WALLET_AUTH_API_KEY: + GLOBAL_WEBHOOK_URL: + GLOBAL_WEBHOOK_API_KEY: + WEBHOOK_PARALLELISM: + ADMIN_TOKEN: + API_KEY_SALT: + API_KEY_ENABLED: + API_KEY_AUTHENTICATE_AS_DEFAULT_USER: + API_KEY_AUTO_PROVISIONING: + depends_on: + issuer-db: + condition: service_healthy + prism-node: + condition: service_started + vault-server: + condition: service_healthy + healthcheck: + test: + ["CMD", "curl", "-f", "http://cloud-agent-issuer:8085/_system/health"] + interval: 30s + timeout: 10s + retries: 5 + extra_hosts: + - "host.docker.internal:host-gateway" + + swagger-ui-issuer: + image: swaggerapi/swagger-ui:v5.1.0 + environment: + - 'URLS=[ + { name: "Cloud Agent", url: "/docs/cloud-agent/api/docs.yaml" } + ]' + + apisix-issuer: + image: apache/apisix:2.15.0-alpine + volumes: + - ./apisix/conf/apisix-issuer.yaml:/usr/local/apisix/conf/apisix.yaml:ro + - ./apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro + ports: + - "${ISSUER_PORT}:9080/tcp" + depends_on: + - cloud-agent-issuer + - swagger-ui-issuer + + cloud-agent-holder: + image: ghcr.io/hyperledger/identus-cloud-agent:${AGENT_VERSION} + environment: + POLLUX_DB_HOST: holder-db + POLLUX_DB_PORT: 5432 + POLLUX_DB_NAME: pollux + POLLUX_DB_USER: postgres + POLLUX_DB_PASSWORD: postgres + CONNECT_DB_HOST: holder-db + CONNECT_DB_PORT: 5432 + CONNECT_DB_NAME: connect + CONNECT_DB_USER: postgres + CONNECT_DB_PASSWORD: postgres + AGENT_DB_HOST: holder-db + AGENT_DB_PORT: 5432 + AGENT_DB_NAME: agent + AGENT_DB_USER: postgres + AGENT_DB_PASSWORD: postgres + POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL: http://${DOCKERHOST}:${HOLDER_PORT}/cloud-agent + DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${HOLDER_PORT}/didcomm + REST_SERVICE_URL: http://${DOCKERHOST}:${HOLDER_PORT}/cloud-agent + PRISM_NODE_HOST: prism-node + PRISM_NODE_PORT: 50053 + VAULT_ADDR: ${VAULT_ADDR:-http://vault-server:8200} + VAULT_TOKEN: ${VAULT_DEV_ROOT_TOKEN_ID:-root} + SECRET_STORAGE_BACKEND: postgres + DEV_MODE: true + DEFAULT_WALLET_ENABLED: + DEFAULT_WALLET_SEED: + DEFAULT_WALLET_WEBHOOK_URL: + DEFAULT_WALLET_WEBHOOK_API_KEY: + DEFAULT_WALLET_AUTH_API_KEY: + GLOBAL_WEBHOOK_URL: + GLOBAL_WEBHOOK_API_KEY: + WEBHOOK_PARALLELISM: + ADMIN_TOKEN: + API_KEY_SALT: + API_KEY_ENABLED: + API_KEY_AUTHENTICATE_AS_DEFAULT_USER: + API_KEY_AUTO_PROVISIONING: + depends_on: + holder-db: + condition: service_healthy + prism-node: + condition: service_started + vault-server: + condition: service_healthy + healthcheck: + test: + ["CMD", "curl", "-f", "http://cloud-agent-holder:8085/_system/health"] + interval: 30s + timeout: 10s + retries: 5 + extra_hosts: + - "host.docker.internal:host-gateway" + + swagger-ui-holder: + image: swaggerapi/swagger-ui:v5.1.0 + environment: + - 'URLS=[ + { name: "Cloud Agent", url: "/docs/cloud-agent/api/docs.yaml" } + ]' + + apisix-holder: + image: apache/apisix:2.15.0-alpine + volumes: + - ./apisix/conf/apisix-holder.yaml:/usr/local/apisix/conf/apisix.yaml:ro + - ./apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro + ports: + - "${HOLDER_PORT}:9080/tcp" + depends_on: + - cloud-agent-holder + - swagger-ui-holder + + cloud-agent-verifier: + image: ghcr.io/hyperledger/identus-cloud-agent:${AGENT_VERSION} + environment: + POLLUX_DB_HOST: verifier-db + POLLUX_DB_PORT: 5432 + POLLUX_DB_NAME: pollux + POLLUX_DB_USER: postgres + POLLUX_DB_PASSWORD: postgres + CONNECT_DB_HOST: verifier-db + CONNECT_DB_PORT: 5432 + CONNECT_DB_NAME: connect + CONNECT_DB_USER: postgres + CONNECT_DB_PASSWORD: postgres + AGENT_DB_HOST: verifier-db + AGENT_DB_PORT: 5432 + AGENT_DB_NAME: agent + AGENT_DB_USER: postgres + AGENT_DB_PASSWORD: postgres + POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL: http://${DOCKERHOST}:${VERIFIER_PORT}/cloud-agent + DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${VERIFIER_PORT}/didcomm + REST_SERVICE_URL: http://${DOCKERHOST}:${VERIFIER_PORT}/cloud-agent + PRISM_NODE_HOST: prism-node + PRISM_NODE_PORT: 50053 + VAULT_ADDR: ${VAULT_ADDR:-http://vault-server:8200} + VAULT_TOKEN: ${VAULT_DEV_ROOT_TOKEN_ID:-root} + SECRET_STORAGE_BACKEND: postgres + DEV_MODE: true + DEFAULT_WALLET_ENABLED: + DEFAULT_WALLET_SEED: + DEFAULT_WALLET_WEBHOOK_URL: + DEFAULT_WALLET_WEBHOOK_API_KEY: + DEFAULT_WALLET_AUTH_API_KEY: + GLOBAL_WEBHOOK_URL: + GLOBAL_WEBHOOK_API_KEY: + WEBHOOK_PARALLELISM: + ADMIN_TOKEN: + API_KEY_SALT: + API_KEY_ENABLED: + API_KEY_AUTHENTICATE_AS_DEFAULT_USER: + API_KEY_AUTO_PROVISIONING: + depends_on: + verifier-db: + condition: service_healthy + prism-node: + condition: service_started + vault-server: + condition: service_healthy + healthcheck: + test: + ["CMD", "curl", "-f", "http://cloud-agent-verifier:8085/_system/health"] + interval: 30s + timeout: 10s + retries: 5 + extra_hosts: + - "host.docker.internal:host-gateway" + + swagger-ui-verifier: + image: swaggerapi/swagger-ui:v5.1.0 + environment: + - 'URLS=[ + { name: "Cloud Agent", url: "/docs/cloud-agent/api/docs.yaml" } + ]' + + apisix-verifier: + image: apache/apisix:2.15.0-alpine + volumes: + - ./apisix/conf/apisix-verifier.yaml:/usr/local/apisix/conf/apisix.yaml:ro + - ./apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro + ports: + - "${VERIFIER_PORT}:9080/tcp" + depends_on: + - cloud-agent-verifier + - swagger-ui-verifier + +volumes: + pg_data_node_db: + pg_data_issuer_db: + pg_data_holder_db: + pg_data_verifier_db: + # pgadmin: + # Temporary commit network setting due to e2e CI bug + # to be enabled later after debugging + #networks: + # default: + # name: ${NETWORK} diff --git a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala index 8fdcc7cd57..257fc3b604 100644 --- a/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala +++ b/pollux/core/src/main/scala/org/hyperledger/identus/pollux/core/service/CredentialServiceImpl.scala @@ -1205,7 +1205,7 @@ class CredentialServiceImpl( maybeId = None, `type` = Set("VerifiableCredential"), // TODO: This information should come from Schema registry by record.schemaId - issuer = CredentialIssuer(jwtIssuer.did.toString, `type` = "Profile"), + issuer = CredentialIssuer(issuingDID.did.toString, `type` = "Profile"), issuanceDate = issuanceDate, maybeExpirationDate = record.validityPeriod.map(sec => issuanceDate.plusSeconds(sec.toLong)), maybeCredentialSchema = record.schemaUris.map(ids => diff --git a/tests/integration-tests/src/test/kotlin/steps/proofs/JwtProofSteps.kt b/tests/integration-tests/src/test/kotlin/steps/proofs/JwtProofSteps.kt index 7e70708b41..89a43232c1 100644 --- a/tests/integration-tests/src/test/kotlin/steps/proofs/JwtProofSteps.kt +++ b/tests/integration-tests/src/test/kotlin/steps/proofs/JwtProofSteps.kt @@ -36,7 +36,7 @@ class JwtProofSteps { @When("{actor} sends a request for jwt proof from trustedIssuer {actor} using {} schema presentation to {actor}") fun verifierSendsARequestForJwtProofPresentationToHolderUsingSchemaFromTrustedIssuer(verifier: Actor, issuer: Actor, schema: CredentialSchema, holder: Actor) { val verifierConnectionToHolder = verifier.recall("connection-with-${holder.name}").connectionId - val trustIssuer = issuer.recall("longFormDid") + val trustIssuer = issuer.recall("shortFormDid") val baseUrl = issuer.recall("baseUrl") val schemaGuid = issuer.recall(schema.name)!! val schemaId = "$baseUrl/schema-registry/schemas/$schemaGuid" diff --git a/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature b/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature index 8c627d03d9..b9ffebb5d7 100644 --- a/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature +++ b/tests/integration-tests/src/test/resources/features/credential/jwt/present_proof.feature @@ -25,6 +25,7 @@ Feature: Present Proof Protocol And Holder rejects the proof Then Holder sees the proof is rejected + @RunThis Scenario Outline: Verifying jwt credential using assertion Given Issuer and Holder have an existing connection And Verifier and Holder have an existing connection @@ -32,7 +33,8 @@ Feature: Present Proof Protocol When Issuer prepares a custom PRISM DID And Issuer adds a '' key for 'assertionMethod' purpose with '' name to the custom PRISM DID And Issuer creates the custom PRISM DID - When Issuer offers a jwt credential to Holder with 'long' form DID using issuingKid '' + And Issuer publishes DID to ledger + When Issuer offers a jwt credential to Holder with 'short' form DID using issuingKid '' And Holder receives the credential offer And Holder accepts jwt credential offer using 'auth-1' key id And Issuer issues the credential diff --git a/tests/performance-tests/agent-performance-tests-k6/.env b/tests/performance-tests/agent-performance-tests-k6/.env index 24d8296cbe..1012476784 100644 --- a/tests/performance-tests/agent-performance-tests-k6/.env +++ b/tests/performance-tests/agent-performance-tests-k6/.env @@ -1,3 +1,3 @@ -AGENT_VERSION=1.39.1-SNAPSHOT +AGENT_VERSION=1.40.1-SNAPSHOT PRISM_NODE_VERSION=2.5.0 VAULT_DEV_ROOT_TOKEN_ID=root diff --git a/tests/performance-tests/agent-performance-tests-k6/run.sh b/tests/performance-tests/agent-performance-tests-k6/run.sh index b836832198..13109e62fe 100755 --- a/tests/performance-tests/agent-performance-tests-k6/run.sh +++ b/tests/performance-tests/agent-performance-tests-k6/run.sh @@ -6,125 +6,65 @@ set -e ENV_FILE=".env" PERF_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) AGENT_DIR="$PERF_DIR/../../.." -DOCKERFILE="$AGENT_DIR/infrastructure/shared/docker-compose.yml" +DOCKERFILE="$AGENT_DIR/infrastructure/shared/docker-compose-combined.yml" K6_URL="https://github.com/grafana/k6/releases/download/v0.45.0/k6-v0.45.0-macos-arm64.zip" K6_ZIP_FILE="$(basename ${K6_URL})" # Functions -function startAgent() { - echo "Starting [$NAME] agent" - PORT="${PORT}" \ - ADMIN_TOKEN="${ADMIN_TOKEN}" \ - DEFAULT_WALLET_ENABLED="${DEFAULT_WALLET_ENABLED}" \ - DEFAULT_WALLET_AUTH_API_KEY="${DEFAULT_WALLET_AUTH_API_KEY}" \ - API_KEY_AUTO_PROVISIONING="${API_KEY_AUTO_PROVISIONING}" \ - API_KEY_ENABLED="${API_KEY_ENABLED}" \ - DOCKERHOST="${DOCKERHOST}" \ - PG_PORT="${PG_PORT}" \ - NODE_REFRESH_AND_SUBMIT_PERIOD="${NODE_REFRESH_AND_SUBMIT_PERIOD}" \ - NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="${NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD}" \ - NODE_WALLET_MAX_TPS="${NODE_WALLET_MAX_TPS}" \ - docker compose -p "${NAME}" -f "${DOCKERFILE}" \ - --env-file "${ENV_FILE}" up -d --wait 2>/dev/null - echo "Agent [$NAME] healthy" -} +function startAllAgents() { + echo "Starting agents" -function stopAgent() { - echo "Stopping [${NAME}] agent" - PORT="${PORT}" \ - DOCKERHOST="${DOCKERHOST}" \ - docker compose \ - -p "${NAME}" \ - -f "${DOCKERFILE}" \ - --env-file "${ENV_FILE}" down -v 2>/dev/null - echo "Agent [${NAME}] stopped" -} - -function createIssuer() { - local NAME="issuer" - local PORT=8080 - local ADMIN_TOKEN=admin - local DEFAULT_WALLET_ENABLED=true - local DEFAULT_WALLET_AUTH_API_KEY=default - local API_KEY_AUTO_PROVISIONING=false - local API_KEY_ENABLED=true local DOCKERHOST="host.docker.internal" - local PG_PORT=5432 local NODE_REFRESH_AND_SUBMIT_PERIOD="1s" local NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="1s" local NODE_WALLET_MAX_TPS="1000" - - startAgent -} - -function createHolder() { - local NAME="holder" - local PORT=8090 - local ADMIN_TOKEN=admin - local DEFAULT_WALLET_ENABLED=true - local DEFAULT_WALLET_AUTH_API_KEY=default - local API_KEY_AUTO_PROVISIONING=false - local API_KEY_ENABLED=true - local DOCKERHOST="host.docker.internal" - local PG_PORT=5433 - local NODE_REFRESH_AND_SUBMIT_PERIOD="1s" - local NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="1s" - local NODE_WALLET_MAX_TPS="1000" - - startAgent -} - -function createVerifier() { - local NAME="verifier" - local PORT=8100 local ADMIN_TOKEN=admin local DEFAULT_WALLET_ENABLED=true local DEFAULT_WALLET_AUTH_API_KEY=default local API_KEY_AUTO_PROVISIONING=false local API_KEY_ENABLED=true - local DOCKERHOST="host.docker.internal" - local PG_PORT=5434 - local NODE_REFRESH_AND_SUBMIT_PERIOD="1s" - local NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="1s" - local NODE_WALLET_MAX_TPS="1000" - - startAgent -} - -function removeIssuer() { - local NAME="issuer" - local PORT=8080 - local DOCKERHOST="host.docker.internal" - stopAgent -} - -function removeVerifier() { - local NAME="verifier" - local PORT=8100 - local DOCKERHOST="host.docker.internal" + echo "Issuer Port [$ISSUER_PORT]" + echo "Holder Port [$HOLDER_PORT]" + echo "VerifierPort [$VERIFIER_PORT]" - stopAgent + ADMIN_TOKEN="${ADMIN_TOKEN}" \ + DEFAULT_WALLET_ENABLED="${DEFAULT_WALLET_ENABLED}" \ + DEFAULT_WALLET_AUTH_API_KEY="${DEFAULT_WALLET_AUTH_API_KEY}" \ + API_KEY_AUTO_PROVISIONING="${API_KEY_AUTO_PROVISIONING}" \ + API_KEY_ENABLED="${API_KEY_ENABLED}" \ + DOCKERHOST="${DOCKERHOST}" \ + PG_PORT="${PG_PORT}" \ + NODE_REFRESH_AND_SUBMIT_PERIOD="${NODE_REFRESH_AND_SUBMIT_PERIOD}" \ + NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="${NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD}" \ + NODE_WALLET_MAX_TPS="${NODE_WALLET_MAX_TPS}" \ + docker compose -f "${DOCKERFILE}" \ + --env-file "${ENV_FILE}" up -d --wait 2>/dev/null + echo "Agents healthy" } -function removeHolder() { - local NAME="holder" - local PORT=8090 - local DOCKERHOST="host.docker.internal" - - stopAgent +function stopAllAgents() { + echo "Stopping agents" + docker compose \ + -f "${DOCKERFILE}" \ + --env-file "${ENV_FILE}" down -v 2>/dev/null + echo "Agents stopped" } # clean up on finish function cleanup() { + local exit_code=$? + if [[ $exit_code -eq 0 ]]; then + echo "Script exited normally with code $exit_code." + else + echo "Script exited with error code $exit_code." + fi echo "Removing K6 binaries" rm k6 rm "$K6_ZIP_FILE" - - removeIssuer & - removeVerifier & - removeHolder & - wait + echo "Stopping All Agents" + stopAllAgents + echo "cleanup complete" } trap 'cleanup' EXIT @@ -147,11 +87,19 @@ cd "$PERF_DIR" # set version to env file sed -i.bak "s/AGENT_VERSION=.*/AGENT_VERSION=${AGENT_VERSION}/" "${ENV_FILE}" && rm -f "${ENV_FILE}.bak" -# create agents in parallel -createIssuer & -createHolder & -createVerifier & -wait +# create docker agent-network +# create Prism Node +export HOLDER_PORT=8300 +export ISSUER_PORT=8080 +export VERIFIER_PORT=8100 +export ISSUER_AGENT_API_KEY=default +export HOLDER_AGENT_API_KEY=default +export VERIFIER_AGENT_API_KEY=default +export ISSUER_AGENT_URL="http://localhost:${ISSUER_PORT}/cloud-agent" +export HOLDER_AGENT_URL="http://localhost:${HOLDER_PORT}/cloud-agent" +export VERIFIER_AGENT_URL="http://localhost:${VERIFIER_PORT}/cloud-agent" + +startAllAgents # yarn install echo "Installing dependencies" @@ -162,10 +110,6 @@ yarn webpack >/dev/null # start perf test echo "Starting performance testing" -export ISSUER_AGENT_API_KEY=default -export HOLDER_AGENT_API_KEY=default -export VERIFIER_AGENT_API_KEY=default - ./k6 run -e SCENARIO_LABEL=create-prism-did-smoke ./dist/create-prism-did-test.js ./k6 run -e SCENARIO_LABEL=credential-offer-smoke ./dist/credential-offer-test.js ./k6 run -e SCENARIO_LABEL=credential-definition-smoke ./dist/credential-definition-test.js diff --git a/tests/performance-tests/agent-performance-tests-k6/yarn.lock b/tests/performance-tests/agent-performance-tests-k6/yarn.lock index 736d3f9bc0..36b63cb43f 100644 --- a/tests/performance-tests/agent-performance-tests-k6/yarn.lock +++ b/tests/performance-tests/agent-performance-tests-k6/yarn.lock @@ -993,10 +993,10 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@hyperledger/identus-cloud-agent-client-ts@^1.39.1-bbcedb1": - version "1.39.1-bbcedb1" - resolved "https://npm.pkg.github.com/download/@hyperledger/identus-cloud-agent-client-ts/1.39.1-bbcedb1/88aaeabfc4d2d8949e21014c2a5c9297ed055d42#88aaeabfc4d2d8949e21014c2a5c9297ed055d42" - integrity sha512-FjYV4HN5H/LD/v6dOw/vMaqU3f8v1IKzEMtUfj9qmLHVmr1FwxkZWSj6wE27I+sY/0sGAPCF/rPbvO27UWdtYQ== +"@hyperledger/identus-cloud-agent-client-ts@^1.39.1-19ab426": + version "1.40.0" + resolved "https://npm.pkg.github.com/download/@hyperledger/identus-cloud-agent-client-ts/1.40.0/ce8120a0483b02cda6aa348dd7e2f175c7a5b846#ce8120a0483b02cda6aa348dd7e2f175c7a5b846" + integrity sha512-uvxDYP8lJM7Dl7HMSX44fodVOxUaqsXy4WfNL2pdVCNBOksGFyAmxcAOlU8VNoCTCtKowyoPBnCK6zl9jyhgIw== dependencies: es6-promise "^4.2.4" url-parse "^1.4.3"