From 05098b1141ad1f5cf4df1caf64778f3880d07386 Mon Sep 17 00:00:00 2001 From: bguillaumat Date: Thu, 25 Feb 2021 10:33:04 +0100 Subject: [PATCH 1/3] Update docker mempool-config --- docker/README.md | 2 +- docker/backend/mempool-config.json | 6 +++--- docker/backend/start.sh | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docker/README.md b/docker/README.md index fa8f44bb2..45c2faf46 100644 --- a/docker/README.md +++ b/docker/README.md @@ -66,7 +66,7 @@ services: MYSQL_USER: "mempool" MYSQL_PASS: "mempool" BACKEND_MAINNET_HTTP_PORT: "8999" - CACHE_DIR: "/backend/cache/" + CACHE_DIR: "/backend/cache" db: image: mariadb:10.5.8 user: "1000:1000" diff --git a/docker/backend/mempool-config.json b/docker/backend/mempool-config.json index 7f3ae6729..5ebe00e8d 100644 --- a/docker/backend/mempool-config.json +++ b/docker/backend/mempool-config.json @@ -6,7 +6,8 @@ "SPAWN_CLUSTER_PROCS": 0, "API_URL_PREFIX": "/api/v1/", "POLL_RATE_MS": 2000, - "CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__" + "CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__", + "CLEAR_PROTECTION_MINUTES": __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__ }, "CORE_RPC": { "HOST": "__BITCOIN_MAINNET_RPC_HOST__", @@ -17,8 +18,7 @@ "ELECTRUM": { "HOST": "__ELECTRS_MAINNET_HTTP_HOST__", "PORT": __ELECTRS_MAINNET_HTTP_PORT__, - "TLS_ENABLED": false, - "TX_LOOKUPS": true + "TLS_ENABLED": __ELECTRS_MAINNET_TLS_ENABLED__ }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:3000" diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 6b01c2632..a0b20402c 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -2,7 +2,8 @@ #MEMPOOL __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999} -__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./} +__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache} +__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} # BITCOIN __BITCOIN_MAINNET_RPC_HOST__=${RPC_HOST:=127.0.0.1} __BITCOIN_MAINNET_RPC_PORT__=${RPC_PORT:=8332} @@ -11,6 +12,7 @@ __BITCOIN_MAINNET_RPC_PASS__=${RPC_PASS:=mempool} # ELECTRUM __ELECTRS_MAINNET_HTTP_HOST__=${ELECTRS_HOST:=127.0.0.1} __ELECTRS_MAINNET_HTTP_PORT__=${ELECTRS_PORT:=50002} +__ELECTRS_MAINNET_TLS_ENABLED__=${ELECTRS_TLS:=false} # MYSQL __MYSQL_HOST__=${MYSQL_HOST:=127.0.0.1} __MYSQL_PORT__=${MYSQL_PORT:=3306} @@ -26,6 +28,7 @@ sed -i "s/__BITCOIN_MAINNET_RPC_USER__/${__BITCOIN_MAINNET_RPC_USER__}/g" mempoo sed -i "s/__BITCOIN_MAINNET_RPC_PASS__/${__BITCOIN_MAINNET_RPC_PASS__}/g" mempool-config.json sed -i "s/__ELECTRS_MAINNET_HTTP_HOST__/${__ELECTRS_MAINNET_HTTP_HOST__}/g" mempool-config.json sed -i "s/__ELECTRS_MAINNET_HTTP_PORT__/${__ELECTRS_MAINNET_HTTP_PORT__}/g" mempool-config.json +sed -i "s/__ELECTRS_MAINNET_TLS_ENABLED__/${__ELECTRS_MAINNET_TLS_ENABLED__}/g" mempool-config.json sed -i "s/__MYSQL_HOST__/${__MYSQL_HOST__}/g" mempool-config.json sed -i "s/__MYSQL_PORT__/${__MYSQL_PORT__}/g" mempool-config.json sed -i "s/__MYSQL_DATABASE__/${__MYSQL_DATABASE__}/g" mempool-config.json @@ -33,5 +36,6 @@ sed -i "s/__MYSQL_USERNAME__/${__MYSQL_USERNAME__}/g" mempool-config.json sed -i "s/__MYSQL_PASSWORD__/${__MYSQL_PASSWORD__}/g" mempool-config.json sed -i "s!__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__!${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}!g" mempool-config.json sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/${__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__}/g" mempool-config.json +sed -i "s/__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json node /backend/dist/index.js From 4a24a173d31f4562b53106884062d8a6c75fc993 Mon Sep 17 00:00:00 2001 From: bguillaumat Date: Thu, 25 Feb 2021 10:40:14 +0100 Subject: [PATCH 2/3] Update docker README --- docker/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/README.md b/docker/README.md index 45c2faf46..09ec33bf3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -60,6 +60,7 @@ services: RPC_PASS: "mempool" ELECTRS_HOST: "127.0.0.1" ELECTRS_PORT: "50002" + ELECTRS_TLS: "false" MYSQL_HOST: "db" MYSQL_PORT: "3306" MYSQL_DATABASE: "mempool" @@ -67,6 +68,7 @@ services: MYSQL_PASS: "mempool" BACKEND_MAINNET_HTTP_PORT: "8999" CACHE_DIR: "/backend/cache" + MEMPOOL_CLEAR_PROTECTION_MINUTES: "20" db: image: mariadb:10.5.8 user: "1000:1000" From 9e2581d73404b37e89fb17d653e5bcc9a2c992cc Mon Sep 17 00:00:00 2001 From: bguillaumat Date: Fri, 26 Feb 2021 09:04:14 +0100 Subject: [PATCH 3/3] Update var from ELECTRS to ELECTRUM for more compatibility --- docker/README.md | 8 ++++---- docker/backend/mempool-config.json | 6 +++--- docker/backend/start.sh | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docker/README.md b/docker/README.md index 09ec33bf3..aad836609 100644 --- a/docker/README.md +++ b/docker/README.md @@ -58,9 +58,9 @@ services: RPC_PORT: "8332" RPC_USER: "mempool" RPC_PASS: "mempool" - ELECTRS_HOST: "127.0.0.1" - ELECTRS_PORT: "50002" - ELECTRS_TLS: "false" + ELECTRUM_HOST: "127.0.0.1" + ELECTRUM_PORT: "50002" + ELECTRUM_TLS: "false" MYSQL_HOST: "db" MYSQL_PORT: "3306" MYSQL_DATABASE: "mempool" @@ -85,7 +85,7 @@ services: ``` -You can update all the environment variables inside the API container, especially the RPC and ELECTRS ones +You can update all the environment variables inside the API container, especially the RPC and ELECTRUM ones ## Run it diff --git a/docker/backend/mempool-config.json b/docker/backend/mempool-config.json index 5ebe00e8d..ea0034aab 100644 --- a/docker/backend/mempool-config.json +++ b/docker/backend/mempool-config.json @@ -16,9 +16,9 @@ "PASSWORD": "__BITCOIN_MAINNET_RPC_PASS__" }, "ELECTRUM": { - "HOST": "__ELECTRS_MAINNET_HTTP_HOST__", - "PORT": __ELECTRS_MAINNET_HTTP_PORT__, - "TLS_ENABLED": __ELECTRS_MAINNET_TLS_ENABLED__ + "HOST": "__ELECTRUM_MAINNET_HTTP_HOST__", + "PORT": __ELECTRUM_MAINNET_HTTP_PORT__, + "TLS_ENABLED": __ELECTRUM_MAINNET_TLS_ENABLED__ }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:3000" diff --git a/docker/backend/start.sh b/docker/backend/start.sh index a0b20402c..22715f8b1 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -10,9 +10,9 @@ __BITCOIN_MAINNET_RPC_PORT__=${RPC_PORT:=8332} __BITCOIN_MAINNET_RPC_USER__=${RPC_USER:=mempool} __BITCOIN_MAINNET_RPC_PASS__=${RPC_PASS:=mempool} # ELECTRUM -__ELECTRS_MAINNET_HTTP_HOST__=${ELECTRS_HOST:=127.0.0.1} -__ELECTRS_MAINNET_HTTP_PORT__=${ELECTRS_PORT:=50002} -__ELECTRS_MAINNET_TLS_ENABLED__=${ELECTRS_TLS:=false} +__ELECTRUM_MAINNET_HTTP_HOST__=${ELECTRUM_HOST:=127.0.0.1} +__ELECTRUM_MAINNET_HTTP_PORT__=${ELECTRUM_PORT:=50002} +__ELECTRUM_MAINNET_TLS_ENABLED__=${ELECTRUM_TLS:=false} # MYSQL __MYSQL_HOST__=${MYSQL_HOST:=127.0.0.1} __MYSQL_PORT__=${MYSQL_PORT:=3306} @@ -26,9 +26,9 @@ sed -i "s/__BITCOIN_MAINNET_RPC_HOST__/${__BITCOIN_MAINNET_RPC_HOST__}/g" mempoo sed -i "s/__BITCOIN_MAINNET_RPC_PORT__/${__BITCOIN_MAINNET_RPC_PORT__}/g" mempool-config.json sed -i "s/__BITCOIN_MAINNET_RPC_USER__/${__BITCOIN_MAINNET_RPC_USER__}/g" mempool-config.json sed -i "s/__BITCOIN_MAINNET_RPC_PASS__/${__BITCOIN_MAINNET_RPC_PASS__}/g" mempool-config.json -sed -i "s/__ELECTRS_MAINNET_HTTP_HOST__/${__ELECTRS_MAINNET_HTTP_HOST__}/g" mempool-config.json -sed -i "s/__ELECTRS_MAINNET_HTTP_PORT__/${__ELECTRS_MAINNET_HTTP_PORT__}/g" mempool-config.json -sed -i "s/__ELECTRS_MAINNET_TLS_ENABLED__/${__ELECTRS_MAINNET_TLS_ENABLED__}/g" mempool-config.json +sed -i "s/__ELECTRUM_MAINNET_HTTP_HOST__/${__ELECTRUM_MAINNET_HTTP_HOST__}/g" mempool-config.json +sed -i "s/__ELECTRUM_MAINNET_HTTP_PORT__/${__ELECTRUM_MAINNET_HTTP_PORT__}/g" mempool-config.json +sed -i "s/__ELECTRUM_MAINNET_TLS_ENABLED__/${__ELECTRUM_MAINNET_TLS_ENABLED__}/g" mempool-config.json sed -i "s/__MYSQL_HOST__/${__MYSQL_HOST__}/g" mempool-config.json sed -i "s/__MYSQL_PORT__/${__MYSQL_PORT__}/g" mempool-config.json sed -i "s/__MYSQL_DATABASE__/${__MYSQL_DATABASE__}/g" mempool-config.json