From fc83ce10e7052ba2138c6b64c0bb6c6ff4b8a2cf Mon Sep 17 00:00:00 2001 From: Frank Bernhardt <275327+frank-bee@users.noreply.github.com> Date: Thu, 24 Jun 2021 16:52:58 +0200 Subject: [PATCH] Fix/dockercompose (#511) * tune compose files * open preview * fix webhook url Signed-off-by: frank-bee --- .gitpod.yml | 11 ++- .../src/main/resources/application-dev.yml | 3 - scripts/.env-example | 4 +- scripts/docker-compose.custom-acapy.yml | 80 ++----------------- scripts/docker-compose.dev.yml | 47 ----------- scripts/docker-compose.override.yml | 19 +++++ scripts/docker-compose.yml | 26 +++--- 7 files changed, 49 insertions(+), 141 deletions(-) delete mode 100644 backend/business-partner-agent/src/main/resources/application-dev.yml delete mode 100644 scripts/docker-compose.dev.yml create mode 100644 scripts/docker-compose.override.yml diff --git a/.gitpod.yml b/.gitpod.yml index 8ad03b3a9..7cfa8648e 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -6,7 +6,7 @@ ports: - port: 8080 onOpen: ignore - port: 8081 - onOpen: open-browser + onOpen: open-preview - port: 8090 onOpen: open-browser - port: 8030 @@ -22,9 +22,7 @@ ports: - port: 5900 onOpen: ignore - port: 5432 - onOpen: ignore - - port: 5452 - onOpen: ignore + onOpen: ignore github: prebuilds: @@ -50,16 +48,17 @@ tasks: gp env ACAPY_ENDPOINT=`gp url 8030` gp env ACAPY2_ENDPOINT=`gp url 8040` gp env BPA_HOST=`gp url 8080 | sed 's/.*https:\/\///'` + gp env BPA_WEBHOOK_URL=`gp url 8080`/log gp env BPA2_HOST=`gp url 8090 | sed 's/.*https:\/\///'` eval $(gp env -e) cd /workspace/business-partner-agent/scripts cp .env-example .env ./register-dids.sh - docker-compose --profile second_bpa -f docker-compose.yml -f docker-compose.dev.yml build bpa2 + docker-compose --profile second_bpa build bpa2 command: | cd /workspace/business-partner-agent/scripts eval $(gp env -e) - docker-compose --profile second_bpa -f docker-compose.yml -f docker-compose.dev.yml up bpa-agent1 bpa2 + docker-compose --profile second_bpa up bpa-agent1 bpa2 # Backend: for "BPA" launch the backend via java (without frontend). To allow debugging easily. - name: dev backend init: | diff --git a/backend/business-partner-agent/src/main/resources/application-dev.yml b/backend/business-partner-agent/src/main/resources/application-dev.yml deleted file mode 100644 index a5d599efa..000000000 --- a/backend/business-partner-agent/src/main/resources/application-dev.yml +++ /dev/null @@ -1,3 +0,0 @@ -micronaut: - security: - enabled: false \ No newline at end of file diff --git a/scripts/.env-example b/scripts/.env-example index ac82ebdc1..e6c76d75f 100644 --- a/scripts/.env-example +++ b/scripts/.env-example @@ -11,11 +11,13 @@ BPA_HOST=localhost BPA2_HOST=localhost BPA_PORT=8080 BPA2_PORT=8090 +BPA_WEBHOOK_URL=http://bpa1:8080/log +BPA2_WEBHOOK_URL=http://bpa2:8080/log BPA_DEBUG_PORT=1044 BPA_DEBUG_PORT=1045 -BPA_SCHEME=http +BPA_SCHEME=https BPA_CONFIG_FILES=classpath:application.yml,classpath:schemas.yml # Security diff --git a/scripts/docker-compose.custom-acapy.yml b/scripts/docker-compose.custom-acapy.yml index d9034f4a1..101f979f1 100644 --- a/scripts/docker-compose.custom-acapy.yml +++ b/scripts/docker-compose.custom-acapy.yml @@ -1,78 +1,10 @@ -# Compose file for frontent developers or for everyone else that needs the full stack up and running - -version: '3' - +version: "3.9" services: - bpa: - image: ${BPA_DOCKER_IMAGE} - depends_on: - - aca-py - environment: - JAVA_OPTS: > - -Dbpa.acapy.url=http://aca-py:${ACAPY_ADMIN_PORT} - -Dbpa.acapy.apiKey=${ACAPY_ADMIN_URL_API_KEY} - -Dmicronaut.security.enabled=${BPA_SECURITY_ENABLED} - -Dmicronaut.server.port=${BPA_PORT} - -Dmicronaut.config.files=${BPA_CONFIG_FILES} - -Dbpa.pg.url=jdbc:postgresql://${POSTGRESQL_HOST}/${POSTGRESQL_USER} - -Dbpa.pg.username=${POSTGRESQL_USER} - -Dbpa.pg.password=${POSTGRESQL_PASSWORD} - -Dbpa.host=${BPA_HOST} - BPA_WEB_MODE: ${BPA_WEB_MODE} - BPA_RESOLVER_URL: ${BPA_RESOLVER_URL} - BPA_LEDGER_BROWSER: ${BPA_LEDGER_BROWSER} - BPA_DID_PREFIX: ${BPA_DID_PREFIX} - BPA_BOOTSTRAP_UN: ${BPA_BOOTSTRAP_UN} - BPA_BOOTSTRAP_PW: ${BPA_BOOTSTRAP_PW} - ACAPY_ENDPOINT: ${ACAPY_ENDPOINT} - AGENT_NAME: ${AGENT_NAME} - BPA_IMPRINT_URL: ${BPA_IMPRINT_URL} - BPA_PRIVACY_POLICY_URL: ${BPA_PRIVACY_POLICY_URL} - BPA_CREDDEF_REVOCATION_REGISTRY_SIZE: ${BPA_CREDDEF_REVOCATION_REGISTRY_SIZE} - ports: - - ${BPA_PORT}:${BPA_PORT} - restart: always - aca-py: + bpa-agent1: build: context: ${ACAPY_BUILD_CONTEXT} dockerfile: ${ACAPY_BUILD_DOCKERFILE_PATH} - ports: - - ${ACAPY_ADMIN_PORT}:${ACAPY_ADMIN_PORT} - - ${ACAPY_HTTP_PORT}:${ACAPY_HTTP_PORT} - depends_on: - - postgres - entrypoint: /bin/bash - command: [ - "-c", - "sleep 1; - aca-py start \ - --arg-file acapy-static-args.yml \ - --inbound-transport http '0.0.0.0' ${ACAPY_HTTP_PORT} \ - --webhook-url http://bpa:${BPA_PORT}/log \ - --genesis-url '${ACAPY_GENESIS_URL}' \ - --endpoint ${ACAPY_ENDPOINT} \ - --wallet-name '${ACAPY_WALLET_DATABASE}' \ - --wallet-key '${ACAPY_WALLET_ENCRYPTION_KEY}' \ - --wallet-storage-type '${ACAPY_WALLET_TYPE}' \ - --wallet-storage-config '{\"url\":\"${POSTGRESQL_HOST}:${POSTGRESQL_PORT}\",\"max_connections\":5}' \ - --wallet-storage-creds '{\"account\":\"${POSTGRESQL_USER}\",\"password\":\"${POSTGRESQL_PASSWORD}\",\"admin_account\":\"${POSTGRESQL_USER}\",\"admin_password\":\"${POSTGRESQL_PASSWORD}\"}' \ - --seed '${ACAPY_SEED}' \ - --admin '0.0.0.0' ${ACAPY_ADMIN_PORT} \ - --label '${AGENT_NAME}' \ - ${ACAPY_ADMIN_CONFIG} \ - ${ACAPY_READ_ONLY_MODE} \ - " - ] - volumes: - - "./acapy-static-args.yml:/home/indy/acapy-static-args.yml" - postgres: - image: "postgres:12-alpine" - environment: - - POSTGRES_USER=${POSTGRESQL_USER} - - POSTGRES_PASSWORD=${POSTGRESQL_PASSWORD} - ports: - - ${POSTGRESQL_PORT}:${POSTGRESQL_PORT} - volumes: - - postgres-data:/var/lib/postgresql/data -volumes: - postgres-data: + bpa-agent2: + build: + context: ${ACAPY_BUILD_CONTEXT} + dockerfile: ${ACAPY_BUILD_DOCKERFILE_PATH} \ No newline at end of file diff --git a/scripts/docker-compose.dev.yml b/scripts/docker-compose.dev.yml deleted file mode 100644 index 0ce22cb78..000000000 --- a/scripts/docker-compose.dev.yml +++ /dev/null @@ -1,47 +0,0 @@ -version: "3.9" -services: -####### -# Business Partner 1 -####### - bpa1: - image: ghcr.io/hyperledger-labs/business-partner-agent:local - build: - context: .. - dockerfile: Dockerfile - environment: - JAVA_OPTS: > - -Dbpa.acapy.url=http://bpa-agent1:${ACAPY_ADMIN_PORT} - -Dbpa.acapy.apiKey=${ACAPY_ADMIN_URL_API_KEY} - -Dmicronaut.security.enabled=${BPA_SECURITY_ENABLED} - -Dmicronaut.server.port=${BPA_PORT} - -Dmicronaut.config.files=${BPA_CONFIG_FILES} - -Dbpa.pg.url=jdbc:postgresql://${POSTGRESQL_HOST}/${POSTGRESQL_USER} - -Dbpa.pg.username=${POSTGRESQL_USER} - -Dbpa.pg.password=${POSTGRESQL_PASSWORD} - -Dbpa.host=${BPA_HOST}:${BPA_PORT} - -Dbpa.scheme=${BPA_SCHEME} - -Dmicronaut.environments=dev - NODE_ENV: development - -####### -# Business Partner 2 (only started with "--profile second_bpa") -####### - bpa2: - image: ghcr.io/hyperledger-labs/business-partner-agent:local - build: - context: .. - dockerfile: Dockerfile - environment: - JAVA_OPTS: > - -Dbpa.acapy.url=http://bpa-agent2:${ACAPY2_ADMIN_PORT} - -Dbpa.acapy.apiKey=${ACAPY_ADMIN_URL_API_KEY} - -Dmicronaut.security.enabled=${BPA_SECURITY_ENABLED} - -Dmicronaut.server.port=${BPA2_PORT} - -Dmicronaut.config.files=${BPA_CONFIG_FILES} - -Dbpa.pg.url=jdbc:postgresql://${POSTGRESQL2_HOST}/${POSTGRESQL_USER} - -Dbpa.pg.username=${POSTGRESQL_USER} - -Dbpa.pg.password=${POSTGRESQL_PASSWORD} - -Dbpa.host=${BPA2_HOST}:${BPA2_PORT} - -Dbpa.scheme=${BPA_SCHEME} - -Dmicronaut.environments=dev - NODE_ENV: development \ No newline at end of file diff --git a/scripts/docker-compose.override.yml b/scripts/docker-compose.override.yml new file mode 100644 index 000000000..ae817105d --- /dev/null +++ b/scripts/docker-compose.override.yml @@ -0,0 +1,19 @@ +version: "3.9" +services: +####### +# Business Partner 1 +####### + bpa1: + image: ghcr.io/hyperledger-labs/business-partner-agent:local + build: + context: .. + dockerfile: Dockerfile + +####### +# Business Partner 2 (only started with "--profile second_bpa") +####### + bpa2: + image: ghcr.io/hyperledger-labs/business-partner-agent:local + build: + context: .. + dockerfile: Dockerfile \ No newline at end of file diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml index 6b9236b37..9c4c6ec42 100644 --- a/scripts/docker-compose.yml +++ b/scripts/docker-compose.yml @@ -3,8 +3,11 @@ services: ####### # Business Partner 1 ####### - BPA: - image: ${BPA_DOCKER_IMAGE} + bpa1: + image: ghcr.io/hyperledger-labs/business-partner-agent:edge + build: + context: "" + dockerfile: "" depends_on: - bpa-agent1 environment: @@ -17,7 +20,7 @@ services: -Dbpa.pg.url=jdbc:postgresql://${POSTGRESQL_HOST}/${POSTGRESQL_USER} -Dbpa.pg.username=${POSTGRESQL_USER} -Dbpa.pg.password=${POSTGRESQL_PASSWORD} - -Dbpa.host=${BPA_HOST}:${BPA_PORT} + -Dbpa.host=${BPA_HOST} -Dbpa.scheme=${BPA_SCHEME} BPA_WEB_MODE: ${BPA_WEB_MODE} BPA_RESOLVER_URL: ${BPA_RESOLVER_URL} @@ -48,7 +51,7 @@ services: --auto-provision --arg-file acapy-static-args.yml \ --inbound-transport http '0.0.0.0' ${ACAPY_HTTP_PORT} \ - --webhook-url http://BPA:${BPA_PORT}/log \ + --webhook-url '${BPA_WEBHOOK_URL}' \ --genesis-url '${ACAPY_GENESIS_URL}' \ --endpoint ${ACAPY_ENDPOINT} \ --wallet-name '${ACAPY_WALLET_DATABASE}' \ @@ -81,7 +84,10 @@ services: bpa2: profiles: - second_bpa - image: ${BPA_DOCKER_IMAGE} + image: ghcr.io/hyperledger-labs/business-partner-agent:edge + build: + context: "" + dockerfile: "" depends_on: - bpa-agent2 environment: @@ -94,7 +100,7 @@ services: -Dbpa.pg.url=jdbc:postgresql://${POSTGRESQL2_HOST}/${POSTGRESQL_USER} -Dbpa.pg.username=${POSTGRESQL_USER} -Dbpa.pg.password=${POSTGRESQL_PASSWORD} - -Dbpa.host=${BPA2_HOST}:${BPA2_PORT} + -Dbpa.host=${BPA2_HOST} -Dbpa.scheme=${BPA_SCHEME} BPA_WEB_MODE: ${BPA_WEB_MODE} BPA_RESOLVER_URL: ${BPA_RESOLVER_URL} @@ -127,7 +133,7 @@ services: --auto-provision --arg-file acapy-static-args.yml \ --inbound-transport http '0.0.0.0' ${ACAPY2_HTTP_PORT} \ - --webhook-url http://bpa2:${BPA2_PORT}/log \ + --webhook-url '${BPA2_WEBHOOK_URL}' \ --genesis-url '${ACAPY_GENESIS_URL}' \ --endpoint ${ACAPY2_ENDPOINT} \ --wallet-name '${ACAPY_WALLET_DATABASE}' \ @@ -155,9 +161,9 @@ services: - ${POSTGRESQL2_PORT}:5432 volumes: - bpa-wallet-db2:/var/lib/postgresql/data - - - +####### +# Volumes for the databases +####### volumes: bpa-wallet-db1: bpa-wallet-db2: \ No newline at end of file