From a687d47567be290de42c99127f657de97191caaa Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Wed, 8 Feb 2023 19:23:08 +0300 Subject: [PATCH] Extract Docker-compose services into separate files --- CHANGELOG.md | 1 + .../docker-compose-no-build-erigon.yml | 58 +++++-------------- .../docker-compose-no-build-ganache.yml | 56 +++++------------- .../docker-compose-no-build-geth.yml | 58 +++++-------------- ...ocker-compose-no-build-hardhat-network.yml | 56 +++++------------- .../docker-compose-no-build-nethermind.yml | 58 +++++-------------- ...ocker-compose-no-build-no-db-container.yml | 44 ++++---------- .../docker-compose-no-rust-services.yml | 22 ++----- docker-compose/docker-compose.yml | 34 +++-------- docker-compose/services/docker-compose-db.yml | 13 +++++ .../services/docker-compose-redis.yml | 11 ++++ .../services/docker-compose-sig-provider.yml | 11 ++++ ...docker-compose-smart-contract-verifier.yml | 13 +++++ .../services/docker-compose-visualizer.yml | 13 +++++ 14 files changed, 164 insertions(+), 284 deletions(-) create mode 100644 docker-compose/services/docker-compose-db.yml create mode 100644 docker-compose/services/docker-compose-redis.yml create mode 100644 docker-compose/services/docker-compose-sig-provider.yml create mode 100644 docker-compose/services/docker-compose-smart-contract-verifier.yml create mode 100644 docker-compose/services/docker-compose-visualizer.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index de6c2ed815..2579688e20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ ### Chore +- [#6845](https://github.com/blockscout/blockscout/pull/6845) - Extract Docker-compose services into separate files - [#6834](https://github.com/blockscout/blockscout/pull/6834) - Take into account FIRST_BLOCK in "Total blocks" counter on the main page - [#6340](https://github.com/blockscout/blockscout/pull/6340) - Rollback to websocket_client 1.3.0 - [#6786](https://github.com/blockscout/blockscout/pull/6786) - Refactor `try rescue` statements to keep stacktrace diff --git a/docker-compose/docker-compose-no-build-erigon.yml b/docker-compose/docker-compose-no-build-erigon.yml index bdc220c76d..b4c85bfa93 100644 --- a/docker-compose/docker-compose-no-build-erigon.yml +++ b/docker-compose/docker-compose-no-build-erigon.yml @@ -2,26 +2,14 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - volumes: - - ./postgres-data:/var/lib/postgresql/data - ports: - - 7432:5432 + extends: + file: ./services/docker-compose-db.yml + service: db blockscout: platform: linux/x86_64 @@ -53,32 +41,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/docker-compose-no-build-ganache.yml b/docker-compose/docker-compose-no-build-ganache.yml index 7508063f9b..c266de400a 100644 --- a/docker-compose/docker-compose-no-build-ganache.yml +++ b/docker-compose/docker-compose-no-build-ganache.yml @@ -2,24 +2,14 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 7432:5432 + extends: + file: ./services/docker-compose-db.yml + service: db blockscout: platform: linux/x86_64 @@ -54,32 +44,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/docker-compose-no-build-geth.yml b/docker-compose/docker-compose-no-build-geth.yml index 8256940dc3..4a54f2c9cf 100644 --- a/docker-compose/docker-compose-no-build-geth.yml +++ b/docker-compose/docker-compose-no-build-geth.yml @@ -2,26 +2,14 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - volumes: - - ./postgres-data:/var/lib/postgresql/data - ports: - - 7432:5432 + extends: + file: ./services/docker-compose-db.yml + service: db blockscout: platform: linux/x86_64 @@ -53,32 +41,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/docker-compose-no-build-hardhat-network.yml b/docker-compose/docker-compose-no-build-hardhat-network.yml index 101c7763f1..42ec0ca8cc 100644 --- a/docker-compose/docker-compose-no-build-hardhat-network.yml +++ b/docker-compose/docker-compose-no-build-hardhat-network.yml @@ -2,24 +2,14 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 7432:5432 + extends: + file: ./services/docker-compose-db.yml + service: db blockscout: platform: linux/x86_64 @@ -52,32 +42,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/docker-compose-no-build-nethermind.yml b/docker-compose/docker-compose-no-build-nethermind.yml index 0044666052..aedd7360a7 100644 --- a/docker-compose/docker-compose-no-build-nethermind.yml +++ b/docker-compose/docker-compose-no-build-nethermind.yml @@ -2,26 +2,14 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - volumes: - - ./postgres-data:/var/lib/postgresql/data - ports: - - 7432:5432 + extends: + file: ./services/docker-compose-db.yml + service: db blockscout: platform: linux/x86_64 @@ -53,32 +41,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/docker-compose-no-build-no-db-container.yml b/docker-compose/docker-compose-no-build-no-db-container.yml index 5ca1bc9bfd..6d1fec7038 100644 --- a/docker-compose/docker-compose-no-build-no-db-container.yml +++ b/docker-compose/docker-compose-no-build-no-db-container.yml @@ -2,13 +2,9 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db blockscout: platform: linux/x86_64 @@ -36,32 +32,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/docker-compose-no-rust-services.yml b/docker-compose/docker-compose-no-rust-services.yml index b8fd9fcb3b..2cfa971c48 100644 --- a/docker-compose/docker-compose-no-rust-services.yml +++ b/docker-compose/docker-compose-no-rust-services.yml @@ -2,24 +2,14 @@ version: '3.8' services: redis_db: - image: 'redis:alpine' - ports: - - 6379:6379 - container_name: redis_db - command: redis-server - volumes: - - ./redis-data:/data + extends: + file: ./services/docker-compose-redis.yml + service: redis_db db: - image: postgres:14 - restart: always - container_name: 'postgres' - environment: - POSTGRES_PASSWORD: '' - POSTGRES_USER: 'postgres' - POSTGRES_HOST_AUTH_METHOD: 'trust' - ports: - - 7432:5432 + extends: + file: ./services/docker-compose-db.yml + service: db blockscout: platform: linux/x86_64 diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 435f9fa60b..d6fcbcd672 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -58,32 +58,16 @@ services: - ./logs/:/app/logs/ smart-contract-verifier: - platform: linux/x86_64 - image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'smart-contract-verifier' - env_file: - - ./envs/common-smart-contract-verifier.env - ports: - - 8043:8043 + extends: + file: ./services/docker-compose-smart-contract-verifier.yml + service: smart-contract-verifier visualizer: - platform: linux/x86_64 - image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} - pull_policy: always - restart: always - container_name: 'visualizer' - env_file: - - ./envs/common-visualizer.env - ports: - - 8050:8050 + extends: + file: ./services/docker-compose-visualizer.yml + service: visualizer sig-provider: - platform: linux/x86_64 - image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} - pull_policy: always - restart: always - container_name: 'sig-provider' - ports: - - 8051:8050 + extends: + file: ./services/docker-compose-sig-provider.yml + service: sig-provider diff --git a/docker-compose/services/docker-compose-db.yml b/docker-compose/services/docker-compose-db.yml new file mode 100644 index 0000000000..1bead84756 --- /dev/null +++ b/docker-compose/services/docker-compose-db.yml @@ -0,0 +1,13 @@ +version: '3.8' + +services: + db: + image: postgres:14 + restart: always + container_name: 'postgres' + environment: + POSTGRES_PASSWORD: '' + POSTGRES_USER: 'postgres' + POSTGRES_HOST_AUTH_METHOD: 'trust' + ports: + - 7432:5432 diff --git a/docker-compose/services/docker-compose-redis.yml b/docker-compose/services/docker-compose-redis.yml new file mode 100644 index 0000000000..1101d9b03e --- /dev/null +++ b/docker-compose/services/docker-compose-redis.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + redis_db: + image: 'redis:alpine' + ports: + - 6379:6379 + container_name: redis_db + command: redis-server + volumes: + - ./redis-data:/data diff --git a/docker-compose/services/docker-compose-sig-provider.yml b/docker-compose/services/docker-compose-sig-provider.yml new file mode 100644 index 0000000000..1b30cb6d03 --- /dev/null +++ b/docker-compose/services/docker-compose-sig-provider.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + sig-provider: + platform: linux/x86_64 + image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-main} + pull_policy: always + restart: always + container_name: 'sig-provider' + ports: + - 8051:8050 diff --git a/docker-compose/services/docker-compose-smart-contract-verifier.yml b/docker-compose/services/docker-compose-smart-contract-verifier.yml new file mode 100644 index 0000000000..97e5daf4e5 --- /dev/null +++ b/docker-compose/services/docker-compose-smart-contract-verifier.yml @@ -0,0 +1,13 @@ +version: '3.8' + +services: + smart-contract-verifier: + platform: linux/x86_64 + image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest} + pull_policy: always + restart: always + container_name: 'smart-contract-verifier' + env_file: + - ../envs/common-smart-contract-verifier.env + ports: + - 8043:8043 diff --git a/docker-compose/services/docker-compose-visualizer.yml b/docker-compose/services/docker-compose-visualizer.yml new file mode 100644 index 0000000000..953e6fc983 --- /dev/null +++ b/docker-compose/services/docker-compose-visualizer.yml @@ -0,0 +1,13 @@ +version: '3.8' + +services: + visualizer: + platform: linux/x86_64 + image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest} + pull_policy: always + restart: always + container_name: 'visualizer' + env_file: + - ../envs/common-visualizer.env + ports: + - 8050:8050