From 72148856f890395893058d53dbfeace3cfac846e Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 20 May 2025 06:08:56 +0000 Subject: [PATCH 1/2] update --- Dockerfile | 100 ++++++++++++++++------------------------------------- node.conf | 58 +++++++++++++++++++++++++++++++ start.sh | 5 +++ 3 files changed, 93 insertions(+), 70 deletions(-) create mode 100644 node.conf create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile index 34c43cc8a..3bc6c507d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,10 +50,13 @@ RUN apt-get update && apt-get install -y \ libboost-thread-dev \ libdb-dev \ libdb++-dev \ - npm \ + curl \ + ca-certificates \ python3 \ - && rm -rf /var/lib/apt/lists/* \ - && npm install pm2 -g + && curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ + && apt-get install -y nodejs \ + && npm install pm2 -g \ + && rm -rf /var/lib/apt/lists/* WORKDIR /TBCNODE @@ -61,76 +64,33 @@ COPY --from=builder /TBCNODE/bin /TBCNODE/bin COPY --from=builder /TBCNODE/lib /TBCNODE/lib COPY --from=builder /TBCNODE/include /TBCNODE/include COPY --from=builder /TBCNODE/share /TBCNODE/share +COPY node.conf /TBCNODE/node.conf -RUN mkdir -p /TBCNODE/node_data_dir && \ - echo '\ -##\n\ -## bitcoin.conf configuration file. Lines beginning with # are comments.\n\ -##\n\ -\n\ -#limitancestorcount=5\n\ -pruneblocks=824188\n\ -\n\ -rpcthreads=64\n\ -rpcworkqueue=256\n\ -\n\ -standalone=1\n\ -disablesafemode=1\n\ -minimumchainwork=0000000000000000000000000000000000000000000000000000000000000001\n\ -rest=1\n\ -rpcservertimeout=120\n\ -\n\ -#start in background\n\ -daemon=1\n\ -\n\ -#Required Consensus Rules for Genesis\n\ -excessiveblocksize=10000000000 #10GB\n\ -maxstackmemoryusageconsensus=100000000 #100MB\n\ -\n\ -#Mining\n\ -#biggest block size you want to mine\n\ -blockmaxsize=4000000000\n\ -blockassembler=journaling #journaling is default as of 1.0.5\n\ -\n\ -#preload mempool\n\ -preload=1\n\ -\n\ -# Index all transactions, prune mode don\'t support txindex\n\ -txindex=1\n\ -\n\ -#testnet=1\n\ -\n\ -#Other Sys\n\ -maxmempool=6000\n\ -dbcache=1000\n\ -\n\ -#connect=0\n\ -maxconnections=8\n\ -\n\ -# JSON-RPC options\n\ -server=1\n\ -rpcbind=0.0.0.0\n\ -rpcallowip=0.0.0.0/0\n\ -rpcuser=tbcuser\n\ -rpcpassword=randompasswd\n\ -rpcport=8332\n\ -port=8333\n\ -\n\ -#Other Block\n\ -threadsperblock=6\n\ -\n\ -#Other Tx Conf:\n\ -maxscriptsizepolicy=0\n\ -blockmintxfee=0.000060\n\ -' > /TBCNODE/node.conf - -RUN echo '#!/bin/bash\n\ -pm2 --name tbcd --max-restarts 20 start "/TBCNODE/bin/bitcoind -conf=/TBCNODE/node.conf -datadir=/TBCNODE/node_data_dir"\n\ -pm2 logs\n\ -' > /TBCNODE/start.sh && \ - chmod +x /TBCNODE/start.sh +RUN mkdir -p /TBCNODE/node_data_dir +COPY start.sh /TBCNODE/start.sh +RUN chmod +x /TBCNODE/start.sh + +# 暴露RPC和P2P端口 EXPOSE 8332 EXPOSE 8333 +# 为了防止配置文件换行符问题,确保配置文件使用Unix格式 +RUN apt-get update && apt-get install -y dos2unix && \ + dos2unix /TBCNODE/node.conf && \ + dos2unix /TBCNODE/start.sh && \ + apt-get remove -y dos2unix && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* && \ + # 确保数据目录有正确的权限 + mkdir -p /TBCNODE/node_data_dir/blocks /TBCNODE/node_data_dir/chainstate && \ + chmod -R 755 /TBCNODE/node_data_dir + +# 健康检查 +HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ + CMD curl -s --data-binary '{"jsonrpc": "1.0", "id":"healthcheck", "method": "getblockcount", "params": [] }' \ + -H 'content-type: text/plain;' http://tbcuser:randompasswd@127.0.0.1:8332/ || exit 1 + +# 设置默认启动命令 +ENTRYPOINT ["/bin/bash", "-c"] CMD ["/TBCNODE/start.sh"] \ No newline at end of file diff --git a/node.conf b/node.conf new file mode 100644 index 000000000..8a8559861 --- /dev/null +++ b/node.conf @@ -0,0 +1,58 @@ +## +## bitcoin.conf configuration file. Lines beginning with # are comments. +## + +#limitancestorcount=5 +pruneblocks=824188 + +rpcthreads=64 +rpcworkqueue=256 + +standalone=1 +disablesafemode=1 +minimumchainwork=0000000000000000000000000000000000000000000000000000000000000001 +rest=1 +rpcservertimeout=120 + +#start in background +daemon=0 + +#Required Consensus Rules for Genesis +excessiveblocksize=10000000000 #10GB +maxstackmemoryusageconsensus=100000000 #100MB + +#Mining +#biggest block size you want to mine +blockmaxsize=4000000000 +blockassembler=journaling #journaling is default as of 1.0.5 + +#preload mempool +preload=1 + +# Index all transactions, prune mode don't support txindex +txindex=1 + +#testnet=1 + +#Other Sys +maxmempool=6000 +dbcache=1000 + +#connect=0 +maxconnections=8 + +# JSON-RPC options +server=1 +rpcbind=0.0.0.0 +rpcallowip=0.0.0.0/0 +rpcuser=tbcuser +rpcpassword=randompasswd +rpcport=8332 +port=8333 + +#Other Block +threadsperblock=6 + +#Other Tx Conf: +maxscriptsizepolicy=0 +blockmintxfee=0.000060 \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 000000000..b2d193917 --- /dev/null +++ b/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# 使用pm2启动服务 +pm2 --name tbcd --max-restarts 20 start "/TBCNODE/bin/bitcoind -conf=/TBCNODE/node.conf -datadir=/TBCNODE/node_data_dir" --no-daemon +# 监控日志 +pm2 logs --lines 200 From ac0a191d7531a9422fa1b814b9a0e5f7501343d3 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 20 May 2025 06:11:08 +0000 Subject: [PATCH 2/2] delete oldconfigfile --- Dockerfile-doxygen | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 Dockerfile-doxygen diff --git a/Dockerfile-doxygen b/Dockerfile-doxygen deleted file mode 100644 index be386ecdd..000000000 --- a/Dockerfile-doxygen +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && apt-get install -y doxygen graphviz - -COPY doc /abc/doc -COPY src /abc/src - -WORKDIR /abc - -RUN doxygen doc/Doxyfile - -FROM nginx:alpine - -COPY --from=0 /abc/doc/doxygen/html /usr/share/nginx/html