Actualize Docker setup

pull/2942/head
Victor Baranov 5 years ago
parent 813d42a067
commit 04bce6a0f6
  1. 1
      CHANGELOG.md
  2. 6
      docker/Dockerfile
  3. 172
      docker/Makefile

@ -23,6 +23,7 @@
- [2910](https://github.com/poanetwork/blockscout/pull/2910) - Reorganize queries and indexes for internal_transactions table
### Chore
- [#2942](https://github.com/poanetwork/blockscout/pull/2942) - Actualize Docker setup
- [#2896](https://github.com/poanetwork/blockscout/pull/2896) - Disable Parity websockets tests

@ -1,4 +1,4 @@
FROM bitwalker/alpine-elixir-phoenix:1.9.0
FROM bitwalker/alpine-elixir-phoenix:1.9.1
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python
@ -15,7 +15,7 @@ ADD apps/explorer/mix.exs ./apps/explorer/
ADD apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/
ADD apps/indexer/mix.exs ./apps/indexer/
RUN mix do deps.get, deps.compile
RUN mix do deps.get, local.rebar --force, deps.compile
ADD . .
@ -37,6 +37,8 @@ RUN cd apps/explorer/ && \
# RUN mix do ecto.drop --force, ecto.create, ecto.migrate
RUN mix phx.digest
# USER default
# CMD ["mix", "phx.server"]

@ -3,7 +3,7 @@ HOST = host.docker.internal
DOCKER_IMAGE = blockscout_prod
BS_CONTAINER_NAME = blockscout
PG_CONTAINER_NAME = postgres
PG_CONTAINER_IMAGE = postgres:10.6
PG_CONTAINER_IMAGE = postgres:10.10
THIS_FILE = $(lastword $(MAKEFILE_LIST))
ifeq ($(SYSTEM), Linux)
@ -16,35 +16,179 @@ BLOCKSCOUT_CONTAINNER_PARAMS = -e 'MIX_ENV=prod' \
ifeq ($(SYSTEM), Linux)
BLOCKSCOUT_CONTAINNER_PARAMS += --network=host
endif
ifdef NETWORK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK=$(NETWORK)'
endif
ifdef SUBNETWORK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUBNETWORK=$(SUBNETWORK)'
endif
ifdef NETWORK_ICON
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_ICON=$(NETWORK_ICON)'
endif
ifdef LOGO
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LOGO=$(LOGO)'
endif
ifdef LOGO_FOOTER
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LOGO_FOOTER=$(LOGO_FOOTER)'
endif
ifdef ETHEREUM_JSONRPC_VARIANT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_VARIANT=$(ETHEREUM_JSONRPC_VARIANT)'
endif
ifdef ETHEREUM_JSONRPC_HTTP_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_HTTP_URL=$(ETHEREUM_JSONRPC_HTTP_URL)'
endif
ifdef ETHEREUM_JSONRPC_TRACE_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_TRACE_URL=$(ETHEREUM_JSONRPC_TRACE_URL)'
endif
ifdef ETHEREUM_JSONRPC_WS_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_WS_URL=$(ETHEREUM_JSONRPC_WS_URL)'
endif
ifdef ETHEREUM_JSONRPC_TRACE_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_TRACE_URL=$(ETHEREUM_JSONRPC_TRACE_URL)'
ifdef ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT=$(ETHEREUM_JSONRPC_JSON_RPC_TRANSPORT)'
endif
ifdef IPC_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'IPC_PATH=$(IPC_PATH)'
endif
ifdef NETWORK_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_PATH=$(NETWORK_PATH)'
endif
ifdef CHECK_ORIGIN
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'CHECK_ORIGIN=$(CHECK_ORIGIN)'
endif
ifdef COIN
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COIN=$(COIN)'
endif
ifdef LOGO
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LOGO=$(LOGO)'
ifdef METADATA_CONTRACT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'METADATA_CONTRACT=$(METADATA_CONTRACT)'
endif
ifdef NETWORK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK=$(NETWORK)'
ifdef VALIDATORS_CONTRACT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'VALIDATORS_CONTRACT=$(VALIDATORS_CONTRACT)'
endif
ifdef SUBNETWORK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUBNETWORK=$(SUBNETWORK)'
ifdef SUPPLY_MODULE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUPPLY_MODULE=$(SUPPLY_MODULE)'
endif
ifdef NETWORK_ICON
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_ICON=$(NETWORK_ICON)'
ifdef SOURCE_MODULE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SOURCE_MODULE=$(SOURCE_MODULE)'
endif
ifdef NETWORK_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'NETWORK_PATH=$(NETWORK_PATH)'
ifdef POOL_SIZE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'POOL_SIZE=$(POOL_SIZE)'
endif
ifdef ECTO_USE_SSL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ECTO_USE_SSL=$(ECTO_USE_SSL)'
endif
ifdef DATADOG_HOST
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DATADOG_HOST=$(DATADOG_HOST)'
endif
ifdef DATADOG_PORT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DATADOG_PORT=$(DATADOG_PORT)'
endif
ifdef SPANDEX_BATCH_SIZE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SPANDEX_BATCH_SIZE=$(SPANDEX_BATCH_SIZE)'
endif
ifdef SPANDEX_SYNC_THRESHOLD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SPANDEX_SYNC_THRESHOLD=$(SPANDEX_SYNC_THRESHOLD)'
endif
ifdef HEART_BEAT_TIMEOUT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'HEART_BEAT_TIMEOUT=$(HEART_BEAT_TIMEOUT)'
endif
ifdef HEART_COMMAND
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'HEART_COMMAND=$(HEART_COMMAND)'
endif
ifdef BLOCKSCOUT_VERSION
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCKSCOUT_VERSION=$(BLOCKSCOUT_VERSION)'
endif
ifdef RELEASE_LINK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'RELEASE_LINK=$(RELEASE_LINK)'
endif
ifdef ELIXIR_VERSION
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ELIXIR_VERSION=$(ELIXIR_VERSION)'
endif
ifdef BLOCK_TRANSFORMER
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCK_TRANSFORMER=$(BLOCK_TRANSFORMER)'
endif
ifdef GRAPHIQL_TRANSACTION
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'GRAPHIQL_TRANSACTION=$(GRAPHIQL_TRANSACTION)'
endif
ifdef FIRST_BLOCK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'FIRST_BLOCK=$(FIRST_BLOCK)'
endif
ifdef LAST_BLOCK
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LAST_BLOCK=$(LAST_BLOCK)'
endif
ifdef TXS_COUNT_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'TXS_COUNT_CACHE_PERIOD=$(TXS_COUNT_CACHE_PERIOD)'
endif
ifdef ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=$(ADDRESS_WITH_BALANCES_UPDATE_INTERVAL)'
endif
ifdef LINK_TO_OTHER_EXPLORERS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'LINK_TO_OTHER_EXPLORERS=$(LINK_TO_OTHER_EXPLORERS)'
endif
ifdef COINMARKETCAP_PAGES
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COINMARKETCAP_PAGES=$(COINMARKETCAP_PAGES)'
endif
ifdef SUPPORTED_CHAINS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SUPPORTED_CHAINS=$(SUPPORTED_CHAINS)'
endif
ifdef BLOCK_COUNT_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCK_COUNT_CACHE_PERIOD=$(BLOCK_COUNT_CACHE_PERIOD)'
endif
ifdef ADDRESS_SUM_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ADDRESS_SUM_CACHE_PERIOD=$(ADDRESS_SUM_CACHE_PERIOD)'
endif
ifdef ADDRESS_COUNT_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ADDRESS_COUNT_CACHE_PERIOD=$(ADDRESS_COUNT_CACHE_PERIOD)'
endif
ifdef ALLOWED_EVM_VERSIONS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'ALLOWED_EVM_VERSIONS=$(ALLOWED_EVM_VERSIONS)'
endif
ifdef UNCLES_IN_AVERAGE_BLOCK_TIME
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'UNCLES_IN_AVERAGE_BLOCK_TIME=$(UNCLES_IN_AVERAGE_BLOCK_TIME)'
endif
ifdef AVERAGE_BLOCK_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'AVERAGE_BLOCK_CACHE_PERIOD=$(AVERAGE_BLOCK_CACHE_PERIOD)'
endif
ifdef MARKET_HISTORY_CACHE_PERIOD
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'MARKET_HISTORY_CACHE_PERIOD=$(MARKET_HISTORY_CACHE_PERIOD)'
endif
ifdef DISABLE_WEBAPP
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_WEBAPP=$(DISABLE_WEBAPP)'
endif
ifdef DISABLE_READ_API
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_READ_API=$(DISABLE_READ_API)'
endif
ifdef DISABLE_WRITE_API
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_WRITE_API=$(DISABLE_WRITE_API)'
endif
ifdef DISABLE_INDEXER
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DISABLE_INDEXER=$(DISABLE_INDEXER)'
endif
ifdef WEBAPP_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'WEBAPP_URL=$(WEBAPP_URL)'
endif
ifdef API_URL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'API_URL=$(API_URL)'
endif
ifdef CHAIN_SPEC_PATH
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'CHAIN_SPEC_PATH=$(CHAIN_SPEC_PATH)'
endif
ifdef COIN_GECKO_ID
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'COIN_GECKO_ID=$(COIN_GECKO_ID)'
endif
ifdef EMISSION_FORMAT
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'EMISSION_FORMAT=$(EMISSION_FORMAT)'
endif
ifdef REWARDS_CONTRACT_ADDRESS
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'REWARDS_CONTRACT_ADDRESS=$(REWARDS_CONTRACT_ADDRESS)'
endif
ifdef SHOW_ADDRESS_MARKETCAP_PERCENTAGE
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'SHOW_ADDRESS_MARKETCAP_PERCENTAGE=$(SHOW_ADDRESS_MARKETCAP_PERCENTAGE)'
endif
ifdef BLOCKSCOUT_PROTOCOL
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'BLOCKSCOUT_PROTOCOL=$(BLOCKSCOUT_PROTOCOL)'
endif
ifdef DECOMPILED_SMART_CONTRACT_TOKEN
BLOCKSCOUT_CONTAINNER_PARAMS += -e 'DECOMPILED_SMART_CONTRACT_TOKEN=$(DECOMPILED_SMART_CONTRACT_TOKEN)'
endif
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep ${DOCKER_IMAGE})
@ -61,7 +205,7 @@ migrate: build postgres
@echo "==> Running migrations"
@docker run --rm \
$(BLOCKSCOUT_CONTAINNER_PARAMS) \
$(DOCKER_IMAGE) /bin/sh -c "echo $$MIX_ENV && mix do ecto.drop --force, ecto.create, ecto.migrate"
$(DOCKER_IMAGE) /bin/sh -c "echo $$MIX_ENV && mix do ecto.create, ecto.migrate"
PG_EXIST := $(shell docker ps -a --filter name=${PG_CONTAINER_NAME} | grep ${PG_CONTAINER_NAME})

Loading…
Cancel
Save