From 4173486f4d71723704b32723ed36a3f0088a4077 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Sun, 9 Jan 2022 22:18:29 -0800 Subject: [PATCH 01/17] Update the template backend mempool-config.json file used by the Docker image --- docker/backend/mempool-config.json | 44 +++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/docker/backend/mempool-config.json b/docker/backend/mempool-config.json index ea0034aab..4ae23123e 100644 --- a/docker/backend/mempool-config.json +++ b/docker/backend/mempool-config.json @@ -1,13 +1,20 @@ { "MEMPOOL": { - "NETWORK": "mainnet", - "BACKEND": "electrum", + "NETWORK": "__MEMPOOL_BACKEND_NETWORK__", + "BACKEND": "__MEMPOOL_BACKEND__", "HTTP_PORT": __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__, - "SPAWN_CLUSTER_PROCS": 0, - "API_URL_PREFIX": "/api/v1/", - "POLL_RATE_MS": 2000, + "SPAWN_CLUSTER_PROCS": __MEMPOOL_SPAWN_CLUSTER_PROCS__, + "API_URL_PREFIX": "__MEMPOOL_API_URL_PREFIX__", + "POLL_RATE_MS": __MEMPOOL_POLL_RATE_MS__, "CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__", - "CLEAR_PROTECTION_MINUTES": __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__ + "CLEAR_PROTECTION_MINUTES": __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__, + "RECOMMENDED_FEE_PERCENTILE": __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__, + "BLOCK_WEIGHT_UNITS": __MEMPOOL_BLOCK_WEIGHT_UNITS__, + "INITIAL_BLOCKS_AMOUNT": __MEMPOOL_INITIAL_BLOCKS_AMOUNT__, + "MEMPOOL_BLOCKS_AMOUNT": __MEMPOOL_BLOCKS_AMOUNT__, + "PRICE_FEED_UPDATE_INTERVAL": __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__, + "USE_SECOND_NODE_FOR_MINFEE": __MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__, + "EXTERNAL_ASSETS": __MEMPOOL_EXTERNAL_ASSETS__ }, "CORE_RPC": { "HOST": "__BITCOIN_MAINNET_RPC_HOST__", @@ -21,18 +28,35 @@ "TLS_ENABLED": __ELECTRUM_MAINNET_TLS_ENABLED__ }, "ESPLORA": { - "REST_API_URL": "http://127.0.0.1:3000" + "REST_API_URL": "__ESPLORA_REST_API_URL__" + }, + "SECOND_CORE_RPC": { + "HOST": "__SECOND_RPC_HOST__", + "PORT": __SECOND_RPC_PORT__, + "USERNAME": "__SECOND_RPC_USER__", + "PASSWORD": "__SECOND_RPC_PASS__" }, "DATABASE": { - "ENABLED": true, + "ENABLED": __MYSQL_ENABLED__, "HOST": "__MYSQL_HOST__", "PORT": __MYSQL_PORT__, "DATABASE": "__MYSQL_DATABASE__", "USERNAME": "__MYSQL_USERNAME__", "PASSWORD": "__MYSQL_PASSWORD__" }, + "SYSLOG": { + "ENABLED": __SYSLOG_ENABLED__, + "HOST": "__SYSLOG_HOST__", + "PORT": __SYSLOG_PORT__, + "MIN_PRIORITY": "__SYSLOG_MIN_PRIORITY__", + "FACILITY": "__SYSLOG_FACILITY__" + }, "STATISTICS": { - "ENABLED": true, - "TX_PER_SECOND_SAMPLE_PERIOD": 150 + "ENABLED": __STATISTICS_ENABLED__, + "TX_PER_SECOND_SAMPLE_PERIOD": __STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__ + }, + "BISQ": { + "ENABLED": __BISQ_ENABLED__, + "DATA_PATH": "__BISQ_DATA_PATH__" } } From 09fe7346bc8cc23f0b70a535815503ffc4ecc3b6 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Sun, 9 Jan 2022 22:19:04 -0800 Subject: [PATCH 02/17] Make every backend parameter configurable via environment variables --- docker/backend/start.sh | 81 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 90aa2b11d..6c8f30bae 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -1,27 +1,82 @@ #!/bin/sh -#MEMPOOL +# MEMPOOL +__MEMPOOL_BACKEND_NETWORK__=${MEMPOOL_BACKEND_NETWORK:=mainnet} +__MEMPOOL_BACKEND__=${MEMPOOL_BACKEND:=electrum} __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999} +__MEMPOOL_SPAWN_CLUSTER_PROCS__=${MEMPOOL_SPAWN_CLUSTER_PROCS:=0} +__MEMPOOL_API_URL_PREFIX__=${MEMPOOL_API_URL_PREFIX:=/api/v1/} +__MEMPOOL_POLL_RATE_MS__=${MEMPOOL_POLL_RATE_MS:=2000} __MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache} __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} -# BITCOIN +__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__=${MEMPOOL_RECOMMENDED_FEE_PERCENTILE:=50} +__MEMPOOL_BLOCK_WEIGHT_UNITS__:${EMPOOL_BLOCK_WEIGHT_UNITS:=4000000} +__MEMPOOL_INITIAL_BLOCKS_AMOUNT__=${MEMPOOL_INITIAL_BLOCKS_AMOUNT:=8} +__MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_BLOCKS_AMOUNT:=8} +__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__=${MEMPOOL_PRICE_FEED_UPDATE_INTERVAL:=3600} +__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__=${MEMPOOL_USE_SECOND_NODE_FOR_MINFEE:=false} +__MEMPOOL_EXTERNAL_ASSETS__=${MEMPOOL_EXTERNAL_ASSETS:=[]} + +# CORE_RPC __BITCOIN_MAINNET_RPC_HOST__=${RPC_HOST:=127.0.0.1} __BITCOIN_MAINNET_RPC_PORT__=${RPC_PORT:=8332} __BITCOIN_MAINNET_RPC_USER__=${RPC_USER:=mempool} __BITCOIN_MAINNET_RPC_PASS__=${RPC_PASS:=mempool} + # ELECTRUM __ELECTRUM_MAINNET_HTTP_HOST__=${ELECTRUM_HOST:=127.0.0.1} -__ELECTRUM_MAINNET_HTTP_PORT__=${ELECTRUM_PORT:=50002} # 50001? +__ELECTRUM_MAINNET_HTTP_PORT__=${ELECTRUM_PORT:=50002} __ELECTRUM_MAINNET_TLS_ENABLED__=${ELECTRUM_TLS:=false} -# MYSQL + +# ESPLORA +__ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} + +# SECOND_CORE_RPC +__SECOND_RPC_HOST__=${SECOND_RPC_HOST:=127.0.0.1} +__SECOND_RPC_PORT__=${SECOND_RPC_PORT:=8332} +__SECOND_RPC_USER__=${SECOND_RPC_USER:=mempool} +__SECOND_RPC_PASS__=${SECOND_RPC_PASS:=mempool} + +# DATABASE +__MYSQL_ENABLED__=${MYSQL_ENABLED:=true} __MYSQL_HOST__=${MYSQL_HOST:=127.0.0.1} __MYSQL_PORT__=${MYSQL_PORT:=3306} __MYSQL_DATABASE__=${MYSQL_DATABASE:=mempool} __MYSQL_USERNAME__=${MYSQL_USER:=mempool} __MYSQL_PASSWORD__=${MYSQL_PASS:=mempool} +# SYSLOG +__SYSLOG_ENABLED__=${SYSLOG_ENABLED:=false} +__SYSLOG_HOST__=${SYSLOG_HOST:=127.0.0.1} +__SYSLOG_PORT__=${SYSLOG_PORT:=514} +__SYSLOG_MIN_PRIORITY__=${SYSLOG_MIN_PRIORITY:=info} +__SYSLOG_FACILITY__=${SYSLOG_FACILITY:=local7} + +# STATISTICS +__STATISTICS_ENABLED__=${STATISTICS_ENABLED:=false} +__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__=${STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD:=150} + +# BISQ +__BISQ_ENABLED__=${BISQ_ENABLED:=false} +__BISQ_DATA_PATH__=${BISQ_DATA_PATH:=/bisq/statsnode-data/btc_mainnet/db} + mkdir -p "${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}" +sed -i "s/__MEMPOOL_BACKEND_NETWORK__/${__MEMPOOL_BACKEND_NETWORK__}/g" mempool-config.json +sed -i "s/__MEMPOOL_BACKEND__/${__MEMPOOL_BACKEND__}/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_SPAWN_CLUSTER_PROCS__/${__MEMPOOL_SPAWN_CLUSTER_PROCS__}/g" mempool-config.json +sed -i "s/__MEMPOOL_API_URL_PREFIX__/${__MEMPOOL_API_URL_PREFIX__}/g" mempool-config.json +sed -i "s/__MEMPOOL_POLL_RATE_MS__/${__MEMPOOL_POLL_RATE_MS__}/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_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json +sed -i "s/__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__/${__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__}/g" mempool-config.json +sed -i "s/__MEMPOOL_BLOCK_WEIGHT_UNITS__/${__MEMPOOL_BLOCK_WEIGHT_UNITS__}/g" mempool-config.json +sed -i "s/__MEMPOOL_INITIAL_BLOCKS_AMOUNT__/${__MEMPOOL_INITIAL_BLOCKS_AMOUNT__}/g" mempool-config.json +sed -i "s/__MEMPOOL_BLOCKS_AMOUNT__/${__MEMPOOL_BLOCKS_AMOUNT__}/g" mempool-config.json +sed -i "s/__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__/${__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__}/g" mempool-config.json +sed -i "s/__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__/${__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__}/g" mempool-config.json +sed -i "s/__MEMPOOL_EXTERNAL_ASSETS__/${__MEMPOOL_EXTERNAL_ASSETS__}/g" mempool-config.json sed -i "s/__BITCOIN_MAINNET_RPC_HOST__/${__BITCOIN_MAINNET_RPC_HOST__}/g" mempool-config.json 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 @@ -29,13 +84,25 @@ sed -i "s/__BITCOIN_MAINNET_RPC_PASS__/${__BITCOIN_MAINNET_RPC_PASS__}/g" mempoo 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/__ESPLORA_REST_API_URL__/${__ESPLORA_REST_API_URL__}/g" mempool-config.json +sed -i "s/__SECOND_RPC_HOST__/${__SECOND_RPC_HOST__}/g" mempool-config.json +sed -i "s/__SECOND_RPC_PORT__/${__SECOND_RPC_PORT__}/g" mempool-config.json +sed -i "s/__SECOND_RPC_USER__/${__SECOND_RPC_USER__}/g" mempool-config.json +sed -i "s/__SECOND_RPC_PASS__/${__SECOND_RPC_PASS__}/g" mempool-config.json +sed -i "s/__MYSQL_ENABLED__/${__MYSQL_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 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 +sed -i "s/__SYSLOG_ENABLED__/${__SYSLOG_ENABLED__}/g" mempool-config.json +sed -i "s/__SYSLOG_HOST__/${__SYSLOG_HOST__}/g" mempool-config.json +sed -i "s/__SYSLOG_PORT__/${__SYSLOG_PORT__}/g" mempool-config.json +sed -i "s/__SYSLOG_MIN_PRIORITY__/${__SYSLOG_MIN_PRIORITY__}/g" mempool-config.json +sed -i "s/__SYSLOG_FACILITY__/${__SYSLOG_FACILITY__}/g" mempool-config.json +sed -i "s/__STATISTICS_ENABLED__/${__STATISTICS_ENABLED__}/g" mempool-config.json +sed -i "s/__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__/${__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__}/g" mempool-config.json +sed -i "s/__BISQ_ENABLED__/${__BISQ_ENABLED__}/g" mempool-config.json +sed -i "s/__BISQ_DATA_PATH__/${__BISQ_DATA_PATH__}/g" mempool-config.json node /backend/dist/index.js From 513886f6d20a7cc42925a27bd5c62f85daab1634 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 00:08:42 -0800 Subject: [PATCH 03/17] Fix typo on the docker start script --- docker/backend/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 6c8f30bae..ebcec5122 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -10,7 +10,7 @@ __MEMPOOL_POLL_RATE_MS__=${MEMPOOL_POLL_RATE_MS:=2000} __MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache} __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__=${MEMPOOL_RECOMMENDED_FEE_PERCENTILE:=50} -__MEMPOOL_BLOCK_WEIGHT_UNITS__:${EMPOOL_BLOCK_WEIGHT_UNITS:=4000000} +__MEMPOOL_BLOCK_WEIGHT_UNITS__:${MEMPOOL_BLOCK_WEIGHT_UNITS:=4000000} __MEMPOOL_INITIAL_BLOCKS_AMOUNT__=${MEMPOOL_INITIAL_BLOCKS_AMOUNT:=8} __MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_BLOCKS_AMOUNT:=8} __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__=${MEMPOOL_PRICE_FEED_UPDATE_INTERVAL:=3600} From ba895559bf2ac24bac8676fd40408a1f85309b9d Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 00:42:42 -0800 Subject: [PATCH 04/17] Fix a few sed commands in the Docker backend start script that needed escaping --- docker/backend/start.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/backend/start.sh b/docker/backend/start.sh index ebcec5122..d73a6587e 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -10,7 +10,7 @@ __MEMPOOL_POLL_RATE_MS__=${MEMPOOL_POLL_RATE_MS:=2000} __MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache} __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__=${MEMPOOL_RECOMMENDED_FEE_PERCENTILE:=50} -__MEMPOOL_BLOCK_WEIGHT_UNITS__:${MEMPOOL_BLOCK_WEIGHT_UNITS:=4000000} +__MEMPOOL_BLOCK_WEIGHT_UNITS__=${MEMPOOL_BLOCK_WEIGHT_UNITS:=4000000} __MEMPOOL_INITIAL_BLOCKS_AMOUNT__=${MEMPOOL_INITIAL_BLOCKS_AMOUNT:=8} __MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_BLOCKS_AMOUNT:=8} __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__=${MEMPOOL_PRICE_FEED_UPDATE_INTERVAL:=3600} @@ -66,9 +66,9 @@ sed -i "s/__MEMPOOL_BACKEND_NETWORK__/${__MEMPOOL_BACKEND_NETWORK__}/g" mempool- sed -i "s/__MEMPOOL_BACKEND__/${__MEMPOOL_BACKEND__}/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_SPAWN_CLUSTER_PROCS__/${__MEMPOOL_SPAWN_CLUSTER_PROCS__}/g" mempool-config.json -sed -i "s/__MEMPOOL_API_URL_PREFIX__/${__MEMPOOL_API_URL_PREFIX__}/g" mempool-config.json +sed -i "s!__MEMPOOL_API_URL_PREFIX__!${__MEMPOOL_API_URL_PREFIX__}!g" mempool-config.json sed -i "s/__MEMPOOL_POLL_RATE_MS__/${__MEMPOOL_POLL_RATE_MS__}/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_CACHE_DIR__!${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}!g" mempool-config.json sed -i "s/__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json sed -i "s/__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__/${__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__}/g" mempool-config.json sed -i "s/__MEMPOOL_BLOCK_WEIGHT_UNITS__/${__MEMPOOL_BLOCK_WEIGHT_UNITS__}/g" mempool-config.json @@ -84,7 +84,7 @@ sed -i "s/__BITCOIN_MAINNET_RPC_PASS__/${__BITCOIN_MAINNET_RPC_PASS__}/g" mempoo 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/__ESPLORA_REST_API_URL__/${__ESPLORA_REST_API_URL__}/g" mempool-config.json +sed -i "s!__ESPLORA_REST_API_URL__!${__ESPLORA_REST_API_URL__}!g" mempool-config.json sed -i "s/__SECOND_RPC_HOST__/${__SECOND_RPC_HOST__}/g" mempool-config.json sed -i "s/__SECOND_RPC_PORT__/${__SECOND_RPC_PORT__}/g" mempool-config.json sed -i "s/__SECOND_RPC_USER__/${__SECOND_RPC_USER__}/g" mempool-config.json @@ -103,6 +103,6 @@ sed -i "s/__SYSLOG_FACILITY__/${__SYSLOG_FACILITY__}/g" mempool-config.json sed -i "s/__STATISTICS_ENABLED__/${__STATISTICS_ENABLED__}/g" mempool-config.json sed -i "s/__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__/${__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__}/g" mempool-config.json sed -i "s/__BISQ_ENABLED__/${__BISQ_ENABLED__}/g" mempool-config.json -sed -i "s/__BISQ_DATA_PATH__/${__BISQ_DATA_PATH__}/g" mempool-config.json +sed -i "s!__BISQ_DATA_PATH__!${__BISQ_DATA_PATH__}!g" mempool-config.json node /backend/dist/index.js From 745b7d6f65a99042ca7dfe75a74e145c8a7fae0e Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 16:10:34 -0800 Subject: [PATCH 05/17] Set statistics to enabled by default --- docker/backend/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/backend/start.sh b/docker/backend/start.sh index d73a6587e..0c5ae8461 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -53,7 +53,7 @@ __SYSLOG_MIN_PRIORITY__=${SYSLOG_MIN_PRIORITY:=info} __SYSLOG_FACILITY__=${SYSLOG_FACILITY:=local7} # STATISTICS -__STATISTICS_ENABLED__=${STATISTICS_ENABLED:=false} +__STATISTICS_ENABLED__=${STATISTICS_ENABLED:=true} __STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__=${STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD:=150} # BISQ From 2d292e27b91c5f593ddab5b8bf2a1a5f97fa04f4 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 20:31:36 -0800 Subject: [PATCH 06/17] Add the empty directories needed by docker-compose --- docker/data/.gitkeep | 0 docker/mysql/data/.gitkeep | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 docker/data/.gitkeep create mode 100644 docker/mysql/data/.gitkeep diff --git a/docker/data/.gitkeep b/docker/data/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/docker/mysql/data/.gitkeep b/docker/mysql/data/.gitkeep new file mode 100644 index 000000000..e69de29bb From 6cb26253036e3da45ec1155c8b216fbe70e35f6e Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 21:09:06 -0800 Subject: [PATCH 07/17] Update the reference docker-compose.yml file --- docker/docker-compose.yml | 52 ++++++++++----------------------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 1731d1aaa..0ae605599 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,23 +1,10 @@ version: "3.7" services: - - electrum: - build: - context: . - dockerfile: docker/electrum/Dockerfile - user: "1000:1000" - restart: on-failure - command: "" - ports: - - 50001:50001 - - 50002:50002 - - 4224:4224 - - 8332:8332 - environment: - ELECTRUM: "electrum" - # add electrs configs web: + environment: + FRONTEND_HTTP_PORT: "8080" + BACKEND_MAINNET_HTTP_HOST: "api" image: mempool/frontend:latest user: "1000:1000" restart: on-failure @@ -25,10 +12,14 @@ services: command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'" ports: - 80:8080 - environment: - FRONTEND_HTTP_PORT: "8080" - BACKEND_MAINNET_HTTP_HOST: "api" api: + environment: + MEMPOOL_BACKEND: "none" + RPC_HOST: "172.27.0.1" + RPC_PORT: "8332" + MYSQL_ENABLED: "true" + MYSQL_HOST: "db" + STATISTICS_ENABLED: "true" image: mempool/backend:latest user: "1000:1000" restart: on-failure @@ -36,32 +27,15 @@ services: command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh" volumes: - ./data:/backend/cache + db: environment: - RPC_HOST: "127.0.0.1" - RPC_PORT: "8332" - RPC_USER: "mempool" - RPC_PASS: "mempool" - ELECTRUM_HOST: "127.0.0.1" - ELECTRUM_PORT: "50002" - ELECTRUM_TLS: "false" - MYSQL_HOST: "db" - MYSQL_PORT: "3306" MYSQL_DATABASE: "mempool" MYSQL_USER: "mempool" - MYSQL_PASS: "mempool" - BACKEND_MAINNET_HTTP_PORT: "8999" - CACHE_DIR: "/backend/cache" - MEMPOOL_CLEAR_PROTECTION_MINUTES: "20" - db: + MYSQL_PASSWORD: "mempool" + MYSQL_ROOT_PASSWORD: "admin" image: mariadb:10.5.8 user: "1000:1000" restart: on-failure stop_grace_period: 1m volumes: - ./mysql/data:/var/lib/mysql - - ./mysql/db-scripts:/docker-entrypoint-initdb.d - environment: - MYSQL_DATABASE: "mempool" - MYSQL_USER: "mempool" - MYSQL_PASSWORD: "mempool" - MYSQL_ROOT_PASSWORD: "admin" From bfb5abaa71c4f8718bd33dadab1e9ffe1911eacb Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 21:10:58 -0800 Subject: [PATCH 08/17] Update Docker README file --- docker/README.md | 113 ++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 75 deletions(-) diff --git a/docker/README.md b/docker/README.md index 914d2da13..57d4695c7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,96 +1,59 @@ # Docker -## Initialization +This directory contains the Dockerfiles used to build and release the official images and a `docker-compose.yml` file that is intended for end users to run a Mempool instance with minimal effort. -In an empty dir create 2 sub-dirs +## Basic setup + +To run an instance with the default settings, use the following command: ```bash -mkdir -p data mysql/data +$ docker-compose up ``` -Your dir should now look like that: +The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. -```bash -$ls -R -.: -data mysql +You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected. -./data: +## Advanced setup -./mysql: -data db-scripts +In order to run with electrum/electrs as the backend you will need to make the following changes to the `docker-compose.yml` file: + +- Under the `api` service, change the value of `MEMPOOL_BACKEND` key from `none` to `electrum`: -./mysql/data: ``` - -In the main dir add the following `docker-compose.yml` - -```bash -version: "3.7" - -services: - web: - image: mempool/frontend:latest - user: "1000:1000" - restart: on-failure - stop_grace_period: 1m - command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'" - ports: - - 80:8080 - environment: - FRONTEND_HTTP_PORT: "8080" - BACKEND_MAINNET_HTTP_HOST: "api" api: - image: mempool/backend:latest - user: "1000:1000" - restart: on-failure - stop_grace_period: 1m - command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh" - volumes: - - ./data:/backend/cache environment: - RPC_HOST: "127.0.0.1" - RPC_PORT: "8332" - RPC_USER: "mempool" - RPC_PASS: "mempool" - ELECTRUM_HOST: "127.0.0.1" + MEMPOOL_BACKEND: "none" +``` + +- Under the `api` service, set the `ELECTRUM_HOST` and `ELECTRUM_PORT` keys to your Docker host ip address and set `ELECTRUM_TLS_ENABLED` to `false`: + +``` + api: + environment: + ELECTRUM_HOST: "172.27.0.1" ELECTRUM_PORT: "50002" ELECTRUM_TLS: "false" - MYSQL_HOST: "db" - MYSQL_PORT: "3306" - MYSQL_DATABASE: "mempool" - MYSQL_USER: "mempool" - 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" - restart: on-failure - stop_grace_period: 1m - volumes: - - ./mysql/data:/var/lib/mysql - - ./mysql/db-scripts:/docker-entrypoint-initdb.d - environment: - MYSQL_DATABASE: "mempool" - MYSQL_USER: "mempool" - MYSQL_PASSWORD: "mempool" - MYSQL_ROOT_PASSWORD: "admin" +``` -``` +You can update any of the settings in the `mempool-config.json` file using the environment variables to override. Refer to the `start.sh` script for a list of variables and their default values. -You can update all the environment variables inside the API container, especially the RPC and ELECTRUM ones +## Troubleshooting -## Run it - -To run our docker-compose use the following cmd: - -```bash -docker-compose up -``` - -If everything went okay you should see the beautiful mempool :grin: +If you already have something running on port 80, change it to something else under the `web` service section. If you get stuck on "loading blocks", this means the websocket can't connect. -Check your nginx proxy setup, firewalls, etc. and open an issue if you need help. + +If you can't connect to the `bitcoind` RPC server, check your firewall settings and your `bitcoin.conf` file, it should contain at least these settings: + +``` +rpcallowip=0.0.0.0/0 +rpcuser=mempool +rpcpassword=mempool +bind=0.0.0.0:8333 +rpcbind=0.0.0.0:8332 +``` + +If you can't connect to electrum/electrs, check your firewall settings and the IP you entered. + +If you see a permission denied error coming from the database container, check your filesystem. The cache files generated by the backend will be stored in the `./data` directory and the database will be stored in the `./mysql/data` directory relative to the location of the `docker-compose.yml` file. If you move it somewhere, the paths will have to be updated and/or recreated. From 3a0fb2015af92c8469fd4d9e5d7d4fa81a0aafb6 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 22:06:15 -0800 Subject: [PATCH 09/17] Address feedback on the Docker README --- docker/README.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 57d4695c7..8e30dfa62 100644 --- a/docker/README.md +++ b/docker/README.md @@ -2,7 +2,7 @@ This directory contains the Dockerfiles used to build and release the official images and a `docker-compose.yml` file that is intended for end users to run a Mempool instance with minimal effort. -## Basic setup +## bitcoind only configuration To run an instance with the default settings, use the following command: @@ -10,13 +10,32 @@ To run an instance with the default settings, use the following command: $ docker-compose up ``` -The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. +The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. It assumes you have added RPC credentials for the `mempool` user with a `mempool` password in your `bitcoin.conf` file: + +``` +rpcuser=mempool +rpcpassword=mempool +``` + +If you want to use your current credentials, update them in the `docker-compose.yml` file: + +``` + api: + environment: + MEMPOOL_BACKEND: "none" + RPC_HOST: "172.27.0.1" + RPC_PORT: "8332" + RPC_USER: "mempool" + RPC_PASS: "mempool" +``` + +Note: the IP in the example above refers to Docker's default gateway IP address so the container can hit the `bitcoind` instance running on the host machine. If your setup is different, update it accordingly. You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected. -## Advanced setup +## bitcoind+romanz/electrs configuration -In order to run with electrum/electrs as the backend you will need to make the following changes to the `docker-compose.yml` file: +In order to run with `romanz/electrs` as the backend , in addition to the settings required for `bitcoind` above, you will need to make the following changes to the `docker-compose.yml` file: - Under the `api` service, change the value of `MEMPOOL_BACKEND` key from `none` to `electrum`: From 467cac7d4d1acdf4e05d0be03ae93f8aead6943c Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 22:11:02 -0800 Subject: [PATCH 10/17] Remove the troubleshooting section from the Docker README --- docker/README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/docker/README.md b/docker/README.md index 8e30dfa62..65c0790c7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -56,23 +56,3 @@ In order to run with `romanz/electrs` as the backend , in addition to the settin ``` You can update any of the settings in the `mempool-config.json` file using the environment variables to override. Refer to the `start.sh` script for a list of variables and their default values. - -## Troubleshooting - -If you already have something running on port 80, change it to something else under the `web` service section. - -If you get stuck on "loading blocks", this means the websocket can't connect. - -If you can't connect to the `bitcoind` RPC server, check your firewall settings and your `bitcoin.conf` file, it should contain at least these settings: - -``` -rpcallowip=0.0.0.0/0 -rpcuser=mempool -rpcpassword=mempool -bind=0.0.0.0:8333 -rpcbind=0.0.0.0:8332 -``` - -If you can't connect to electrum/electrs, check your firewall settings and the IP you entered. - -If you see a permission denied error coming from the database container, check your filesystem. The cache files generated by the backend will be stored in the `./data` directory and the database will be stored in the `./mysql/data` directory relative to the location of the `docker-compose.yml` file. If you move it somewhere, the paths will have to be updated and/or recreated. From 865fe488bfe4351cd21b8b18a4301d4ad687df7e Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 23:30:31 -0800 Subject: [PATCH 11/17] Make the RPC user and pass explicit in the example docker-compose file --- docker/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 0ae605599..d1a24a007 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -17,6 +17,8 @@ services: MEMPOOL_BACKEND: "none" RPC_HOST: "172.27.0.1" RPC_PORT: "8332" + RPC_USER: "mempool" + RPC_PASS: "mempool" MYSQL_ENABLED: "true" MYSQL_HOST: "db" STATISTICS_ENABLED: "true" From ce8518ad584559163583fd044378288c77d95880 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Mon, 10 Jan 2022 23:31:05 -0800 Subject: [PATCH 12/17] List all environment variables to override in the README --- docker/README.md | 174 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 65c0790c7..d0de0d282 100644 --- a/docker/README.md +++ b/docker/README.md @@ -55,4 +55,176 @@ In order to run with `romanz/electrs` as the backend , in addition to the settin ELECTRUM_TLS: "false" ``` -You can update any of the settings in the `mempool-config.json` file using the environment variables to override. Refer to the `start.sh` script for a list of variables and their default values. +You can update any of the backend settings in the `mempool-config.json` file using the following environment variables to override them. + +JSON: +``` + "MEMPOOL": { + "NETWORK": "mainnet", + "BACKEND": "electrum", + "HTTP_PORT": 8999, + "SPAWN_CLUSTER_PROCS": 0, + "API_URL_PREFIX": "/api/v1/", + "POLL_RATE_MS": 2000, + "CACHE_DIR": "./cache", + "CLEAR_PROTECTION_MINUTES": 20, + "RECOMMENDED_FEE_PERCENTILE": 50, + "BLOCK_WEIGHT_UNITS": 4000000, + "INITIAL_BLOCKS_AMOUNT": 8, + "MEMPOOL_BLOCKS_AMOUNT": 8, + "PRICE_FEED_UPDATE_INTERVAL": 3600, + "USE_SECOND_NODE_FOR_MINFEE": false, + "EXTERNAL_ASSETS": [] + }, +``` + +docker-compose overrides:: +``` + MEMPOOL_BACKEND_NETWORK: "" + MEMPOOL_BACKEND: "" + BACKEND_MAINNET_HTTP_PORT: "" + MEMPOOL_SPAWN_CLUSTER_PROCS: "" + MEMPOOL_API_URL_PREFIX: "" + MEMPOOL_POLL_RATE_MS: "" + CACHE_DIR: "" + MEMPOOL_CLEAR_PROTECTION_MINUTES: "" + MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "" + MEMPOOL_BLOCK_WEIGHT_UNITS: "" + MEMPOOL_INITIAL_BLOCKS_AMOUNT: "" + MEMPOOL_BLOCKS_AMOUNT: "" + MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: "" + MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: "" + MEMPOOL_EXTERNAL_ASSETS: "" +``` + +JSON: +``` +"CORE_RPC": { + "HOST": "127.0.0.1", + "PORT": 8332, + "USERNAME": "mempool", + "PASSWORD": "mempool" + }, +``` +docker-compose overrides: +``` + RPC_HOST: "" + RPC_PORT: "" + RPC_USER: "" + RPC_PASS: "" +``` + +JSON: +``` + "ELECTRUM": { + "HOST": "127.0.0.1", + "PORT": 50002, + "TLS_ENABLED": true + }, +``` + +docker-compose overrides: +``` + ELECTRUM_HOST: "" + ELECTRUM_PORT: "" + ELECTRUM_TLS: "" +``` + +JSON: +``` + "ESPLORA": { + "REST_API_URL": "http://127.0.0.1:3000" + }, +``` +docker-compose overrides: +``` + ESPLORA_REST_API_URL: "" +``` + +JSON: +``` + "SECOND_CORE_RPC": { + "HOST": "127.0.0.1", + "PORT": 8332, + "USERNAME": "mempool", + "PASSWORD": "mempool" + }, +``` + +docker-compose overrides: +``` + SECOND_RPC_HOST: "" + SECOND_RPC_PORT: "" + SECOND_RPC_USER: "" + SECOND_RPC_PASS: "" +``` + +JSON: +``` + "DATABASE": { + "ENABLED": true, + "HOST": "127.0.0.1", + "PORT": 3306, + "DATABASE": "mempool", + "USERNAME": "mempool", + "PASSWORD": "mempool" + }, +``` + +docker-compose overrides: +``` + MYSQL_ENABLED: "" + MYSQL_HOST: "" + MYSQL_PORT: "" + MYSQL_DATABASE: "" + MYSQL_USER: "" + MYSQL_PASS: "" +``` + +JSON: +``` + "SYSLOG": { + "ENABLED": true, + "HOST": "127.0.0.1", + "PORT": 514, + "MIN_PRIORITY": "info", + "FACILITY": "local7" + }, +``` + +docker-compose overrides: +``` + SYSLOG_ENABLED: "" + SYSLOG_HOST: "" + SYSLOG_PORT: "" + SYSLOG_MIN_PRIORITY: "" + SYSLOG_FACILITY: "" +``` + +JSON: +``` + "STATISTICS": { + "ENABLED": true, + "TX_PER_SECOND_SAMPLE_PERIOD": 150 + }, +``` + +docker-compose overrides: +``` + STATISTICS_ENABLED: "" + STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD: "" +``` + +JSON: +``` + "BISQ": { + "ENABLED": false, + "DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db" + } +``` + +docker-compose overrides: +``` + BISQ_ENABLED: "" + BISQ_DATA_PATH: "" +``` From 47a6969dc951b547af57ccfc78712e700c91b564 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 12 Jan 2022 17:18:33 -0800 Subject: [PATCH 13/17] Move Docker instructions to the top level README --- README.md | 234 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 233 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 079c3ffba..e51af55e6 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,238 @@ Mempool can be self-hosted on a wide variety of your own hardware, ranging from 4) [Production installation on a powerful FreeBSD server](https://github.com/mempool/mempool/tree/master/production) 5) [High Availability cluster using powerful FreeBSD servers](https://github.com/mempool/mempool/tree/master/production#high-availability) +# Docker Installation + +The `docker` directory contains the Dockerfiles used to build and release the official images and a `docker-compose.yml` file that is intended for end users to run a Mempool instance with minimal effort. + +## bitcoind only configuration + +To run an instance with the default settings, use the following command: + +```bash +$ docker-compose up +``` + +The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. It assumes you have added RPC credentials for the `mempool` user with a `mempool` password in your `bitcoin.conf` file: + +``` +rpcuser=mempool +rpcpassword=mempool +``` + +If you want to use your current credentials, update them in the `docker-compose.yml` file: + +``` + api: + environment: + MEMPOOL_BACKEND: "none" + RPC_HOST: "172.27.0.1" + RPC_PORT: "8332" + RPC_USER: "mempool" + RPC_PASS: "mempool" +``` + +Note: the IP in the example above refers to Docker's default gateway IP address so the container can hit the `bitcoind` instance running on the host machine. If your setup is different, update it accordingly. + +You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected. + +## bitcoind+romanz/electrs configuration + +In order to run with `romanz/electrs` as the backend, in addition to the settings required for running with `bitcoind` above, you will need to make the following changes to the `docker-compose.yml` file: + +- Under the `api` service, change the value of the `MEMPOOL_BACKEND` key from `none` to `electrum`: + +``` + api: + environment: + MEMPOOL_BACKEND: "none" +``` + +- Under the `api` service, set the `ELECTRUM_HOST` and `ELECTRUM_PORT` keys to your Docker host IP address and set `ELECTRUM_TLS_ENABLED` to `false`: + +``` + api: + environment: + ELECTRUM_HOST: "172.27.0.1" + ELECTRUM_PORT: "50002" + ELECTRUM_TLS: "false" +``` + +You can update any of the backend settings in the `mempool-config.json` file using the following environment variables to override them. + +JSON: +``` + "MEMPOOL": { + "NETWORK": "mainnet", + "BACKEND": "electrum", + "HTTP_PORT": 8999, + "SPAWN_CLUSTER_PROCS": 0, + "API_URL_PREFIX": "/api/v1/", + "POLL_RATE_MS": 2000, + "CACHE_DIR": "./cache", + "CLEAR_PROTECTION_MINUTES": 20, + "RECOMMENDED_FEE_PERCENTILE": 50, + "BLOCK_WEIGHT_UNITS": 4000000, + "INITIAL_BLOCKS_AMOUNT": 8, + "MEMPOOL_BLOCKS_AMOUNT": 8, + "PRICE_FEED_UPDATE_INTERVAL": 3600, + "USE_SECOND_NODE_FOR_MINFEE": false, + "EXTERNAL_ASSETS": [] + }, +``` + +docker-compose overrides:: +``` + MEMPOOL_BACKEND_NETWORK: "" + MEMPOOL_BACKEND: "" + BACKEND_MAINNET_HTTP_PORT: "" + MEMPOOL_SPAWN_CLUSTER_PROCS: "" + MEMPOOL_API_URL_PREFIX: "" + MEMPOOL_POLL_RATE_MS: "" + CACHE_DIR: "" + MEMPOOL_CLEAR_PROTECTION_MINUTES: "" + MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "" + MEMPOOL_BLOCK_WEIGHT_UNITS: "" + MEMPOOL_INITIAL_BLOCKS_AMOUNT: "" + MEMPOOL_BLOCKS_AMOUNT: "" + MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: "" + MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: "" + MEMPOOL_EXTERNAL_ASSETS: "" +``` + +JSON: +``` +"CORE_RPC": { + "HOST": "127.0.0.1", + "PORT": 8332, + "USERNAME": "mempool", + "PASSWORD": "mempool" + }, +``` +docker-compose overrides: +``` + RPC_HOST: "" + RPC_PORT: "" + RPC_USER: "" + RPC_PASS: "" +``` + +JSON: +``` + "ELECTRUM": { + "HOST": "127.0.0.1", + "PORT": 50002, + "TLS_ENABLED": true + }, +``` + +docker-compose overrides: +``` + ELECTRUM_HOST: "" + ELECTRUM_PORT: "" + ELECTRUM_TLS: "" +``` + +JSON: +``` + "ESPLORA": { + "REST_API_URL": "http://127.0.0.1:3000" + }, +``` +docker-compose overrides: +``` + ESPLORA_REST_API_URL: "" +``` + +JSON: +``` + "SECOND_CORE_RPC": { + "HOST": "127.0.0.1", + "PORT": 8332, + "USERNAME": "mempool", + "PASSWORD": "mempool" + }, +``` + +docker-compose overrides: +``` + SECOND_RPC_HOST: "" + SECOND_RPC_PORT: "" + SECOND_RPC_USER: "" + SECOND_RPC_PASS: "" +``` + +JSON: +``` + "DATABASE": { + "ENABLED": true, + "HOST": "127.0.0.1", + "PORT": 3306, + "DATABASE": "mempool", + "USERNAME": "mempool", + "PASSWORD": "mempool" + }, +``` + +docker-compose overrides: +``` + MYSQL_ENABLED: "" + MYSQL_HOST: "" + MYSQL_PORT: "" + MYSQL_DATABASE: "" + MYSQL_USER: "" + MYSQL_PASS: "" +``` + +JSON: +``` + "SYSLOG": { + "ENABLED": true, + "HOST": "127.0.0.1", + "PORT": 514, + "MIN_PRIORITY": "info", + "FACILITY": "local7" + }, +``` + +docker-compose overrides: +``` + SYSLOG_ENABLED: "" + SYSLOG_HOST: "" + SYSLOG_PORT: "" + SYSLOG_MIN_PRIORITY: "" + SYSLOG_FACILITY: "" +``` + +JSON: +``` + "STATISTICS": { + "ENABLED": true, + "TX_PER_SECOND_SAMPLE_PERIOD": 150 + }, +``` + +docker-compose overrides: +``` + STATISTICS_ENABLED: "" + STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD: "" +``` + +JSON: +``` + "BISQ": { + "ENABLED": false, + "DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db" + } +``` + +docker-compose overrides: +``` + BISQ_ENABLED: "" + BISQ_DATA_PATH: "" +``` + + # Manual Installation The following instructions are for a manual installation on Linux or FreeBSD. The file and directory paths may need to be changed to match your OS. @@ -158,7 +390,7 @@ Install mempool dependencies from npm and build the frontend static HTML/CSS/JS: Install the output into nginx webroot folder: ```bash - sudo rsync -av --delete dist/mempool/ /var/www/ + sudo rsync -av --delete dist/ /var/www/ ``` ## nginx + certbot From 831cd580e0caf398846e50d419b686e591eaa898 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 12 Jan 2022 17:18:52 -0800 Subject: [PATCH 14/17] Delete Docker README --- docker/README.md | 230 ----------------------------------------------- 1 file changed, 230 deletions(-) delete mode 100644 docker/README.md diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index d0de0d282..000000000 --- a/docker/README.md +++ /dev/null @@ -1,230 +0,0 @@ -# Docker - -This directory contains the Dockerfiles used to build and release the official images and a `docker-compose.yml` file that is intended for end users to run a Mempool instance with minimal effort. - -## bitcoind only configuration - -To run an instance with the default settings, use the following command: - -```bash -$ docker-compose up -``` - -The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. It assumes you have added RPC credentials for the `mempool` user with a `mempool` password in your `bitcoin.conf` file: - -``` -rpcuser=mempool -rpcpassword=mempool -``` - -If you want to use your current credentials, update them in the `docker-compose.yml` file: - -``` - api: - environment: - MEMPOOL_BACKEND: "none" - RPC_HOST: "172.27.0.1" - RPC_PORT: "8332" - RPC_USER: "mempool" - RPC_PASS: "mempool" -``` - -Note: the IP in the example above refers to Docker's default gateway IP address so the container can hit the `bitcoind` instance running on the host machine. If your setup is different, update it accordingly. - -You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected. - -## bitcoind+romanz/electrs configuration - -In order to run with `romanz/electrs` as the backend , in addition to the settings required for `bitcoind` above, you will need to make the following changes to the `docker-compose.yml` file: - -- Under the `api` service, change the value of `MEMPOOL_BACKEND` key from `none` to `electrum`: - -``` - api: - environment: - MEMPOOL_BACKEND: "none" -``` - -- Under the `api` service, set the `ELECTRUM_HOST` and `ELECTRUM_PORT` keys to your Docker host ip address and set `ELECTRUM_TLS_ENABLED` to `false`: - -``` - api: - environment: - ELECTRUM_HOST: "172.27.0.1" - ELECTRUM_PORT: "50002" - ELECTRUM_TLS: "false" -``` - -You can update any of the backend settings in the `mempool-config.json` file using the following environment variables to override them. - -JSON: -``` - "MEMPOOL": { - "NETWORK": "mainnet", - "BACKEND": "electrum", - "HTTP_PORT": 8999, - "SPAWN_CLUSTER_PROCS": 0, - "API_URL_PREFIX": "/api/v1/", - "POLL_RATE_MS": 2000, - "CACHE_DIR": "./cache", - "CLEAR_PROTECTION_MINUTES": 20, - "RECOMMENDED_FEE_PERCENTILE": 50, - "BLOCK_WEIGHT_UNITS": 4000000, - "INITIAL_BLOCKS_AMOUNT": 8, - "MEMPOOL_BLOCKS_AMOUNT": 8, - "PRICE_FEED_UPDATE_INTERVAL": 3600, - "USE_SECOND_NODE_FOR_MINFEE": false, - "EXTERNAL_ASSETS": [] - }, -``` - -docker-compose overrides:: -``` - MEMPOOL_BACKEND_NETWORK: "" - MEMPOOL_BACKEND: "" - BACKEND_MAINNET_HTTP_PORT: "" - MEMPOOL_SPAWN_CLUSTER_PROCS: "" - MEMPOOL_API_URL_PREFIX: "" - MEMPOOL_POLL_RATE_MS: "" - CACHE_DIR: "" - MEMPOOL_CLEAR_PROTECTION_MINUTES: "" - MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "" - MEMPOOL_BLOCK_WEIGHT_UNITS: "" - MEMPOOL_INITIAL_BLOCKS_AMOUNT: "" - MEMPOOL_BLOCKS_AMOUNT: "" - MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: "" - MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: "" - MEMPOOL_EXTERNAL_ASSETS: "" -``` - -JSON: -``` -"CORE_RPC": { - "HOST": "127.0.0.1", - "PORT": 8332, - "USERNAME": "mempool", - "PASSWORD": "mempool" - }, -``` -docker-compose overrides: -``` - RPC_HOST: "" - RPC_PORT: "" - RPC_USER: "" - RPC_PASS: "" -``` - -JSON: -``` - "ELECTRUM": { - "HOST": "127.0.0.1", - "PORT": 50002, - "TLS_ENABLED": true - }, -``` - -docker-compose overrides: -``` - ELECTRUM_HOST: "" - ELECTRUM_PORT: "" - ELECTRUM_TLS: "" -``` - -JSON: -``` - "ESPLORA": { - "REST_API_URL": "http://127.0.0.1:3000" - }, -``` -docker-compose overrides: -``` - ESPLORA_REST_API_URL: "" -``` - -JSON: -``` - "SECOND_CORE_RPC": { - "HOST": "127.0.0.1", - "PORT": 8332, - "USERNAME": "mempool", - "PASSWORD": "mempool" - }, -``` - -docker-compose overrides: -``` - SECOND_RPC_HOST: "" - SECOND_RPC_PORT: "" - SECOND_RPC_USER: "" - SECOND_RPC_PASS: "" -``` - -JSON: -``` - "DATABASE": { - "ENABLED": true, - "HOST": "127.0.0.1", - "PORT": 3306, - "DATABASE": "mempool", - "USERNAME": "mempool", - "PASSWORD": "mempool" - }, -``` - -docker-compose overrides: -``` - MYSQL_ENABLED: "" - MYSQL_HOST: "" - MYSQL_PORT: "" - MYSQL_DATABASE: "" - MYSQL_USER: "" - MYSQL_PASS: "" -``` - -JSON: -``` - "SYSLOG": { - "ENABLED": true, - "HOST": "127.0.0.1", - "PORT": 514, - "MIN_PRIORITY": "info", - "FACILITY": "local7" - }, -``` - -docker-compose overrides: -``` - SYSLOG_ENABLED: "" - SYSLOG_HOST: "" - SYSLOG_PORT: "" - SYSLOG_MIN_PRIORITY: "" - SYSLOG_FACILITY: "" -``` - -JSON: -``` - "STATISTICS": { - "ENABLED": true, - "TX_PER_SECOND_SAMPLE_PERIOD": 150 - }, -``` - -docker-compose overrides: -``` - STATISTICS_ENABLED: "" - STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD: "" -``` - -JSON: -``` - "BISQ": { - "ENABLED": false, - "DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db" - } -``` - -docker-compose overrides: -``` - BISQ_ENABLED: "" - BISQ_DATA_PATH: "" -``` From 359e111ae4439d62608d4b605011cb4087c0a420 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 12 Jan 2022 21:20:14 -0800 Subject: [PATCH 15/17] Normalize Docker environment variables and backend JSON keys --- README.md | 32 +++++------ docker/backend/mempool-config.json | 44 +++++++-------- docker/backend/start.sh | 90 ++++++++++++++++-------------- docker/docker-compose.yml | 15 +++-- 4 files changed, 96 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index e51af55e6..cf6df21ca 100644 --- a/README.md +++ b/README.md @@ -96,18 +96,18 @@ JSON: docker-compose overrides:: ``` - MEMPOOL_BACKEND_NETWORK: "" + MEMPOOL_NETWORK: "" MEMPOOL_BACKEND: "" - BACKEND_MAINNET_HTTP_PORT: "" + MEMPOOL_HTTP_PORT: "" MEMPOOL_SPAWN_CLUSTER_PROCS: "" MEMPOOL_API_URL_PREFIX: "" MEMPOOL_POLL_RATE_MS: "" - CACHE_DIR: "" + MEMPOOL_CACHE_DIR: "" MEMPOOL_CLEAR_PROTECTION_MINUTES: "" MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "" MEMPOOL_BLOCK_WEIGHT_UNITS: "" MEMPOOL_INITIAL_BLOCKS_AMOUNT: "" - MEMPOOL_BLOCKS_AMOUNT: "" + MEMPOOL_MEMPOOL_BLOCKS_AMOUNT: "" MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: "" MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: "" MEMPOOL_EXTERNAL_ASSETS: "" @@ -124,10 +124,10 @@ JSON: ``` docker-compose overrides: ``` - RPC_HOST: "" - RPC_PORT: "" - RPC_USER: "" - RPC_PASS: "" + CORE_RPC_HOST: "" + CORE_RPC_PORT: "" + CORE_RPC_USERNAME: "" + CORE_RPC_PASSWORD: "" ``` JSON: @@ -171,8 +171,8 @@ docker-compose overrides: ``` SECOND_RPC_HOST: "" SECOND_RPC_PORT: "" - SECOND_RPC_USER: "" - SECOND_RPC_PASS: "" + SECOND_RPC_USERNAME: "" + SECOND_RPC_PASSWORD: "" ``` JSON: @@ -189,12 +189,12 @@ JSON: docker-compose overrides: ``` - MYSQL_ENABLED: "" - MYSQL_HOST: "" - MYSQL_PORT: "" - MYSQL_DATABASE: "" - MYSQL_USER: "" - MYSQL_PASS: "" + DATABASE_ENABLED: "" + DATABASE_HOST: "" + DATABASE_PORT: "" + DATABASE_DATABASE: "" + DATABASE_USERAME: "" + DATABASE_PASSWORD: "" ``` JSON: diff --git a/docker/backend/mempool-config.json b/docker/backend/mempool-config.json index 4ae23123e..00dc31aad 100644 --- a/docker/backend/mempool-config.json +++ b/docker/backend/mempool-config.json @@ -1,48 +1,48 @@ { "MEMPOOL": { - "NETWORK": "__MEMPOOL_BACKEND_NETWORK__", + "NETWORK": "__MEMPOOL_NETWORK__", "BACKEND": "__MEMPOOL_BACKEND__", - "HTTP_PORT": __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__, + "HTTP_PORT": __MEMPOOL_HTTP_PORT__, "SPAWN_CLUSTER_PROCS": __MEMPOOL_SPAWN_CLUSTER_PROCS__, "API_URL_PREFIX": "__MEMPOOL_API_URL_PREFIX__", "POLL_RATE_MS": __MEMPOOL_POLL_RATE_MS__, - "CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__", - "CLEAR_PROTECTION_MINUTES": __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__, + "CACHE_DIR": "__MEMPOOL_CACHE_DIR__", + "CLEAR_PROTECTION_MINUTES": __MEMPOOL_CLEAR_PROTECTION_MINUTES__, "RECOMMENDED_FEE_PERCENTILE": __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__, "BLOCK_WEIGHT_UNITS": __MEMPOOL_BLOCK_WEIGHT_UNITS__, "INITIAL_BLOCKS_AMOUNT": __MEMPOOL_INITIAL_BLOCKS_AMOUNT__, - "MEMPOOL_BLOCKS_AMOUNT": __MEMPOOL_BLOCKS_AMOUNT__, + "MEMPOOL_BLOCKS_AMOUNT": __MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__, "PRICE_FEED_UPDATE_INTERVAL": __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__, "USE_SECOND_NODE_FOR_MINFEE": __MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__, "EXTERNAL_ASSETS": __MEMPOOL_EXTERNAL_ASSETS__ }, "CORE_RPC": { - "HOST": "__BITCOIN_MAINNET_RPC_HOST__", - "PORT": __BITCOIN_MAINNET_RPC_PORT__, - "USERNAME": "__BITCOIN_MAINNET_RPC_USER__", - "PASSWORD": "__BITCOIN_MAINNET_RPC_PASS__" + "HOST": "__CORE_RPC_HOST__", + "PORT": __CORE_RPC_PORT__, + "USERNAME": "__CORE_RPC_USERNAME__", + "PASSWORD": "__CORE_RPC_PASSWORD__" }, "ELECTRUM": { - "HOST": "__ELECTRUM_MAINNET_HTTP_HOST__", - "PORT": __ELECTRUM_MAINNET_HTTP_PORT__, - "TLS_ENABLED": __ELECTRUM_MAINNET_TLS_ENABLED__ + "HOST": "__ELECTRUM_HOST__", + "PORT": __ELECTRUM_PORT__, + "TLS_ENABLED": __ELECTRUM_TLS_ENABLED__ }, "ESPLORA": { "REST_API_URL": "__ESPLORA_REST_API_URL__" }, "SECOND_CORE_RPC": { - "HOST": "__SECOND_RPC_HOST__", - "PORT": __SECOND_RPC_PORT__, - "USERNAME": "__SECOND_RPC_USER__", - "PASSWORD": "__SECOND_RPC_PASS__" + "HOST": "__SECOND_CORE_RPC_HOST__", + "PORT": __SECOND_CORE_RPC_PORT__, + "USERNAME": "__SECOND_CORE_RPC_USERNAME__", + "PASSWORD": "__SECOND_CORE_RPC_PASSWORD__" }, "DATABASE": { - "ENABLED": __MYSQL_ENABLED__, - "HOST": "__MYSQL_HOST__", - "PORT": __MYSQL_PORT__, - "DATABASE": "__MYSQL_DATABASE__", - "USERNAME": "__MYSQL_USERNAME__", - "PASSWORD": "__MYSQL_PASSWORD__" + "ENABLED": __DATABASE_ENABLED__, + "HOST": "__DATABASE_HOST__", + "PORT": __DATABASE_PORT__, + "DATABASE": "__DATABASE_DATABASE__", + "USERNAME": "__DATABASE_USERNAME__", + "PASSWORD": "__DATABASE_PASSWORD__" }, "SYSLOG": { "ENABLED": __SYSLOG_ENABLED__, diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 0c5ae8461..73556ee20 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -1,32 +1,32 @@ #!/bin/sh # MEMPOOL -__MEMPOOL_BACKEND_NETWORK__=${MEMPOOL_BACKEND_NETWORK:=mainnet} +__MEMPOOL_NETWORK__=${MEMPOOL_NETWORK:=mainnet} __MEMPOOL_BACKEND__=${MEMPOOL_BACKEND:=electrum} -__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999} +__MEMPOOL_HTTP_PORT__=${BACKEND_HTTP_PORT:=8999} __MEMPOOL_SPAWN_CLUSTER_PROCS__=${MEMPOOL_SPAWN_CLUSTER_PROCS:=0} __MEMPOOL_API_URL_PREFIX__=${MEMPOOL_API_URL_PREFIX:=/api/v1/} __MEMPOOL_POLL_RATE_MS__=${MEMPOOL_POLL_RATE_MS:=2000} -__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache} -__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} +__MEMPOOL_CACHE_DIR__=${MEMPOOL_CACHE_DIR:=./cache} +__MEMPOOL_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__=${MEMPOOL_RECOMMENDED_FEE_PERCENTILE:=50} __MEMPOOL_BLOCK_WEIGHT_UNITS__=${MEMPOOL_BLOCK_WEIGHT_UNITS:=4000000} __MEMPOOL_INITIAL_BLOCKS_AMOUNT__=${MEMPOOL_INITIAL_BLOCKS_AMOUNT:=8} -__MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_BLOCKS_AMOUNT:=8} +__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_MEMPOOL_BLOCKS_AMOUNT:=8} __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__=${MEMPOOL_PRICE_FEED_UPDATE_INTERVAL:=3600} __MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__=${MEMPOOL_USE_SECOND_NODE_FOR_MINFEE:=false} __MEMPOOL_EXTERNAL_ASSETS__=${MEMPOOL_EXTERNAL_ASSETS:=[]} # CORE_RPC -__BITCOIN_MAINNET_RPC_HOST__=${RPC_HOST:=127.0.0.1} -__BITCOIN_MAINNET_RPC_PORT__=${RPC_PORT:=8332} -__BITCOIN_MAINNET_RPC_USER__=${RPC_USER:=mempool} -__BITCOIN_MAINNET_RPC_PASS__=${RPC_PASS:=mempool} +__CORE_RPC_HOST__=${CORE_RPC_HOST:=127.0.0.1} +__CORE_RPC_PORT__=${CORE_RPC_PORT:=8332} +__CORE_RPC_USERNAME__=${CORE_RPC_USER:=mempool} +__CORE_RPC_PASSWORD__=${CORE_RPC_PASS:=mempool} # ELECTRUM -__ELECTRUM_MAINNET_HTTP_HOST__=${ELECTRUM_HOST:=127.0.0.1} -__ELECTRUM_MAINNET_HTTP_PORT__=${ELECTRUM_PORT:=50002} -__ELECTRUM_MAINNET_TLS_ENABLED__=${ELECTRUM_TLS:=false} +__ELECTRUM_HOST__=${ELECTRUM_HOST:=127.0.0.1} +__ELECTRUM_PORT__=${ELECTRUM_PORT:=50002} +__ELECTRUM_TLS_ENABLED__=${ELECTRUM_TLS:=false} # ESPLORA __ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} @@ -34,16 +34,16 @@ __ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} # SECOND_CORE_RPC __SECOND_RPC_HOST__=${SECOND_RPC_HOST:=127.0.0.1} __SECOND_RPC_PORT__=${SECOND_RPC_PORT:=8332} -__SECOND_RPC_USER__=${SECOND_RPC_USER:=mempool} -__SECOND_RPC_PASS__=${SECOND_RPC_PASS:=mempool} +__SECOND_RPC_USERNAME__=${SECOND_RPC_USERNAME:=mempool} +__SECOND_RPC_PASSWORD__=${SECOND_RPC_PASSWORD:=mempool} # DATABASE -__MYSQL_ENABLED__=${MYSQL_ENABLED:=true} -__MYSQL_HOST__=${MYSQL_HOST:=127.0.0.1} -__MYSQL_PORT__=${MYSQL_PORT:=3306} -__MYSQL_DATABASE__=${MYSQL_DATABASE:=mempool} -__MYSQL_USERNAME__=${MYSQL_USER:=mempool} -__MYSQL_PASSWORD__=${MYSQL_PASS:=mempool} +__DATABASE_ENABLED__=${DATABASE_ENABLED:=true} +__DATABASE_HOST__=${DATABASE_HOST:=127.0.0.1} +__DATABASE_PORT__=${DATABASE_PORT:=3306} +__DATABASE_DATABASE__=${DATABASE_DATABASE:=mempool} +__DATABASE_USERNAME__=${DATABASE_USERNAME:=mempool} +__DATABASE_PASSWORD__=${DATABASE_PASSWORD:=mempool} # SYSLOG __SYSLOG_ENABLED__=${SYSLOG_ENABLED:=false} @@ -60,48 +60,56 @@ __STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__=${STATISTICS_TX_PER_SECOND_SAMPLE_PER __BISQ_ENABLED__=${BISQ_ENABLED:=false} __BISQ_DATA_PATH__=${BISQ_DATA_PATH:=/bisq/statsnode-data/btc_mainnet/db} -mkdir -p "${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}" +mkdir -p "${__MEMPOOL_CACHE_DIR__}" -sed -i "s/__MEMPOOL_BACKEND_NETWORK__/${__MEMPOOL_BACKEND_NETWORK__}/g" mempool-config.json +sed -i "s/__MEMPOOL_NETWORK__/${__MEMPOOL_NETWORK__}/g" mempool-config.json sed -i "s/__MEMPOOL_BACKEND__/${__MEMPOOL_BACKEND__}/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_HTTP_PORT__/${__MEMPOOL_HTTP_PORT__}/g" mempool-config.json sed -i "s/__MEMPOOL_SPAWN_CLUSTER_PROCS__/${__MEMPOOL_SPAWN_CLUSTER_PROCS__}/g" mempool-config.json sed -i "s!__MEMPOOL_API_URL_PREFIX__!${__MEMPOOL_API_URL_PREFIX__}!g" mempool-config.json sed -i "s/__MEMPOOL_POLL_RATE_MS__/${__MEMPOOL_POLL_RATE_MS__}/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_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json +sed -i "s!__MEMPOOL_CACHE_DIR__!${__MEMPOOL_CACHE_DIR__}!g" mempool-config.json +sed -i "s/__MEMPOOL_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json sed -i "s/__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__/${__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__}/g" mempool-config.json sed -i "s/__MEMPOOL_BLOCK_WEIGHT_UNITS__/${__MEMPOOL_BLOCK_WEIGHT_UNITS__}/g" mempool-config.json sed -i "s/__MEMPOOL_INITIAL_BLOCKS_AMOUNT__/${__MEMPOOL_INITIAL_BLOCKS_AMOUNT__}/g" mempool-config.json -sed -i "s/__MEMPOOL_BLOCKS_AMOUNT__/${__MEMPOOL_BLOCKS_AMOUNT__}/g" mempool-config.json +sed -i "s/__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__/${__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__}/g" mempool-config.json sed -i "s/__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__/${__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__}/g" mempool-config.json sed -i "s/__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__/${__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__}/g" mempool-config.json sed -i "s/__MEMPOOL_EXTERNAL_ASSETS__/${__MEMPOOL_EXTERNAL_ASSETS__}/g" mempool-config.json -sed -i "s/__BITCOIN_MAINNET_RPC_HOST__/${__BITCOIN_MAINNET_RPC_HOST__}/g" mempool-config.json -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/__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/__CORE_RPC_HOST__/${__CORE_RPC_HOST__}/g" mempool-config.json +sed -i "s/__CORE_RPC_PORT__/${__CORE_RPC_PORT__}/g" mempool-config.json +sed -i "s/__CORE_RPC_USERNAME__/${__CORE_RPC_USER__}/g" mempool-config.json +sed -i "s/__CORE_RPC_PASSWORD__/${__CORE_RPC_PASS__}/g" mempool-config.json + +sed -i "s/__ELECTRUM_HTTP_HOST__/${__ELECTRUM_HTTP_HOST__}/g" mempool-config.json +sed -i "s/__ELECTRUM_HTTP_PORT__/${__ELECTRUM_HTTP_PORT__}/g" mempool-config.json +sed -i "s/__ELECTRUM_TLS_ENABLED__/${__ELECTRUM_TLS_ENABLED__}/g" mempool-config.json + sed -i "s!__ESPLORA_REST_API_URL__!${__ESPLORA_REST_API_URL__}!g" mempool-config.json + sed -i "s/__SECOND_RPC_HOST__/${__SECOND_RPC_HOST__}/g" mempool-config.json sed -i "s/__SECOND_RPC_PORT__/${__SECOND_RPC_PORT__}/g" mempool-config.json -sed -i "s/__SECOND_RPC_USER__/${__SECOND_RPC_USER__}/g" mempool-config.json -sed -i "s/__SECOND_RPC_PASS__/${__SECOND_RPC_PASS__}/g" mempool-config.json -sed -i "s/__MYSQL_ENABLED__/${__MYSQL_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 -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/__SECOND_RPC_USERNAME__/${__SECOND_RPC_USERNAME__}/g" mempool-config.json +sed -i "s/__SECOND_RPC_PASSWORD__/${__SECOND_RPC_PASSWORD__}/g" mempool-config.json + +sed -i "s/__DATABASE_ENABLED__/${__DATABASE_ENABLED__}/g" mempool-config.json +sed -i "s/__DATABASE_HOST__/${__DATABASE_HOST__}/g" mempool-config.json +sed -i "s/__DATABASE_PORT__/${__DATABASE_PORT__}/g" mempool-config.json +sed -i "s/__DATABASE_DATABASE__/${__DATABASE_DATABASE__}/g" mempool-config.json +sed -i "s/__DATABASE_USERNAME__/${__DATABASE_USERNAME__}/g" mempool-config.json +sed -i "s/__DATABASE_PASSWORD__/${__DATABASE_PASSWORD__}/g" mempool-config.json + sed -i "s/__SYSLOG_ENABLED__/${__SYSLOG_ENABLED__}/g" mempool-config.json sed -i "s/__SYSLOG_HOST__/${__SYSLOG_HOST__}/g" mempool-config.json sed -i "s/__SYSLOG_PORT__/${__SYSLOG_PORT__}/g" mempool-config.json sed -i "s/__SYSLOG_MIN_PRIORITY__/${__SYSLOG_MIN_PRIORITY__}/g" mempool-config.json sed -i "s/__SYSLOG_FACILITY__/${__SYSLOG_FACILITY__}/g" mempool-config.json + sed -i "s/__STATISTICS_ENABLED__/${__STATISTICS_ENABLED__}/g" mempool-config.json sed -i "s/__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__/${__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__}/g" mempool-config.json + sed -i "s/__BISQ_ENABLED__/${__BISQ_ENABLED__}/g" mempool-config.json sed -i "s!__BISQ_DATA_PATH__!${__BISQ_DATA_PATH__}!g" mempool-config.json diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d1a24a007..68e73a1c8 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,12 +15,15 @@ services: api: environment: MEMPOOL_BACKEND: "none" - RPC_HOST: "172.27.0.1" - RPC_PORT: "8332" - RPC_USER: "mempool" - RPC_PASS: "mempool" - MYSQL_ENABLED: "true" - MYSQL_HOST: "db" + CORE_RPC_HOST: "172.27.0.1" + CORE_RPC_PORT: "8332" + CORE_RPC_USERNAME: "mempool" + CORE_RPC_PASSWORD: "mempool" + DATABASE_ENABLED: "true" + DATABASE_HOST: "db" + DATABASE_DATABASE: "mempool" + DATABASE_USERNAME: "mempool" + DATABASE_PASSWORD: "mempool" STATISTICS_ENABLED: "true" image: mempool/backend:latest user: "1000:1000" From d70c6107414a92e29d58a17a0abee2738da92f58 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Wed, 12 Jan 2022 22:36:24 -0800 Subject: [PATCH 16/17] Fetch the dereferenced commit from the tag --- docker/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/init.sh b/docker/init.sh index 722df3700..49b53d646 100755 --- a/docker/init.sh +++ b/docker/init.sh @@ -2,7 +2,7 @@ #backend gitMaster="\.\.\/\.git\/refs\/heads\/master" -git ls-remote https://github.com/mempool/mempool.git $1 | awk '{ print $1}' > ./backend/master +git ls-remote https://github.com/mempool/mempool.git "$1^{}" | awk '{ print $1}' > ./backend/master cp ./docker/backend/* ./backend/ sed -i "s/${gitMaster}/master/g" ./backend/src/api/backend-info.ts From af8c8a2088c8c293dc186ed13ac295aa88644bf4 Mon Sep 17 00:00:00 2001 From: Felipe Knorr Kuhn Date: Thu, 13 Jan 2022 00:08:07 -0800 Subject: [PATCH 17/17] Fix typos in the JSON keys --- README.md | 8 ++++---- docker/backend/start.sh | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index cf6df21ca..2e12e03e7 100644 --- a/README.md +++ b/README.md @@ -169,10 +169,10 @@ JSON: docker-compose overrides: ``` - SECOND_RPC_HOST: "" - SECOND_RPC_PORT: "" - SECOND_RPC_USERNAME: "" - SECOND_RPC_PASSWORD: "" + SECOND_CORE_RPC_HOST: "" + SECOND_CORE_RPC_PORT: "" + SECOND_CORE_RPC_USERNAME: "" + SECOND_CORE_RPC_PASSWORD: "" ``` JSON: diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 73556ee20..f982a18e5 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -20,8 +20,8 @@ __MEMPOOL_EXTERNAL_ASSETS__=${MEMPOOL_EXTERNAL_ASSETS:=[]} # CORE_RPC __CORE_RPC_HOST__=${CORE_RPC_HOST:=127.0.0.1} __CORE_RPC_PORT__=${CORE_RPC_PORT:=8332} -__CORE_RPC_USERNAME__=${CORE_RPC_USER:=mempool} -__CORE_RPC_PASSWORD__=${CORE_RPC_PASS:=mempool} +__CORE_RPC_USERNAME__=${CORE_RPC_USERNAME:=mempool} +__CORE_RPC_PASSWORD__=${CORE_RPC_PASSWORD:=mempool} # ELECTRUM __ELECTRUM_HOST__=${ELECTRUM_HOST:=127.0.0.1} @@ -32,10 +32,10 @@ __ELECTRUM_TLS_ENABLED__=${ELECTRUM_TLS:=false} __ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} # SECOND_CORE_RPC -__SECOND_RPC_HOST__=${SECOND_RPC_HOST:=127.0.0.1} -__SECOND_RPC_PORT__=${SECOND_RPC_PORT:=8332} -__SECOND_RPC_USERNAME__=${SECOND_RPC_USERNAME:=mempool} -__SECOND_RPC_PASSWORD__=${SECOND_RPC_PASSWORD:=mempool} +__SECOND_CORE_RPC_HOST__=${SECOND_CORE_RPC_HOST:=127.0.0.1} +__SECOND_CORE_RPC_PORT__=${SECOND_CORE_RPC_PORT:=8332} +__SECOND_CORE_RPC_USERNAME__=${SECOND_CORE_RPC_USERNAME:=mempool} +__SECOND_CORE_RPC_PASSWORD__=${SECOND_CORE_RPC_PASSWORD:=mempool} # DATABASE __DATABASE_ENABLED__=${DATABASE_ENABLED:=true} @@ -80,19 +80,19 @@ sed -i "s/__MEMPOOL_EXTERNAL_ASSETS__/${__MEMPOOL_EXTERNAL_ASSETS__}/g" mempool- sed -i "s/__CORE_RPC_HOST__/${__CORE_RPC_HOST__}/g" mempool-config.json sed -i "s/__CORE_RPC_PORT__/${__CORE_RPC_PORT__}/g" mempool-config.json -sed -i "s/__CORE_RPC_USERNAME__/${__CORE_RPC_USER__}/g" mempool-config.json -sed -i "s/__CORE_RPC_PASSWORD__/${__CORE_RPC_PASS__}/g" mempool-config.json +sed -i "s/__CORE_RPC_USERNAME__/${__CORE_RPC_USERNAME__}/g" mempool-config.json +sed -i "s/__CORE_RPC_PASSWORD__/${__CORE_RPC_PASSWORD__}/g" mempool-config.json -sed -i "s/__ELECTRUM_HTTP_HOST__/${__ELECTRUM_HTTP_HOST__}/g" mempool-config.json -sed -i "s/__ELECTRUM_HTTP_PORT__/${__ELECTRUM_HTTP_PORT__}/g" mempool-config.json +sed -i "s/__ELECTRUM_HOST__/${__ELECTRUM_HOST__}/g" mempool-config.json +sed -i "s/__ELECTRUM_PORT__/${__ELECTRUM_PORT__}/g" mempool-config.json sed -i "s/__ELECTRUM_TLS_ENABLED__/${__ELECTRUM_TLS_ENABLED__}/g" mempool-config.json sed -i "s!__ESPLORA_REST_API_URL__!${__ESPLORA_REST_API_URL__}!g" mempool-config.json -sed -i "s/__SECOND_RPC_HOST__/${__SECOND_RPC_HOST__}/g" mempool-config.json -sed -i "s/__SECOND_RPC_PORT__/${__SECOND_RPC_PORT__}/g" mempool-config.json -sed -i "s/__SECOND_RPC_USERNAME__/${__SECOND_RPC_USERNAME__}/g" mempool-config.json -sed -i "s/__SECOND_RPC_PASSWORD__/${__SECOND_RPC_PASSWORD__}/g" mempool-config.json +sed -i "s/__SECOND_CORE_RPC_HOST__/${__SECOND_CORE_RPC_HOST__}/g" mempool-config.json +sed -i "s/__SECOND_CORE_RPC_PORT__/${__SECOND_CORE_RPC_PORT__}/g" mempool-config.json +sed -i "s/__SECOND_CORE_RPC_USERNAME__/${__SECOND_CORE_RPC_USERNAME__}/g" mempool-config.json +sed -i "s/__SECOND_CORE_RPC_PASSWORD__/${__SECOND_CORE_RPC_PASSWORD__}/g" mempool-config.json sed -i "s/__DATABASE_ENABLED__/${__DATABASE_ENABLED__}/g" mempool-config.json sed -i "s/__DATABASE_HOST__/${__DATABASE_HOST__}/g" mempool-config.json