From 82969c79f46dae2130ab938dbc748ebe0c4f175f Mon Sep 17 00:00:00 2001 From: Sameh Abouel-saad Date: Wed, 22 May 2024 10:17:41 +0300 Subject: [PATCH] init cockroach cluster settings in indexer docker-compose (#175) --- indexer/docker-compose.yml | 22 +++++++++++++++++++--- indexer/setup_db.sh | 9 +++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 indexer/setup_db.sh diff --git a/indexer/docker-compose.yml b/indexer/docker-compose.yml index e5f58f7..37bd073 100644 --- a/indexer/docker-compose.yml +++ b/indexer/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3.4" +version: "3.8" services: db: @@ -11,9 +11,21 @@ services: volumes: - /cockroach/cockroach-data - ingest: + db-init: depends_on: - db + image: cockroachdb/cockroach:v22.2.2 + + volumes: + - ./setup_db.sh:/setup_db.sh + entrypoint: "/bin/bash" + command: /setup_db.sh + restart: on-failure + + ingest: + depends_on: + db-init: + condition: service_completed_successfully restart: on-failure image: subsquid/substrate-ingest:1 volumes: @@ -34,7 +46,8 @@ services: gateway: depends_on: - - db + db-init: + condition: service_completed_successfully image: subsquid/substrate-gateway:2.5.0 environment: DATABASE_MAX_CONNECTIONS: 5 @@ -44,6 +57,9 @@ services: - "8888:8000" explorer: + depends_on: + db-init: + condition: service_completed_successfully image: subsquid/substrate-explorer:firesquid environment: DB_TYPE: cockroach diff --git a/indexer/setup_db.sh b/indexer/setup_db.sh new file mode 100644 index 0000000..2435423 --- /dev/null +++ b/indexer/setup_db.sh @@ -0,0 +1,9 @@ +#!/bin/bash +sleep 2 +echo "Set sql.conn.max_read_buffer_message_size to 32 MiB" + +HOSTPARAMS="--host db --insecure" +SQL="/cockroach/cockroach.sh sql $HOSTPARAMS" + +# https://github.com/threefoldtech/tfchain_graphql/issues/130#issuecomment-1689987550 +$SQL -e "SET CLUSTER SETTING sql.conn.max_read_buffer_message_size = '32MiB';"