diff --git a/docker-compose.yml b/docker-compose.yml index 9f4f4688..8bf236b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,37 @@ services: timeout: 5s retries: 5 + subquery-migrations: + build: + context: . + dockerfile: ./docker/sq-Dockerfile + depends_on: + 'postgres': + condition: service_healthy + environment: + START_NODE: 'false' + DB_USER: postgres + DB_PASS: postgres + DB_DATABASE: postgres + DB_HOST: postgres + DB_PORT: 5432 + # Polymesh-local + NETWORK_ENDPOINT: ws://host.docker.internal:9944 + # Setting NETWORK_HTTP_ENDPOINT will allow dynamic lookup of NETWORK_CHAIN_ID + NETWORK_HTTP_ENDPOINT: 'http://host.docker.internal:9944' + # Staging + # NETWORK_ENDPOINT: wss://staging-rpc.polymesh.dev/ + # NETWORK_CHAIN_ID: '0x3c3183f6d701500766ff7d147b79c4f10014a095eaaa98e960dcef6b3ead50ee' + # NETWORK_DICTIONARY: https://subql-dictionary.polymesh.dev + # Testnet + # NETWORK_ENDPOINT: wss://testnet-rpc.polymesh.live + # NETWORK_CHAIN_ID: '0x2ace05e703aa50b48c0ccccfc8b424f7aab9a1e2c424ed12e45d20b1e8ffd0d6' + # NETWORK_DICTIONARY: https://testnet-subql-dictionary.polymesh.live/ + # Mainnet + # NETWORK_ENDPOINT: wss://mainnet-rpc.polymesh.network + # NETWORK_CHAIN_ID: '0x6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063' + # NETWORK_DICTIONARY: https://mainnet-subql-dictionary.polymesh.network/ + subquery-node: build: context: . @@ -24,8 +55,11 @@ services: depends_on: 'postgres': condition: service_healthy + 'subquery-migrations': + condition: service_completed_successfully restart: always environment: + RUN_MIGRATIONS: 'false' DB_USER: postgres DB_PASS: postgres DB_DATABASE: postgres diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index afecd5f5..974d2200 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -19,16 +19,24 @@ fi npm run build ## This creates the project.yaml file -(npm run sql || (sleep 3 && kill "$$")) & +if [[ "${START_NODE:-true}" == "true" ]]; then + (npm run sql || (sleep 3 && kill "$$")) & +fi -npm run migrations +if [[ "${RUN_MIGRATIONS:-true}" == "true" ]]; then + npm run migrations +fi -# Allow configuring node memory. It should be no more than 75% of available RAM. -# Defaults to 3 GB (expecting at least 4 GB available). -NODE_SPACE=${MAX_OLD_SPACE_SIZE:-3072} +if [[ "${START_NODE:-true}" == "true" ]]; then + # Allow configuring node memory. It should be no more than 75% of available RAM. + # Defaults to 3 GB (expecting at least 4 GB available). + NODE_SPACE=${MAX_OLD_SPACE_SIZE:-3072} -NODE_OPTIONS=--max_old_space_size="$NODE_SPACE" \ - /bin/run --disable-historical=false \ - --db-schema=public "$@" & -child=$! -wait "$child" + NODE_OPTIONS=--max_old_space_size="$NODE_SPACE" \ + /bin/run --disable-historical=false \ + --db-schema=public "$@" & + child=$! + wait "$child" +else + wait +fi diff --git a/package.json b/package.json index 33103bc7..9c8fab65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polymesh-subquery", - "version": "19.6.0", + "version": "19.7.0", "author": "Polymesh Association", "license": "Apache-2.0", "description": "A Polymesh Chain Indexer, providing a GraphQL interface",