From 84c019f2a4da9d8d2b1612a8cff9c22beae4dd28 Mon Sep 17 00:00:00 2001 From: Doge Date: Sun, 28 Jul 2024 23:43:02 +0800 Subject: [PATCH 1/6] Updated Dockerfile dependencies Added liblz4-dev to the list of packages installed in the Dockerfile. This additional dependency is necessary for further development and functionality improvements. --- rldp-http-proxy/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rldp-http-proxy/Dockerfile b/rldp-http-proxy/Dockerfile index 73a7117..99a51a6 100644 --- a/rldp-http-proxy/Dockerfile +++ b/rldp-http-proxy/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:20.04 as builder RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata -RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config +RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev # build tonlib WORKDIR / From a7132e332eb2d9476270219ea58d9919a431e99f Mon Sep 17 00:00:00 2001 From: Doge Date: Sun, 28 Jul 2024 23:46:31 +0800 Subject: [PATCH 2/6] Updated Dockerfile dependencies Added libsecp256k1-dev to the list of installed packages in the Dockerfile. This change ensures that all necessary dependencies are available during the build process. --- rldp-http-proxy/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rldp-http-proxy/Dockerfile b/rldp-http-proxy/Dockerfile index 99a51a6..0326127 100644 --- a/rldp-http-proxy/Dockerfile +++ b/rldp-http-proxy/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:20.04 as builder RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata -RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev +RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev libsecp256k1-dev # build tonlib WORKDIR / From 52f1a36c9208e9a4d95a56e75f637c148fd2d1b4 Mon Sep 17 00:00:00 2001 From: Doge Date: Sun, 28 Jul 2024 23:49:03 +0800 Subject: [PATCH 3/6] Updated Dockerfile dependencies Added libsodium-dev to the list of packages installed in the Dockerfile. This change ensures all necessary dependencies are present for building the project within a docker container. --- rldp-http-proxy/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rldp-http-proxy/Dockerfile b/rldp-http-proxy/Dockerfile index 0326127..c0a7741 100644 --- a/rldp-http-proxy/Dockerfile +++ b/rldp-http-proxy/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:20.04 as builder RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata -RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev libsecp256k1-dev +RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev libsecp256k1-dev libsodium-dev # build tonlib WORKDIR / From 8e4bf935b4f1cfed73485524a86ac54318e45c33 Mon Sep 17 00:00:00 2001 From: Doge Date: Mon, 29 Jul 2024 00:00:42 +0800 Subject: [PATCH 4/6] Optimized Dockerfile and improved build process The Dockerfile has been optimized to reduce the number of layers by combining RUN commands. The installation of necessary packages is now done in a single step, reducing redundancy. Also, the build process has been divided into two stages: 'builder' and 'final image', improving readability and maintainability. Comments have been added for clarity on each stage's purpose. Lastly, file permissions are set for rldp-http-proxy and generate-random-id in one line to streamline the setup process. --- rldp-http-proxy/Dockerfile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/rldp-http-proxy/Dockerfile b/rldp-http-proxy/Dockerfile index c0a7741..70ff36d 100644 --- a/rldp-http-proxy/Dockerfile +++ b/rldp-http-proxy/Dockerfile @@ -1,20 +1,19 @@ +# Stage 1: Build FROM ubuntu:20.04 as builder -RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata && \ + apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev libsecp256k1-dev libsodium-dev -RUN apt install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config liblz4-dev libsecp256k1-dev libsodium-dev - -# build tonlib +# Build tonlib WORKDIR / -# remove /tree/ to build master branch ARG TON_REPO_BRANCH=master RUN echo "Branch: ${TON_REPO_BRANCH}" && \ git clone --recurse-submodules https://github.com/ton-blockchain/ton.git && \ - cd /ton && git checkout ${TON_REPO_BRANCH} + cd /ton && git checkout ${TON_REPO_BRANCH} -# fix lib version and patch logging +# Fix lib version and patch logging WORKDIR /ton RUN mkdir /ton/build WORKDIR /ton/build @@ -23,18 +22,21 @@ ENV CXX clang++ RUN cmake -DCMAKE_BUILD_TYPE=Release .. RUN cmake --build . -j$(nproc) --target rldp-http-proxy generate-random-id - +# Stage 2: Final image FROM ubuntu:20.04 -RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata && \ + apt install -y openssl libssl-dev wget curl libatomic1 zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev libsecp256k1-0 libsodium23 -RUN apt install -y openssl libssl-dev wget curl libatomic1 zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev WORKDIR /app COPY --from=builder /ton/build/rldp-http-proxy/rldp-http-proxy /app/rldp-http-proxy COPY --from=builder /ton/build/utils/generate-random-id /app/generate-random-id + RUN chmod +x /app/rldp-http-proxy && chmod +x /app/generate-random-id + COPY entrypoint.sh /app COPY generate_adnl.sh /app + ENTRYPOINT [ "/bin/bash" ] From 64b24620157a9b5d2ea92cbea858348b90a36f5d Mon Sep 17 00:00:00 2001 From: Doge Date: Mon, 29 Jul 2024 00:46:48 +0800 Subject: [PATCH 5/6] Updated Docker Compose configuration Removed a comment indicating the docker-compose file was not working. Added port mapping for service, allowing it to be accessible on port 8080. --- docker-compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 4f77c11..79441d0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,3 @@ -# This docker-compose file doesn't work yet. version: '3.9' services: rldp-proxy: @@ -18,6 +17,8 @@ services: - TON_PROXY_PROXY_ALL command: /app/entrypoint.sh secrets: [ adnl, adnl-hex, adnl-private, global-config ] + ports: + - "8080:8080" secrets: adnl: file: private/adnl From 3193464d410539f5714bc4a94fd86faff1bd14a0 Mon Sep 17 00:00:00 2001 From: Doge Date: Mon, 29 Jul 2024 02:19:47 +0800 Subject: [PATCH 6/6] Added restart policy to Docker service The Docker service configuration has been updated with a new restart policy. This ensures that the service will always restart if it stops, improving reliability and uptime. --- docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index 79441d0..b9d4672 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -19,6 +19,7 @@ services: secrets: [ adnl, adnl-hex, adnl-private, global-config ] ports: - "8080:8080" + restart: always secrets: adnl: file: private/adnl