From 7eb66f4b5b93ad3bf761743ff9a61ff1aedfeec6 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:56:47 +1000 Subject: [PATCH 1/8] Serve core's HTTP_QUERY_PORT --- Dockerfile.core | 44 +++++++++++++++++++ Makefile | 2 +- ...TP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch | 30 +++++++++++++ futurenet/core/etc/stellar-core.cfg | 3 ++ local/core/etc/stellar-core.cfg | 3 ++ pubnet/core/etc/stellar-core.cfg | 3 ++ testnet/core/etc/stellar-core.cfg | 3 ++ 7 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.core create mode 100644 depmods/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch diff --git a/Dockerfile.core b/Dockerfile.core new file mode 100644 index 000000000..5ceec70ea --- /dev/null +++ b/Dockerfile.core @@ -0,0 +1,44 @@ +FROM ubuntu:focal as builder + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get -y install iproute2 procps lsb-release \ + git build-essential pkg-config autoconf automake libtool \ + bison flex sed perl libpq-dev parallel libunwind-dev \ + clang-12 libc++abi-12-dev libc++-12-dev \ + postgresql curl + +RUN git config --global user.email '<>' +RUN git config --global user.name 'Build' + +ARG REPO +ARG REF +WORKDIR /wd +RUN git clone ${REPO} /wd +RUN git fetch origin ${REF} +RUN git checkout ${REF} + +ADD depmods/stellar-core /depmods +RUN git am /depmods/*.patch +RUN git log + +RUN git clean -dXf +RUN git submodule foreach --recursive git clean -dXf + +ARG CC=clang-12 +ARG CXX=clang++-12 +ARG CFLAGS='-O3 -g1 -fno-omit-frame-pointer' +ARG CXXFLAGS='-O3 -g1 -fno-omit-frame-pointer -stdlib=libc++' +ARG CONFIGURE_FLAGS='--enable-tracy --enable-sdfprefs --enable-next-protocol-version-unsafe-for-production' + +# Asan in llvm provided in ubuntu 22.04 is incompatible with +# high-entropy ASLR in much newer kernels that GitHub runners are +# using leading to random crashes: https://reviews.llvm.org/D148280 +RUN sysctl vm.mmap_rnd_bits=28 + +RUN ./autogen.sh +RUN ./install-rust.sh +ENV PATH "/root/.cargo/bin:$PATH" +RUN ./configure CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ${CONFIGURE_FLAGS} +RUN sh -c 'make -j $(nproc)' +RUN make install diff --git a/Makefile b/Makefile index c15195c3a..32c261940 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ build-deps-xdr: docker build -t stellar-xdr:$(XDR_REF) -f Dockerfile.xdr --target builder . --build-arg REPO="$(XDR_REPO)" --build-arg REF="$(XDR_REF)" build-deps-core: - docker build -t stellar-core:$(CORE_REF) -f docker/Dockerfile.testing $(CORE_REPO)#$(CORE_REF) --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true --build-arg CONFIGURE_FLAGS="$(CORE_CONFIGURE_FLAGS)" + docker build --progress=plain -t stellar-core:$(CORE_REF) -f Dockerfile.core --target builder . --build-arg REPO="$(CORE_REPO)" --build-arg REF="$(CORE_REF)" --build-arg CONFIGURE_FLAGS="$(CORE_CONFIGURE_FLAGS)" build-deps-horizon: docker build -t stellar-horizon:$(HORIZON_REF) -f Dockerfile.horizon --target builder . --build-arg REF="$(HORIZON_REF)" diff --git a/depmods/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch b/depmods/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch new file mode 100644 index 000000000..70d799a72 --- /dev/null +++ b/depmods/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch @@ -0,0 +1,30 @@ +From 75412bab790a63ba02ed311af5eb1f86cefaa999 Mon Sep 17 00:00:00 2001 +From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> +Date: Mon, 21 Jul 2025 11:35:27 +1000 +Subject: [PATCH] Allow HTTP_QUERY_PORT with NODE_IS_VALIDATOR + +--- + src/main/ApplicationImpl.cpp | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/src/main/ApplicationImpl.cpp b/src/main/ApplicationImpl.cpp +index cb633fa5b..541e3906c 100644 +--- a/src/main/ApplicationImpl.cpp ++++ b/src/main/ApplicationImpl.cpp +@@ -712,13 +712,6 @@ ApplicationImpl::validateAndLogConfig() + + if (mConfig.HTTP_QUERY_PORT != 0) + { +- if (isNetworkedValidator) +- { +- throw std::invalid_argument("HTTP_QUERY_PORT is non-zero, " +- "NODE_IS_VALIDATOR is set, and " +- "RUN_STANDALONE is not set"); +- } +- + if (mConfig.HTTP_QUERY_PORT == mConfig.HTTP_PORT) + { + throw std::invalid_argument( +-- +2.49.0 + diff --git a/futurenet/core/etc/stellar-core.cfg b/futurenet/core/etc/stellar-core.cfg index 50269a33f..f59abe648 100644 --- a/futurenet/core/etc/stellar-core.cfg +++ b/futurenet/core/etc/stellar-core.cfg @@ -1,5 +1,8 @@ +PEER_PORT=11625 HTTP_PORT=11626 PUBLIC_HTTP_PORT=true +HTTP_QUERY_PORT=11627 + LOG_FILE_PATH="" MANUAL_CLOSE=__MANUAL_CLOSE__ diff --git a/local/core/etc/stellar-core.cfg b/local/core/etc/stellar-core.cfg index 625b0c046..c660de412 100644 --- a/local/core/etc/stellar-core.cfg +++ b/local/core/etc/stellar-core.cfg @@ -1,8 +1,11 @@ # simple configuration for a local test "network" # see stellar-core_example.cfg for a description of the configuration parameters +PEER_PORT=11625 HTTP_PORT=11626 PUBLIC_HTTP_PORT=true +HTTP_QUERY_PORT=11627 + MANUAL_CLOSE=__MANUAL_CLOSE__ ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true diff --git a/pubnet/core/etc/stellar-core.cfg b/pubnet/core/etc/stellar-core.cfg index 2466519e9..015a8299f 100644 --- a/pubnet/core/etc/stellar-core.cfg +++ b/pubnet/core/etc/stellar-core.cfg @@ -1,5 +1,8 @@ +PEER_PORT=11625 HTTP_PORT=11626 PUBLIC_HTTP_PORT=true +HTTP_QUERY_PORT=11627 + LOG_FILE_PATH="" MANUAL_CLOSE=__MANUAL_CLOSE__ diff --git a/testnet/core/etc/stellar-core.cfg b/testnet/core/etc/stellar-core.cfg index fd49c4bc5..8641c9d6b 100644 --- a/testnet/core/etc/stellar-core.cfg +++ b/testnet/core/etc/stellar-core.cfg @@ -1,5 +1,8 @@ +PEER_PORT=11625 HTTP_PORT=11626 PUBLIC_HTTP_PORT=true +HTTP_QUERY_PORT=11627 + LOG_FILE_PATH="" MANUAL_CLOSE=__MANUAL_CLOSE__ From 87c8a6953fe83b87de3ac9a3afaf6f78b6314a46 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:59:44 +1000 Subject: [PATCH 2/8] rename depmods to patches --- Dockerfile.core | 4 ++-- .../0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename {depmods => patches}/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch (100%) diff --git a/Dockerfile.core b/Dockerfile.core index 5ceec70ea..bddf420f8 100644 --- a/Dockerfile.core +++ b/Dockerfile.core @@ -18,8 +18,8 @@ RUN git clone ${REPO} /wd RUN git fetch origin ${REF} RUN git checkout ${REF} -ADD depmods/stellar-core /depmods -RUN git am /depmods/*.patch +ADD patches/stellar-core /patches +RUN git am /patches/*.patch RUN git log RUN git clean -dXf diff --git a/depmods/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch b/patches/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch similarity index 100% rename from depmods/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch rename to patches/stellar-core/0001-Allow-HTTP_QUERY_PORT-with-NODE_IS_VALIDATOR.patch From 202ec0e6deafcfda30289d66f4056292ce4c8317 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 13:18:48 +1000 Subject: [PATCH 3/8] update github action --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed8cf041f..4949012c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ jobs: uses: actions/cache@v3 with: path: /tmp/image - key: image-stellar-core-${{ inputs.arch }}-${{ env.CORE_REPO_REF }}-${{ inputs.core_configure_flags }} + key: image-stellar-core-${{ inputs.arch }}-${{ env.CORE_REPO_REF }}-${{ inputs.core_configure_flags }}-${{ hashFiles('patches/stellar-core/*.patch') }} - name: Upload Stellar-Core Image if: steps.cache.outputs.cache-hit == 'true' uses: actions/upload-artifact@v4 @@ -96,7 +96,7 @@ jobs: uses: actions/cache@v3 with: path: /tmp/image - key: image-stellar-core-${{ inputs.arch }}-${{ env.CORE_REPO_REF }}-${{ inputs.core_configure_flags }} + key: image-stellar-core-${{ inputs.arch }}-${{ env.CORE_REPO_REF }}-${{ inputs.core_configure_flags }}-${{ hashFiles('patches/stellar-core/*.patch') }} - if: inputs.arch == 'arm64' uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 with: @@ -105,11 +105,12 @@ jobs: - name: Build Stellar-Core Image run: > docker buildx build --platform linux/${{ inputs.arch }} - -f docker/Dockerfile.testing -t stellar-core:${{ inputs.arch }} + -f Dockerfile.core -t stellar-core:${{ inputs.arch }} -o type=docker,dest=/tmp/image - ${{ env.CORE_REPO }}#${{ env.CORE_REPO_REF }} - --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true + --build-arg REPO='${{ env.CORE_REPO }}' + --build-arg REF='${{ env.CORE_REPO_REF }}' --build-arg CONFIGURE_FLAGS='${{ inputs.core_configure_flags }}' + . - name: Upload Stellar-Core Image uses: actions/upload-artifact@v4 with: From 39c725eb892f89494386310c4b0cb47bd8899053 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 13:23:36 +1000 Subject: [PATCH 4/8] remove trailing whitespace --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8ecc2d80..580004e45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,9 +109,9 @@ jobs: - uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f - name: Build Stellar-Core Image run: > - docker buildx build --platform linux/${{ inputs.arch }} - -f Dockerfile.core -t stellar-core:${{ inputs.arch }} - -o type=docker,dest=/tmp/image + docker buildx build --platform linux/${{ inputs.arch }} + -f Dockerfile.core -t stellar-core:${{ inputs.arch }} + -o type=docker,dest=/tmp/image --build-arg REPO='${{ env.CORE_REPO }}' --build-arg REF='${{ env.CORE_REPO_REF }}' --build-arg CONFIGURE_FLAGS='${{ inputs.core_configure_flags }}' From 301dfb7269cd0d05491e9b56d451a81385765319 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 13:32:50 +1000 Subject: [PATCH 5/8] fix checkout of quickstart during build --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 580004e45..a1d8f4172 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,6 +102,10 @@ jobs: with: path: /tmp/image key: image-stellar-core-${{ inputs.arch }}-${{ env.CORE_REPO_REF }}-${{ inputs.core_configure_flags }}-${{ hashFiles('patches/stellar-core/*.patch') }} + - name: Checkout Quickstart for Core docker file + uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - if: inputs.arch == 'arm64' uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 with: From 84643d8464275d1f285796836da0b40998e3f7cb Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:27:25 +1000 Subject: [PATCH 6/8] fix patches hash --- .github/workflows/build.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1d8f4172..9234dcf9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,6 +80,10 @@ jobs: outputs: cache-hit: ${{ steps.cache.outputs.cache-hit }} steps: + - name: Checkout Quickstart for Core patches + uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - id: cache uses: actions/cache@v3 with: @@ -97,15 +101,15 @@ jobs: if: ${{ needs.load-stellar-core-from-cache.outputs.cache-hit != 'true' }} runs-on: ${{ inputs.arch == 'arm64' && 'ubuntu-jammy-4-cores-arm64' || 'ubuntu-latest' }} steps: + - name: Checkout Quickstart for Core docker file and patches + uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} - id: cache uses: actions/cache@v3 with: path: /tmp/image key: image-stellar-core-${{ inputs.arch }}-${{ env.CORE_REPO_REF }}-${{ inputs.core_configure_flags }}-${{ hashFiles('patches/stellar-core/*.patch') }} - - name: Checkout Quickstart for Core docker file - uses: actions/checkout@v3 - with: - ref: ${{ inputs.sha }} - if: inputs.arch == 'arm64' uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 with: From aec02a50c3227f2ad2afabb69c33094711b9b777 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:31:29 +1000 Subject: [PATCH 7/8] add port to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f44870c43..18f756e23 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ The image also exposes a few other ports that most developers do not need, but a | 6061 | stellar-rpc | admin port | | 11625 | stellar-core | peer node port | | 11626 | stellar-core | main http port | +| 11627 | stellar-core | query http port | | 11725 | stellar-core (horizon) | peer node port | | 11726 | stellar-core (horizon) | main http port | | 11825 | stellar-core (stellar-rpc) | peer node port | From 1436ca0e8d13ffc8264ef2b9d93cf8f18f9a519b Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:36:38 +1000 Subject: [PATCH 8/8] add stellar core query to nginx --- common/nginx/etc/conf.d/stellar-core-query.conf | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 common/nginx/etc/conf.d/stellar-core-query.conf diff --git a/common/nginx/etc/conf.d/stellar-core-query.conf b/common/nginx/etc/conf.d/stellar-core-query.conf new file mode 100644 index 000000000..83c024877 --- /dev/null +++ b/common/nginx/etc/conf.d/stellar-core-query.conf @@ -0,0 +1,4 @@ +location /query/ { + proxy_set_header Host $http_host; + proxy_pass http://127.0.0.1:11627/; +}