From 6303beedc48cf87020242c8c3814ca5ed7e22d29 Mon Sep 17 00:00:00 2001 From: Jun Nemoto Date: Tue, 17 Dec 2024 16:21:57 +0900 Subject: [PATCH 1/2] Support more storages --- .env | 1 + docker-compose-auditor.yml | 9 ++-- docker-compose-ledger-cassandra.yml | 67 +++++++++++++++++++++++++++ docker-compose-ledger-common.yml | 62 +++++++++++++++++++++++++ docker-compose-ledger-cosmosdb.yml | 48 ++++++++++++++++++++ docker-compose-ledger-dynamodb.yml | 69 ++++++++++++++++++++++++++++ docker-compose-ledger-mysql.yml | 68 ++++++++++++++++++++++++++++ docker-compose-ledger-oracle.yml | 68 ++++++++++++++++++++++++++++ docker-compose-ledger-postgres.yml | 69 ++++++++++++++++++++++++++++ docker-compose-ledger-sqlserver.yml | 70 +++++++++++++++++++++++++++++ docker-compose.yml | 5 +-- fixture/auditor.properties.tmpl | 3 ++ fixture/ledger.properties.tmpl | 3 ++ scalardb.cassandra.properties | 4 ++ scalardb.cosmosdb.properties | 3 ++ scalardb.dynamodb.properties | 5 +++ scalardb.mysql.properties | 4 ++ scalardb.oracle.properties | 4 ++ scalardb.postgres.properties | 4 ++ scalardb.sqlserver.properties | 4 ++ 20 files changed, 562 insertions(+), 8 deletions(-) create mode 100644 .env create mode 100644 docker-compose-ledger-cassandra.yml create mode 100644 docker-compose-ledger-common.yml create mode 100644 docker-compose-ledger-cosmosdb.yml create mode 100644 docker-compose-ledger-dynamodb.yml create mode 100644 docker-compose-ledger-mysql.yml create mode 100644 docker-compose-ledger-oracle.yml create mode 100644 docker-compose-ledger-postgres.yml create mode 100644 docker-compose-ledger-sqlserver.yml create mode 100644 scalardb.cassandra.properties create mode 100644 scalardb.cosmosdb.properties create mode 100644 scalardb.dynamodb.properties create mode 100644 scalardb.mysql.properties create mode 100644 scalardb.oracle.properties create mode 100644 scalardb.postgres.properties create mode 100644 scalardb.sqlserver.properties diff --git a/.env b/.env new file mode 100644 index 0000000..1d71891 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SCALARDL_VERSION=3.10.0 diff --git a/docker-compose-auditor.yml b/docker-compose-auditor.yml index 703b8dc..e7978ae 100644 --- a/docker-compose-auditor.yml +++ b/docker-compose-auditor.yml @@ -1,7 +1,6 @@ -version: "3.5" services: scalardl-auditor-schema-loader-cassandra: - image: ghcr.io/scalar-labs/scalardl-schema-loader:3.10.0 + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} environment: - SCHEMA_TYPE=auditor volumes: @@ -20,7 +19,7 @@ services: restart: on-failure scalar-ledger-as-client: - image: ghcr.io/scalar-labs/scalar-client:3.10.0 + image: ghcr.io/scalar-labs/scalar-client:${SCALARDL_VERSION} container_name: "scalardl-samples-scalar-ledger-as-client-1" volumes: - ./fixture/ledger.pem:/scalar/ledger.pem @@ -46,7 +45,7 @@ services: restart: on-failure:5 scalar-audior-as-client: - image: ghcr.io/scalar-labs/scalar-client:3.10.0 + image: ghcr.io/scalar-labs/scalar-client:${SCALARDL_VERSION} container_name: "scalardl-samples-scalar-auditor-as-client-1" volumes: - ./fixture/auditor.pem:/scalar/auditor.pem @@ -76,7 +75,7 @@ services: - SCALAR_DL_LEDGER_AUDITOR_ENABLED=true scalar-auditor: - image: ghcr.io/scalar-labs/scalardl-auditor-byol:3.10.0 + image: ghcr.io/scalar-labs/scalardl-auditor-byol:${SCALARDL_VERSION} container_name: "scalardl-samples-scalar-auditor-1" volumes: - ./fixture/auditor.pem:/scalar/auditor.pem diff --git a/docker-compose-ledger-cassandra.yml b/docker-compose-ledger-cassandra.yml new file mode 100644 index 0000000..463ea29 --- /dev/null +++ b/docker-compose-ledger-cassandra.yml @@ -0,0 +1,67 @@ +services: + cassandra: + image: cassandra:3.11 + container_name: "scalardl-samples-cassandra-1" + environment: + - CASSANDRA_DC=dc1 + - CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "cqlsh < /dev/null || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 30s + + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.cassandra.properties:/scalardb.properties + depends_on: + cassandra: + condition: service_healthy + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS=cassandra + - SCALAR_DB_STORAGE=cassandra + - SCALAR_DB_USERNAME=cassandra + - SCALAR_DB_PASSWORD=cassandra + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-common.yml b/docker-compose-ledger-common.yml new file mode 100644 index 0000000..6a4481c --- /dev/null +++ b/docker-compose-ledger-common.yml @@ -0,0 +1,62 @@ +services: + ledger-envoy: + image: ghcr.io/scalar-labs/scalar-envoy:1.5.0 + container_name: "scalardl-samples-ledger-envoy-1" + ports: + - "9901:9901" + - "50051:50051" + - "50052:50052" + depends_on: + scalar-ledger: + condition: service_started + environment: + - admin_access_log_path=/dev/stdout + - scalardl_address=scalar-ledger + - service_listeners=scalar-service:50051,scalar-privileged:50052 + - envoy_tls=false + networks: + - scalar-network + + cfssl-init: + # This service should be run separately before two services below + # (cfssl-serve and cfssl-ocspserve) with `depends_on` option, because if + # they start up at the same time (by commands like `docker-compose up`), + # they both attempt to generate the same missing certificate files, which + # results in a race condition. + image: ghcr.io/scalar-labs/scalar-cfssl:1.0.0 + container_name: "scalardl-samples-cfssl-init-1" + volumes: + - ./cfssl/data:/cfssl/data + command: /bin/true + networks: + - scalar-network + + cfssl-serve: + image: ghcr.io/scalar-labs/scalar-cfssl:1.0.0 + container_name: "scalardl-samples-cfssl-serve-1" + volumes: + - ./cfssl/data:/cfssl/data + depends_on: + - cfssl-init + command: serve + ports: + - "8888:8888" + networks: + - scalar-network + + cfssl-ocspserve: + image: ghcr.io/scalar-labs/scalar-cfssl:1.0.0 + container_name: "scalardl-samples-cfssl-ocspserve-1" + volumes: + - ./cfssl/data:/cfssl/data + depends_on: + - cfssl-init + command: ocspserve + ports: + - "8889:8889" + networks: + - scalar-network + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-cosmosdb.yml b/docker-compose-ledger-cosmosdb.yml new file mode 100644 index 0000000..dac5071 --- /dev/null +++ b/docker-compose-ledger-cosmosdb.yml @@ -0,0 +1,48 @@ +services: + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.cosmosdb.properties:/scalardb.properties + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS= + - SCALAR_DB_STORAGE=cosmos + - SCALAR_DB_PASSWORD= + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-dynamodb.yml b/docker-compose-ledger-dynamodb.yml new file mode 100644 index 0000000..b672dbb --- /dev/null +++ b/docker-compose-ledger-dynamodb.yml @@ -0,0 +1,69 @@ +services: + dynamodb: + image: amazon/dynamodb-local:2.5.2 + container_name: "dynamodb-1" + ports: + - "8000:8000" + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", '[ "$(curl -s -o /dev/null -I -w ''%{http_code}'' http://localhost:8000)" == "400" ] || exit 1'] + interval: 1s + timeout: 10s + retries: 60 + start_period: 30s + + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.dynamodb.properties:/scalardb.properties + depends_on: + dynamodb: + condition: service_healthy + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + - "--no-backup" + - "--no-scaling" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS=sample + - SCALAR_DB_STORAGE=dynamo + - SCALAR_DB_USERNAME=sample + - SCALAR_DB_PASSWORD=sample + - SCALAR_DB_DYNAMO_ENDPOINT_OVERRIDE=http://dynamodb:8000 + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-mysql.yml b/docker-compose-ledger-mysql.yml new file mode 100644 index 0000000..23bd4e7 --- /dev/null +++ b/docker-compose-ledger-mysql.yml @@ -0,0 +1,68 @@ +services: + mysql: + image: mysql:8.1 + container_name: "mysql-1" + environment: + MYSQL_ROOT_PASSWORD: mysql + ports: + - "3306:3306" + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "mysql -u root -pmysql -h 127.0.0.1 < /dev/null || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 30s + + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.mysql.properties:/scalardb.properties + depends_on: + mysql: + condition: service_healthy + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS=jdbc:mysql://mysql/ + - SCALAR_DB_STORAGE=jdbc + - SCALAR_DB_USERNAME=root + - SCALAR_DB_PASSWORD=mysql + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-oracle.yml b/docker-compose-ledger-oracle.yml new file mode 100644 index 0000000..6f38740 --- /dev/null +++ b/docker-compose-ledger-oracle.yml @@ -0,0 +1,68 @@ +services: + oracle: + image: container-registry.oracle.com/database/free:23.4.0.0 + container_name: "oracle-1" + environment: + ORACLE_PWD: Oracle + ports: + - "1521:1521" + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "/opt/oracle/checkDBStatus.sh"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 30s + + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.oracle.properties:/scalardb.properties + depends_on: + oracle: + condition: service_healthy + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS=jdbc:oracle:thin:@//oracle:1521/FREEPDB1 + - SCALAR_DB_STORAGE=jdbc + - SCALAR_DB_USERNAME=SYSTEM + - SCALAR_DB_PASSWORD=Oracle + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-postgres.yml b/docker-compose-ledger-postgres.yml new file mode 100644 index 0000000..fd258ee --- /dev/null +++ b/docker-compose-ledger-postgres.yml @@ -0,0 +1,69 @@ +services: + postgres: + image: postgres:15 + container_name: "postgres-1" + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 30s + + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.postgres.properties:/scalardb.properties + depends_on: + postgres: + condition: service_healthy + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalar-ledger:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS=jdbc:postgresql://postgres/ + - SCALAR_DB_STORAGE=jdbc + - SCALAR_DB_USERNAME=postgres + - SCALAR_DB_PASSWORD=postgres + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose-ledger-sqlserver.yml b/docker-compose-ledger-sqlserver.yml new file mode 100644 index 0000000..c53e8a9 --- /dev/null +++ b/docker-compose-ledger-sqlserver.yml @@ -0,0 +1,70 @@ +services: + sqlserver: + image: mcr.microsoft.com/mssql/server:2022-latest + container_name: "sqlserver-1" + environment: + MSSQL_PID: "Express" + SA_PASSWORD: "SqlServer22" + ACCEPT_EULA: "Y" + ports: + - "1433:1433" + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -C -U sa -P SqlServer22 -Q 'SELECT 1' || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 30s + + scalardl-ledger-schema-loader: + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} + volumes: + - ./scalardb.sqlserver.properties:/scalardb.properties + depends_on: + sqlserver: + condition: service_healthy + command: + - "-c" + - "/scalardb.properties" + - "--coordinator" + networks: + - scalar-network + restart: on-failure + + scalar-ledger: + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} + container_name: "scalardl-samples-scalar-ledger-1" + volumes: + - ./fixture/ledger-key.pem:/scalar/ledger-key.pem + - ./fixture/ledger.properties.tmpl:/scalar/ledger/ledger.properties.tmpl + - ./fixture/trial-license-cert.pem:/scalar/license-cert.pem + # If you have a commercial license key, you must use `commercial-license-cert.pem` instead of `trial-license-cert.pem`. + # - ./fixture/commercial-license-cert.pem:/scalar/license-cert.pem + depends_on: + scalardl-ledger-schema-loader: + condition: service_completed_successfully + environment: + - SCALAR_DB_CONTACT_POINTS=jdbc:sqlserver://sqlserver:1433;encrypt=true;trustServerCertificate=true + - SCALAR_DB_STORAGE=jdbc + - SCALAR_DB_USERNAME=sa + - SCALAR_DB_PASSWORD=SqlServer22 + - SCALAR_DL_LEDGER_PROOF_ENABLED=true + - SCALAR_DL_LEDGER_PROOF_PRIVATE_KEY_PATH=/scalar/ledger-key.pem + + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + - SCALAR_DL_LICENSING_LICENSE_KEY= + ##### PLEASE REPLACE THIS VALUE WITH YOUR LICENSE KEY ##### + + networks: + - scalar-network + healthcheck: + test: ["CMD-SHELL", "grpc_health_probe -addr=localhost:50051 && grpc_health_probe -addr=ledger-envoy:50051 || exit 1"] + interval: 1s + timeout: 10s + retries: 60 + start_period: 10s + +networks: + scalar-network: + name: scalar-network diff --git a/docker-compose.yml b/docker-compose.yml index 9b847bd..a95fa98 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3.5" services: cassandra: image: cassandra:3.11 @@ -24,7 +23,7 @@ services: start_period: 30s scalardl-ledger-schema-loader-cassandra: - image: ghcr.io/scalar-labs/scalardl-schema-loader:3.10.0 + image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} volumes: - ./scalardb.properties:/scalardb.properties depends_on: @@ -41,7 +40,7 @@ services: restart: on-failure scalar-ledger: - image: ghcr.io/scalar-labs/scalardl-ledger-byol:3.10.0 + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} container_name: "scalardl-samples-scalar-ledger-1" volumes: - ./fixture/ledger-key.pem:/scalar/ledger-key.pem diff --git a/fixture/auditor.properties.tmpl b/fixture/auditor.properties.tmpl index 2d94358..b88f934 100644 --- a/fixture/auditor.properties.tmpl +++ b/fixture/auditor.properties.tmpl @@ -155,6 +155,9 @@ scalar.db.isolation_level={{ default .Env.SCALAR_DB_ISOLATION_LEVEL "" }} # If SNAPSHOT is specified, this is ignored. scalar.db.consensuscommit.serializable_strategy={{ default .Env.SCALAR_DB_CONSENSUSCOMMIT_SERIALIZABLE_STRATEGY "" }} +# DynamoDB Endpoint override +scalar.db.dynamo.endpoint_override={{ default .Env.SCALAR_DB_DYNAMO_ENDPOINT_OVERRIDE "" }} + # License key scalar.dl.licensing.license_key={{ default .Env.SCALAR_DL_LICENSING_LICENSE_KEY "" }} scalar.dl.licensing.license_check_cert_path=/scalar/license-cert.pem diff --git a/fixture/ledger.properties.tmpl b/fixture/ledger.properties.tmpl index 0764403..cebdb66 100644 --- a/fixture/ledger.properties.tmpl +++ b/fixture/ledger.properties.tmpl @@ -119,6 +119,9 @@ scalar.db.isolation_level={{ default .Env.SCALAR_DB_ISOLATION_LEVEL "" }} # If SNAPSHOT is specified, this is ignored. scalar.db.consensuscommit.serializable_strategy={{ default .Env.SCALAR_DB_CONSENSUSCOMMIT_SERIALIZABLE_STRATEGY "" }} +# DynamoDB Endpoint override +scalar.db.dynamo.endpoint_override={{ default .Env.SCALAR_DB_DYNAMO_ENDPOINT_OVERRIDE "" }} + # License key scalar.dl.licensing.license_key={{ default .Env.SCALAR_DL_LICENSING_LICENSE_KEY "" }} scalar.dl.licensing.license_check_cert_path=/scalar/license-cert.pem diff --git a/scalardb.cassandra.properties b/scalardb.cassandra.properties new file mode 100644 index 0000000..fe6998e --- /dev/null +++ b/scalardb.cassandra.properties @@ -0,0 +1,4 @@ +scalar.db.storage=cassandra +scalar.db.contact_points=cassandra +scalar.db.username=cassandra +scalar.db.password=cassandra diff --git a/scalardb.cosmosdb.properties b/scalardb.cosmosdb.properties new file mode 100644 index 0000000..8e30c24 --- /dev/null +++ b/scalardb.cosmosdb.properties @@ -0,0 +1,3 @@ +scalar.db.storage=cosmos +scalar.db.contact_points= +scalar.db.password= diff --git a/scalardb.dynamodb.properties b/scalardb.dynamodb.properties new file mode 100644 index 0000000..ca68c4d --- /dev/null +++ b/scalardb.dynamodb.properties @@ -0,0 +1,5 @@ +scalar.db.storage=dynamo +scalar.db.contact_points=sample +scalar.db.username=sample +scalar.db.password=sample +scalar.db.dynamo.endpoint_override=http://dynamodb:8000 diff --git a/scalardb.mysql.properties b/scalardb.mysql.properties new file mode 100644 index 0000000..77ea953 --- /dev/null +++ b/scalardb.mysql.properties @@ -0,0 +1,4 @@ +scalar.db.storage=jdbc +scalar.db.contact_points=jdbc:mysql://mysql/ +scalar.db.username=root +scalar.db.password=mysql diff --git a/scalardb.oracle.properties b/scalardb.oracle.properties new file mode 100644 index 0000000..848c387 --- /dev/null +++ b/scalardb.oracle.properties @@ -0,0 +1,4 @@ +scalar.db.storage=jdbc +scalar.db.contact_points=jdbc:oracle:thin:@//oracle:1521/FREEPDB1 +scalar.db.username=SYSTEM +scalar.db.password=Oracle diff --git a/scalardb.postgres.properties b/scalardb.postgres.properties new file mode 100644 index 0000000..dc24e6c --- /dev/null +++ b/scalardb.postgres.properties @@ -0,0 +1,4 @@ +scalar.db.storage=jdbc +scalar.db.contact_points=jdbc:postgresql://postgres/ +scalar.db.username=postgres +scalar.db.password=postgres diff --git a/scalardb.sqlserver.properties b/scalardb.sqlserver.properties new file mode 100644 index 0000000..746808c --- /dev/null +++ b/scalardb.sqlserver.properties @@ -0,0 +1,4 @@ +scalar.db.storage=jdbc +scalar.db.contact_points=jdbc:sqlserver://sqlserver:1433;encrypt=true;trustServerCertificate=true +scalar.db.username=sa +scalar.db.password=SqlServer22 From 816a1b451fef5f573163977f328585873e731752 Mon Sep 17 00:00:00 2001 From: Jun Nemoto Date: Wed, 18 Dec 2024 16:51:00 +0900 Subject: [PATCH 2/2] Use include function --- docker-compose-ledger-cassandra.yml | 7 +++---- docker-compose-ledger-cosmosdb.yml | 7 +++---- docker-compose-ledger-dynamodb.yml | 7 +++---- docker-compose-ledger-mysql.yml | 7 +++---- docker-compose-ledger-oracle.yml | 7 +++---- docker-compose-ledger-postgres.yml | 9 ++++----- docker-compose-ledger-sqlserver.yml | 7 +++---- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/docker-compose-ledger-cassandra.yml b/docker-compose-ledger-cassandra.yml index 463ea29..0ae3a7a 100644 --- a/docker-compose-ledger-cassandra.yml +++ b/docker-compose-ledger-cassandra.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: cassandra: image: cassandra:3.11 @@ -61,7 +64,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network diff --git a/docker-compose-ledger-cosmosdb.yml b/docker-compose-ledger-cosmosdb.yml index dac5071..af2a48d 100644 --- a/docker-compose-ledger-cosmosdb.yml +++ b/docker-compose-ledger-cosmosdb.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: scalardl-ledger-schema-loader: image: ghcr.io/scalar-labs/scalardl-schema-loader:${SCALARDL_VERSION} @@ -42,7 +45,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network diff --git a/docker-compose-ledger-dynamodb.yml b/docker-compose-ledger-dynamodb.yml index b672dbb..1f74e2a 100644 --- a/docker-compose-ledger-dynamodb.yml +++ b/docker-compose-ledger-dynamodb.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: dynamodb: image: amazon/dynamodb-local:2.5.2 @@ -63,7 +66,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network diff --git a/docker-compose-ledger-mysql.yml b/docker-compose-ledger-mysql.yml index 23bd4e7..6eeaccf 100644 --- a/docker-compose-ledger-mysql.yml +++ b/docker-compose-ledger-mysql.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: mysql: image: mysql:8.1 @@ -62,7 +65,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network diff --git a/docker-compose-ledger-oracle.yml b/docker-compose-ledger-oracle.yml index 6f38740..aad457f 100644 --- a/docker-compose-ledger-oracle.yml +++ b/docker-compose-ledger-oracle.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: oracle: image: container-registry.oracle.com/database/free:23.4.0.0 @@ -62,7 +65,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network diff --git a/docker-compose-ledger-postgres.yml b/docker-compose-ledger-postgres.yml index fd258ee..0f573b8 100644 --- a/docker-compose-ledger-postgres.yml +++ b/docker-compose-ledger-postgres.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: postgres: image: postgres:15 @@ -32,7 +35,7 @@ services: restart: on-failure scalar-ledger: - image: ghcr.io/scalar-labs/scalar-ledger:${SCALARDL_VERSION} + image: ghcr.io/scalar-labs/scalardl-ledger-byol:${SCALARDL_VERSION} container_name: "scalardl-samples-scalar-ledger-1" volumes: - ./fixture/ledger-key.pem:/scalar/ledger-key.pem @@ -63,7 +66,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network diff --git a/docker-compose-ledger-sqlserver.yml b/docker-compose-ledger-sqlserver.yml index c53e8a9..e0e5ac1 100644 --- a/docker-compose-ledger-sqlserver.yml +++ b/docker-compose-ledger-sqlserver.yml @@ -1,3 +1,6 @@ +include: + - ./docker-compose-ledger-common.yml + services: sqlserver: image: mcr.microsoft.com/mssql/server:2022-latest @@ -64,7 +67,3 @@ services: timeout: 10s retries: 60 start_period: 10s - -networks: - scalar-network: - name: scalar-network