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