diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml index 39b93decf2..30dd26bb9b 100644 --- a/.github/workflows/performance-tests.yml +++ b/.github/workflows/performance-tests.yml @@ -55,6 +55,23 @@ jobs: sed -i.bak "s/AGENT_VERSION=.*/AGENT_VERSION=${AGENT_VERSION}/" "${ENV_FILE}" && rm -f "${ENV_FILE}.bak" cat "${ENV_FILE}" + - name: Create Docker Network + run: | + docker network create agent-network || echo "Network already exists" + + - name: Start services for prism node & postgres + env: + PG_PORT: 5432 + 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-node.yml" + compose-flags: "--env-file ./infrastructure/local/.env -p prism-node" + up-flags: "--wait" + down-flags: "--volumes" + - name: Start services for issuer env: PORT: 8080 @@ -70,7 +87,7 @@ jobs: NODE_WALLET_MAX_TPS: 1000 uses: hoverkraft-tech/compose-action@v2.0.0 with: - compose-file: "./infrastructure/shared/docker-compose.yml" + compose-file: "./infrastructure/shared/docker-compose-agent.yml" compose-flags: "--env-file ./infrastructure/local/.env -p issuer" up-flags: "--wait" down-flags: "--volumes" @@ -87,7 +104,7 @@ jobs: PG_PORT: 5433 uses: isbang/compose-action@v1.4.1 with: - compose-file: "./infrastructure/shared/docker-compose.yml" + compose-file: "./infrastructure/shared/docker-compose-agent.yml" compose-flags: "--env-file ./infrastructure/local/.env -p holder" up-flags: "--wait" down-flags: "--volumes" @@ -104,7 +121,7 @@ jobs: PG_PORT: 5434 uses: isbang/compose-action@v1.4.1 with: - compose-file: "./infrastructure/shared/docker-compose.yml" + compose-file: "./infrastructure/shared/docker-compose-agent.yml" compose-flags: "--env-file ./infrastructure/local/.env -p verifier" up-flags: "--wait" down-flags: "--volumes" @@ -145,3 +162,11 @@ jobs: ./k6 run -e SCENARIO_LABEL=connection-flow-smoke ${{ env.BENCHMARKING_DIR }}/dist/connection-flow-test.js ./k6 run -e SCENARIO_LABEL=issuance-flow-smoke ${{ env.BENCHMARKING_DIR }}/dist/issuance-flow-test.js ./k6 run -e SCENARIO_LABEL=present-proof-flow-smoke ${{ env.BENCHMARKING_DIR }}/dist/present-proof-flow-test.js + + - name: Remove Docker Network + if: always() + run: | + echo "Forcefully stopping all containers on agent-network" + docker ps -q --filter network=agent-network | xargs -r docker stop || echo "No containers to stop" + docker ps -a -q --filter network=agent-network | xargs -r docker rm || echo "No containers to remove" + docker network rm agent-network || echo "Network not found" \ No newline at end of file diff --git a/infrastructure/local/.env b/infrastructure/local/.env index 61994ac146..718f813042 100644 --- a/infrastructure/local/.env +++ b/infrastructure/local/.env @@ -1,3 +1,3 @@ -AGENT_VERSION=1.40.0 -PRISM_NODE_VERSION=2.3.0 +AGENT_VERSION=1.40.1-SNAPSHOT +PRISM_NODE_VERSION=2.4.1 VAULT_DEV_ROOT_TOKEN_ID=root diff --git a/infrastructure/shared/docker-compose-agent.yml b/infrastructure/shared/docker-compose-agent.yml new file mode 100644 index 0000000000..054876bffc --- /dev/null +++ b/infrastructure/shared/docker-compose-agent.yml @@ -0,0 +1,163 @@ +--- +version: "3.8" + +services: + ########################## + # Database + ########################## +# db: +# image: postgres:13 +# environment: +# POSTGRES_MULTIPLE_DATABASES: "pollux,connect,agent,node_db" +# POSTGRES_USER: postgres +# POSTGRES_PASSWORD: postgres +# volumes: +# - pg_data_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:${PG_PORT:-5432}: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: db:5432 +# NODE_REFRESH_AND_SUBMIT_PERIOD: +# NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: +# NODE_WALLET_MAX_TPS: +# depends_on: +# 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 + networks: + - agent-network + cloud-agent: + image: ghcr.io/hyperledger/identus-cloud-agent:${AGENT_VERSION} + environment: + POLLUX_DB_HOST: db + POLLUX_DB_PORT: 5432 + POLLUX_DB_NAME: pollux + POLLUX_DB_USER: postgres + POLLUX_DB_PASSWORD: postgres + CONNECT_DB_HOST: db + CONNECT_DB_PORT: 5432 + CONNECT_DB_NAME: connect + CONNECT_DB_USER: postgres + CONNECT_DB_PASSWORD: postgres + AGENT_DB_HOST: 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}:${PORT}/cloud-agent + DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${PORT}/didcomm + REST_SERVICE_URL: http://${DOCKERHOST}:${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: +# db: +# condition: service_healthy +# prism-node: +# condition: service_started + vault-server: + condition: service_healthy + networks: + - agent-network + healthcheck: + test: ["CMD", "curl", "-f", "http://cloud-agent:8085/_system/health"] + interval: 30s + timeout: 10s + retries: 5 + extra_hosts: + - "host.docker.internal:host-gateway" + + swagger-ui: + image: swaggerapi/swagger-ui:v5.1.0 + environment: + - 'URLS=[ + { name: "Cloud Agent", url: "/docs/cloud-agent/api/docs.yaml" } + ]' + networks: + - agent-network + + apisix: + image: apache/apisix:2.15.0-alpine + volumes: + - ./apisix/conf/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro + - ./apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro + ports: + - "${PORT}:9080/tcp" + depends_on: + - cloud-agent + - swagger-ui + networks: + - agent-network +volumes: + pg_data_db: + pgadmin: +# Temporary commit network setting due to e2e CI bug +# to be enabled later after debugging +#networks: +# default: +# name: ${NETWORK} + +networks: + agent-network: + external: true \ No newline at end of file diff --git a/infrastructure/shared/docker-compose-node.yml b/infrastructure/shared/docker-compose-node.yml new file mode 100644 index 0000000000..9c497e4bf6 --- /dev/null +++ b/infrastructure/shared/docker-compose-node.yml @@ -0,0 +1,62 @@ +--- +version: "3.8" + +services: + db: + image: postgres:13 + environment: + POSTGRES_MULTIPLE_DATABASES: "pollux,connect,agent,node_db" + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + volumes: + - pg_data_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:${PG_PORT:-5432}:5432" + networks: + - agent-network + 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 + networks: + - agent-network + + prism-node: + image: ghcr.io/input-output-hk/prism-node:${PRISM_NODE_VERSION} + environment: + NODE_PSQL_HOST: db:5432 + NODE_REFRESH_AND_SUBMIT_PERIOD: + NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: + NODE_WALLET_MAX_TPS: + depends_on: + db: + condition: service_healthy + networks: + - agent-network + +volumes: + pg_data_db: + +networks: + agent-network: + external: true \ No newline at end of file