From 294caa9946789cd7ec328e70ac70808ae0f2659c Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Tue, 12 Dec 2023 19:04:12 +0300 Subject: [PATCH] Add DATABASE_QUEUE_TARGET env --- CHANGELOG.md | 2 ++ config/runtime/dev.exs | 11 ++++++++--- config/runtime/prod.exs | 10 +++++++--- docker-compose/envs/common-blockscout.env | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4ab195fdb..c4e44e2872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Chore +- [#8991](https://github.com/blockscout/blockscout/pull/8991) - Manage DB queue target via runtime env var +
Dependencies version bumps
diff --git a/config/runtime/dev.exs b/config/runtime/dev.exs index c10a0b752a..3e4df28fb7 100644 --- a/config/runtime/dev.exs +++ b/config/runtime/dev.exs @@ -42,12 +42,15 @@ pool_size = do: ConfigHelper.parse_integer_env_var("POOL_SIZE", 30), else: ConfigHelper.parse_integer_env_var("POOL_SIZE", 40) +queue_target = ConfigHelper.parse_integer_env_var("DATABASE_QUEUE_TARGET", 50) + # Configure your database config :explorer, Explorer.Repo, database: database, hostname: hostname, url: System.get_env("DATABASE_URL"), - pool_size: pool_size + pool_size: pool_size, + queue_target: queue_target database_api = if System.get_env("DATABASE_READ_ONLY_API_URL"), do: nil, else: database hostname_api = if System.get_env("DATABASE_READ_ONLY_API_URL"), do: nil, else: hostname @@ -57,7 +60,8 @@ config :explorer, Explorer.Repo.Replica1, database: database_api, hostname: hostname_api, url: ExplorerConfigHelper.get_api_db_url(), - pool_size: ConfigHelper.parse_integer_env_var("POOL_SIZE_API", 10) + pool_size: ConfigHelper.parse_integer_env_var("POOL_SIZE_API", 10), + queue_target: queue_target database_account = if System.get_env("ACCOUNT_DATABASE_URL"), do: nil, else: database hostname_account = if System.get_env("ACCOUNT_DATABASE_URL"), do: nil, else: hostname @@ -67,7 +71,8 @@ config :explorer, Explorer.Repo.Account, database: database_account, hostname: hostname_account, url: ExplorerConfigHelper.get_account_db_url(), - pool_size: ConfigHelper.parse_integer_env_var("ACCOUNT_POOL_SIZE", 10) + pool_size: ConfigHelper.parse_integer_env_var("ACCOUNT_POOL_SIZE", 10), + queue_target: queue_target # Configure PolygonEdge database config :explorer, Explorer.Repo.PolygonEdge, diff --git a/config/runtime/prod.exs b/config/runtime/prod.exs index a8692d8c54..ce4602522a 100644 --- a/config/runtime/prod.exs +++ b/config/runtime/prod.exs @@ -28,24 +28,28 @@ config :block_scout_web, BlockScoutWeb.Endpoint, ################ pool_size = ConfigHelper.parse_integer_env_var("POOL_SIZE", 50) +queue_target = ConfigHelper.parse_integer_env_var("DATABASE_QUEUE_TARGET", 50) # Configures the database config :explorer, Explorer.Repo, url: System.get_env("DATABASE_URL"), pool_size: pool_size, - ssl: ExplorerConfigHelper.ssl_enabled?() + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target # Configures API the database config :explorer, Explorer.Repo.Replica1, url: ExplorerConfigHelper.get_api_db_url(), pool_size: ConfigHelper.parse_integer_env_var("POOL_SIZE_API", 50), - ssl: ExplorerConfigHelper.ssl_enabled?() + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target # Configures Account database config :explorer, Explorer.Repo.Account, url: ExplorerConfigHelper.get_account_db_url(), pool_size: ConfigHelper.parse_integer_env_var("ACCOUNT_POOL_SIZE", 50), - ssl: ExplorerConfigHelper.ssl_enabled?() + ssl: ExplorerConfigHelper.ssl_enabled?(), + queue_target: queue_target # Configures PolygonEdge database config :explorer, Explorer.Repo.PolygonEdge, diff --git a/docker-compose/envs/common-blockscout.env b/docker-compose/envs/common-blockscout.env index 8ea2e9265d..f8a1507ac2 100644 --- a/docker-compose/envs/common-blockscout.env +++ b/docker-compose/envs/common-blockscout.env @@ -3,6 +3,7 @@ ETHEREUM_JSONRPC_VARIANT=geth ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:8545/ # ETHEREUM_JSONRPC_FALLBACK_HTTP_URL= DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout +# DATABASE_QUEUE_TARGET ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:8545/ # ETHEREUM_JSONRPC_FALLBACK_TRACE_URL= # ETHEREUM_JSONRPC_HTTP_TIMEOUT=