From 02560b0e7a92a01f74c073f1d1dc61a7495a316b Mon Sep 17 00:00:00 2001 From: AustEcon Date: Thu, 3 Oct 2024 16:20:26 -0300 Subject: [PATCH 1/3] Updates for docker builds from source on WSL - I was running into a lot of issues with LR vs CRLF line endings and permissions of the .sh and .py scripts. - I also had an issue with downloading all the debian packages from http://archive.ubuntu.com/ubuntu so needed to add another mirror --- .dockerignore | 4 ++++ .gitignore | 6 ++++++ Dockerfile | 35 ++++++++++++++++++++++++----------- docker-compose.yaml | 15 +++++++++++++++ 4 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 .dockerignore create mode 100644 docker-compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b9c59772a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.idea +cmake +cmake-build-debug +data diff --git a/.gitignore b/.gitignore index 446b24e59..f6476e66a 100644 --- a/.gitignore +++ b/.gitignore @@ -147,3 +147,9 @@ nbproject/ #Local Development Environment - MinGW64 mingw64/ + +.idea +cmake-build-debug +.env +cmake +data diff --git a/Dockerfile b/Dockerfile index 2809a497a..2d1d77e4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,10 @@ LABEL version="1.0.0" LABEL description="Docker image for radiantd node" ARG DEBIAN_FRONTEND=nointeractive +RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://mirrors.edge.kernel.org/ubuntu|g' /etc/apt/sources.list RUN apt update RUN apt-get install -y curl + RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - RUN apt-get install -y nodejs @@ -29,7 +31,6 @@ ENV PACKAGES="\ libjansson-dev \ libevent-dev \ uthash-dev \ - nodejs \ vim \ libboost-chrono-dev \ libboost-filesystem-dev \ @@ -38,7 +39,7 @@ ENV PACKAGES="\ libevent-dev \ libminiupnpc-dev \ libssl-dev \ - libzmq3-dev \ + libzmq3-dev \ help2man \ ninja-build \ python3 \ @@ -49,10 +50,8 @@ ENV PACKAGES="\ opencl-headers \ ocl-icd-opencl-dev\ " -# Note can remove the opencl and ocl packages above when not building on a system for GPU/mining -# Included only for reference purposes if this container would be used for mining as well. -RUN apt update && apt install --no-install-recommends -y $PACKAGES && \ +RUN apt update && apt install --no-install-recommends -y $PACKAGES && \ rm -rf /var/lib/apt/lists/* && \ apt clean @@ -65,20 +64,34 @@ RUN apt update && apt install --no-install-recommends -y $PACKAGES && \ # RUN ./bootstrap # RUN make # RUN make install - + # Install radiant-node WORKDIR /root -RUN git clone --depth 1 --branch v1.3.0 https://github.com/radiantblockchain/radiant-node.git +#RUN git clone --depth 1 --branch v1.3.0 https://github.com/radiantblockchain/radiant-node.git +COPY . /root/radiant-node RUN mkdir /root/radiant-node/build WORKDIR /root/radiant-node/build RUN cmake -GNinja .. -DBUILD_RADIANT_QT=OFF + +RUN apt-get update +RUN apt-get install -y dos2unix + +# Ensure scripts have correct line endings and permissions +RUN find /root/radiant-node/build /root/radiant-node/cmake/utils /root/radiant-node/share -type f \( -name "*.sh" -o -name "*.py" \) -exec dos2unix {} \; -exec chmod +x {} \; + RUN ninja RUN ninja install WORKDIR /root/radiant-node/build/src +# Runtime environment variables from the .env file +ENV RPC_USER=${RPC_USER} +ENV RPC_PASSWORD=${RPC_PASSWORD} +ENV RPC_WORKQUEUE=${RPC_WORKQUEUE} +ENV RPC_THREADS=${RPC_THREADS} +ENV RPC_ALLOW_IP=${RPC_ALLOW_IP} +ENV TX_INDEX=${TX_INDEX} + EXPOSE 7332 7333 - -ENTRYPOINT ["radiantd", "-rpcworkqueue=32", "-rpcthreads=16", "-rest", "-server", "-rpcallowip=0.0.0.0/0", "-txindex=1", "-rpcuser=dockeruser", "-rpcpassword=dockerpass"] - - + +ENTRYPOINT ["radiantd", "-rpcworkqueue=${RPC_WORKQUEUE}", "-rpcthreads=${RPC_THREADS}", "-rest", "-server", "-rpcallowip=${RPC_ALLOW_IP}", "-txindex=${TX_INDEX}", "-rpcuser=${RPC_USER}", "-rpcpassword=${RPC_PASSWORD}"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..a7238dd63 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: "3" +services: + radiant_node: + build: . + container_name: radiant_node_container + ports: + - "7332:7332" + - "7333:7333" + volumes: + - ./data:/root/.radiant # Mount local Windows folder ./data to the container's /root/.radiant + env_file: # Load environment variables from the .env file + - .env + network_mode: "host" + stop_grace_period: 60s + entrypoint: ["radiantd", "-regtest", "-rpcworkqueue=${RPC_WORKQUEUE}", "-rpcthreads=${RPC_THREADS}", "-rpcbind=0.0.0.0", "-rest", "-server", "-rpcallowip=${RPC_ALLOW_IP}", "-txindex=${TX_INDEX}", "-rpcuser=${RPC_USER}", "-rpcpassword=${RPC_PASSWORD}", "-maxconnections=200"] From f36a23e65b3ca544bd57587d1edd4da5206113ba Mon Sep 17 00:00:00 2001 From: AustEcon Date: Thu, 3 Oct 2024 16:47:52 -0300 Subject: [PATCH 2/3] Add default .env file for docker-compose --- .env | 6 ++++++ .gitignore | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 000000000..e8923e952 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +RPC_USER=dockeruser +RPC_PASSWORD=dockerpass +RPC_WORKQUEUE=32 +RPC_THREADS=16 +RPC_ALLOW_IP=0.0.0.0/0 +TX_INDEX=1 diff --git a/.gitignore b/.gitignore index f6476e66a..36bda8d18 100644 --- a/.gitignore +++ b/.gitignore @@ -150,6 +150,5 @@ mingw64/ .idea cmake-build-debug -.env cmake data From 3ef6aef4f6cf752eb40d405c97469371ee4991ff Mon Sep 17 00:00:00 2001 From: AustEcon Date: Thu, 3 Oct 2024 17:22:44 -0300 Subject: [PATCH 3/3] Expose Regtest RPC port for ElectrumX connections --- docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index a7238dd63..468ccdb9e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,6 +6,7 @@ services: ports: - "7332:7332" - "7333:7333" + - "17443:17443" volumes: - ./data:/root/.radiant # Mount local Windows folder ./data to the container's /root/.radiant env_file: # Load environment variables from the .env file