diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01f541849..1bb6686cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,11 +80,15 @@ 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: 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 @@ -97,11 +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 }} + 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: @@ -110,11 +118,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: diff --git a/Dockerfile.core b/Dockerfile.core new file mode 100644 index 000000000..bddf420f8 --- /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 patches/stellar-core /patches +RUN git am /patches/*.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 60d33144c..c7c7c61a6 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,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/README.md b/README.md index 7e0a10548..f7ca4e1d4 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,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 | 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/; +} diff --git a/futurenet/core/etc/stellar-core.cfg b/futurenet/core/etc/stellar-core.cfg index a4a2137dd..63f28d100 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="/var/log/stellar-core/stellar-core-{datetime:%Y-%m-%d_%H-%M-%S}.log" MANUAL_CLOSE=__MANUAL_CLOSE__ diff --git a/local/core/etc/stellar-core.cfg b/local/core/etc/stellar-core.cfg index 5de2478eb..f3b43c227 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 + LOG_FILE_PATH="/var/log/stellar-core/stellar-core-{datetime:%Y-%m-%d_%H-%M-%S}.log" MANUAL_CLOSE=__MANUAL_CLOSE__ ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true diff --git a/patches/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 new file mode 100644 index 000000000..70d799a72 --- /dev/null +++ b/patches/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/pubnet/core/etc/stellar-core.cfg b/pubnet/core/etc/stellar-core.cfg index 827b843fa..17dfc7a9b 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="/var/log/stellar-core/stellar-core-{datetime:%Y-%m-%d_%H-%M-%S}.log" MANUAL_CLOSE=__MANUAL_CLOSE__ diff --git a/testnet/core/etc/stellar-core.cfg b/testnet/core/etc/stellar-core.cfg index b9a5b72e1..de3cff0f9 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="/var/log/stellar-core/stellar-core-{datetime:%Y-%m-%d_%H-%M-%S}.log" MANUAL_CLOSE=__MANUAL_CLOSE__