From 424d8fbac90d6db2af9f1c05e767c6f13bb65791 Mon Sep 17 00:00:00 2001 From: Artem Ermoshkin Date: Fri, 31 Jul 2026 10:49:31 +0300 Subject: [PATCH 1/2] feat: use ydb-cpp-sdk debian packages --- .github/workflows/ci.yml | 5 +++ .mapping.json | 3 +- cmake/SetupYdbCppSDK.cmake | 37 ++++++++++++++++++- scripts/debian-rules | 4 +- scripts/docker/ubuntu-24.04-base.dockerfile | 3 ++ .../docker/ubuntu-24.04-userver.dockerfile | 2 +- scripts/docs/en/deps/ubuntu-24.04.md | 2 + scripts/docs/en/deps/ubuntu-24.04/ydb | 2 + scripts/docs/en/userver/build/dependencies.md | 4 ++ scripts/ydb/install-ydb-cpp-sdk-debs.sh | 34 +++++++++++++++++ 10 files changed, 91 insertions(+), 5 deletions(-) create mode 100755 scripts/ydb/install-ydb-cpp-sdk-debs.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2e3b1c12345..ec2e1c28565a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,7 @@ jobs: -DUSERVER_BUILD_ALL_COMPONENTS=1 -DUSERVER_BUILD_SAMPLES=1 -DUSERVER_BUILD_TESTS=1 + -DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF os: ubuntu-24.04 info: gcc-13 + release id: ubuntu24_gcc13_release @@ -129,6 +130,10 @@ jobs: | sudo tee -a /etc/apt/sources.list.d/mongodb-org-7.0.list # Mongo is not officially supported on Ubuntu 24.04, so install it from jammy + - name: Install YDB C++ SDK + run: | + sudo ./scripts/ydb/install-ydb-cpp-sdk-debs.sh + - name: Install common deps run: | sudo apt update diff --git a/.mapping.json b/.mapping.json index 684fa4ba249d..8424e8b9e54f 100644 --- a/.mapping.json +++ b/.mapping.json @@ -5353,6 +5353,7 @@ "scripts/uctl/uctl.py":"taxi/uservices/userver/scripts/uctl/uctl.py", "scripts/userver-create-service":"taxi/uservices/userver/scripts/userver-create-service", "scripts/userver-create-service.py":"taxi/uservices/userver/scripts/userver-create-service.py", + "scripts/ydb/install-ydb-cpp-sdk-debs.sh":"taxi/uservices/userver/scripts/ydb/install-ydb-cpp-sdk-debs.sh", "scylla/CMakeLists.txt":"taxi/uservices/userver/scylla/CMakeLists.txt", "scylla/README.md":"taxi/uservices/userver/scylla/README.md", "scylla/dynamic_configs/SCYLLA_DEFAULT_COMMAND_CONTROL.yaml":"taxi/uservices/userver/scylla/dynamic_configs/SCYLLA_DEFAULT_COMMAND_CONTROL.yaml", @@ -6670,4 +6671,4 @@ "ydb/utest/include/userver/ydb/tests/topic_writer_mock.hpp":"taxi/uservices/userver/ydb/utest/include/userver/ydb/tests/topic_writer_mock.hpp", "ydb/utest/include/userver/ydb/tests/write_session_mock.hpp":"taxi/uservices/userver/ydb/utest/include/userver/ydb/tests/write_session_mock.hpp", "ydb/utest/src/utest/topic_writer_mock.cpp":"taxi/uservices/userver/ydb/utest/src/utest/topic_writer_mock.cpp" -} \ No newline at end of file +} diff --git a/cmake/SetupYdbCppSDK.cmake b/cmake/SetupYdbCppSDK.cmake index 720593a44052..d4ba56541833 100644 --- a/cmake/SetupYdbCppSDK.cmake +++ b/cmake/SetupYdbCppSDK.cmake @@ -1,6 +1,41 @@ # @ingroup download option(USERVER_DOWNLOAD_PACKAGE_YDBCPPSDK "Download and setup ydb-cpp-sdk" ${USERVER_DOWNLOAD_PACKAGES}) +set(USERVER_YDBCPPSDK_VERSION 3.21.0) +set(USERVER_YDBCPPSDK_COMPONENTS + Coordination + Driver + FederatedTopic + Iam + Operation + Query + Result + Scheme + SolomonStats + Table + Topic + Types +) + +set(USERVER_YDBCPPSDK_DEB_PREFIX /usr/share/yandex) +if(EXISTS "${USERVER_YDBCPPSDK_DEB_PREFIX}/lib/cmake/ydb-cpp-sdk") + list(PREPEND CMAKE_PREFIX_PATH "${USERVER_YDBCPPSDK_DEB_PREFIX}") +endif() + +if(NOT USERVER_FORCE_DOWNLOAD_PACKAGES) + if(USERVER_DOWNLOAD_PACKAGE_YDBCPPSDK) + find_package(ydb-cpp-sdk ${USERVER_YDBCPPSDK_VERSION} QUIET CONFIG COMPONENTS ${USERVER_YDBCPPSDK_COMPONENTS}) + else() + find_package( + ydb-cpp-sdk ${USERVER_YDBCPPSDK_VERSION} REQUIRED CONFIG COMPONENTS ${USERVER_YDBCPPSDK_COMPONENTS} + ) + endif() + + if(ydb-cpp-sdk_FOUND) + return() + endif() +endif() + include(DownloadUsingCPM) include(SetupBrotli) @@ -34,7 +69,7 @@ endif() cpmaddpackage( NAME ydb-cpp-sdk - GIT_TAG v3.19.0 + GIT_TAG v${USERVER_YDBCPPSDK_VERSION} GITHUB_REPOSITORY ydb-platform/ydb-cpp-sdk GIT_SHALLOW TRUE OPTIONS "Brotli_VERSION ${Brotli_VERSION}" "RAPIDJSON_INCLUDE_DIRS ${RAPIDJSON_INCLUDE_DIRS}" diff --git a/scripts/debian-rules b/scripts/debian-rules index 85d2e5d2123e..503d0033961c 100755 --- a/scripts/debian-rules +++ b/scripts/debian-rules @@ -5,14 +5,14 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto BUILD_DIR_RELEASE = $(CURDIR)/debian/obj-$(DEB_HOST_GNU_TYPE)-release BUILD_DIR_DEBUG = $(CURDIR)/debian/obj-$(DEB_HOST_GNU_TYPE)-debug -# YDB has no official .deb package, so skip it # TODO: pg patch # TODO: clickhouse CMAKE_OPTS = \ -DUSERVER_INSTALL=ON \ -DUSERVER_BUILD_SAMPLES=ON \ -DUSERVER_BUILD_ALL_COMPONENTS=1 \ - -DUSERVER_FEATURE_YDB=OFF \ + -DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF \ + -DUSERVER_FEATURE_YDB=ON \ -DUSERVER_FEATURE_CLICKHOUSE=OFF \ -DUSERVER_FEATURE_PATCH_LIBPQ=OFF \ -DUSERVER_FEATURE_UTEST=ON diff --git a/scripts/docker/ubuntu-24.04-base.dockerfile b/scripts/docker/ubuntu-24.04-base.dockerfile index a255035d46c0..ff4defd528a3 100644 --- a/scripts/docker/ubuntu-24.04-base.dockerfile +++ b/scripts/docker/ubuntu-24.04-base.dockerfile @@ -11,8 +11,11 @@ FROM ubuntu:24.04 COPY scripts/docs/en/deps/ubuntu-24.04.md /userver_tmp/ COPY scripts/postgres/ubuntu-install-postgresql-includes.sh /userver_tmp/ +COPY scripts/ydb/install-ydb-cpp-sdk-debs.sh /userver_tmp/ RUN apt update \ + && apt install -y ca-certificates curl \ + && /userver_tmp/install-ydb-cpp-sdk-debs.sh \ && apt install -y $(cat /userver_tmp/ubuntu-24.04.md) \ && apt install -y clang-format python3-pip \ && python3 -m pip install --break-system-packages uv \ diff --git a/scripts/docker/ubuntu-24.04-userver.dockerfile b/scripts/docker/ubuntu-24.04-userver.dockerfile index e089670465af..70419747d9d6 100644 --- a/scripts/docker/ubuntu-24.04-userver.dockerfile +++ b/scripts/docker/ubuntu-24.04-userver.dockerfile @@ -9,6 +9,6 @@ RUN apt install -y pycodestyle sudo RUN git clone https://github.com/userver-framework/userver \ && cd userver \ - && BUILD_OPTIONS="-DUSERVER_FEATURE_GRPC_CHANNELZ=1" ./scripts/build_and_install_all.sh \ + && BUILD_OPTIONS="-DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF -DUSERVER_FEATURE_GRPC_CHANNELZ=1 -DUSERVER_FEATURE_YDB=1" ./scripts/build_and_install_all.sh \ && cd .. \ && rm -rf userver/ diff --git a/scripts/docs/en/deps/ubuntu-24.04.md b/scripts/docs/en/deps/ubuntu-24.04.md index 8c9c76e0edff..90adebc1ae66 100644 --- a/scripts/docs/en/deps/ubuntu-24.04.md +++ b/scripts/docs/en/deps/ubuntu-24.04.md @@ -54,6 +54,8 @@ libssl-dev libxxhash-dev libyaml-cpp-dev libyaml-cpp0.8 +libydb-cpp-dev +libydb-cpp-iam-dev libzstd-dev netbase ninja-build diff --git a/scripts/docs/en/deps/ubuntu-24.04/ydb b/scripts/docs/en/deps/ubuntu-24.04/ydb index 3739a2673815..1a415734901c 100644 --- a/scripts/docs/en/deps/ubuntu-24.04/ydb +++ b/scripts/docs/en/deps/ubuntu-24.04/ydb @@ -1 +1,3 @@ +libydb-cpp-dev +libydb-cpp-iam-dev ragel diff --git a/scripts/docs/en/userver/build/dependencies.md b/scripts/docs/en/userver/build/dependencies.md index a47b6522a905..d28578b8a9d2 100644 --- a/scripts/docs/en/userver/build/dependencies.md +++ b/scripts/docs/en/userver/build/dependencies.md @@ -16,6 +16,10 @@ Paths to dependencies start from the @ref service_templates "directory of your s Dependencies can be installed via: ```bash +YDB_DEPS_INSTALLER="https://raw.githubusercontent.com/userver-framework/userver/refs/heads/develop/scripts/ydb/install-ydb-cpp-sdk-debs.sh" && \ +wget -q -O /tmp/install-ydb-cpp-sdk-debs.sh ${YDB_DEPS_INSTALLER} && \ +sudo bash /tmp/install-ydb-cpp-sdk-debs.sh && \ +rm /tmp/install-ydb-cpp-sdk-debs.sh && \ DEPS_FILE="https://raw.githubusercontent.com/userver-framework/userver/refs/heads/develop/scripts/docs/en/deps/ubuntu-24.04.md" && \ sudo apt install --allow-downgrades -y $(wget -q -O - ${DEPS_FILE}) ``` diff --git a/scripts/ydb/install-ydb-cpp-sdk-debs.sh b/scripts/ydb/install-ydb-cpp-sdk-debs.sh new file mode 100755 index 000000000000..231b4b3d8820 --- /dev/null +++ b/scripts/ydb/install-ydb-cpp-sdk-debs.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -euo pipefail + +readonly YDB_CPP_SDK_VERSION="${YDB_CPP_SDK_VERSION:-3.21.0}" +readonly YDB_CPP_SDK_RELEASE_URL="https://github.com/ydb-platform/ydb-cpp-sdk/releases/download/v${YDB_CPP_SDK_VERSION}" +YDB_CPP_SDK_ARCHITECTURE="$(dpkg --print-architecture)" +readonly YDB_CPP_SDK_ARCHITECTURE +YDB_CPP_SDK_DEB_DIR="$(mktemp -d)" +readonly YDB_CPP_SDK_DEB_DIR + +cleanup() { + rm -rf "${YDB_CPP_SDK_DEB_DIR}" +} +trap cleanup EXIT + +download_deb() { + local filename="$1" + curl \ + --fail \ + --location \ + --retry 5 \ + --retry-all-errors \ + --output "${YDB_CPP_SDK_DEB_DIR}/${filename}" \ + "${YDB_CPP_SDK_RELEASE_URL}/${filename}" +} + +download_deb "yandex-googleapis-api-common-protos-1.0.0-Linux.deb" +download_deb "libydb-cpp-dev_${YDB_CPP_SDK_VERSION}_${YDB_CPP_SDK_ARCHITECTURE}.deb" +download_deb "libydb-cpp-iam-dev_${YDB_CPP_SDK_VERSION}_${YDB_CPP_SDK_ARCHITECTURE}.deb" + +export DEBIAN_FRONTEND=noninteractive +apt-get update +apt-get install -y --no-install-recommends "${YDB_CPP_SDK_DEB_DIR}"/*.deb From ce5e3ed0ca06300fa1f57fca258e52bea73081a0 Mon Sep 17 00:00:00 2001 From: Artem Ermoshkin Date: Mon, 3 Aug 2026 13:21:43 +0300 Subject: [PATCH 2/2] fix ydb deb builds to use system abseil --- .github/workflows/ci.yml | 1 + scripts/debian-rules | 1 + scripts/docker/ubuntu-24.04-userver.dockerfile | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec2e1c28565a..06be5b7706be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,7 @@ jobs: -DUSERVER_BUILD_SAMPLES=1 -DUSERVER_BUILD_TESTS=1 -DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF + -DUSERVER_FORCE_DOWNLOAD_ABSEIL=OFF os: ubuntu-24.04 info: gcc-13 + release id: ubuntu24_gcc13_release diff --git a/scripts/debian-rules b/scripts/debian-rules index 503d0033961c..df3e2586a0fe 100755 --- a/scripts/debian-rules +++ b/scripts/debian-rules @@ -12,6 +12,7 @@ CMAKE_OPTS = \ -DUSERVER_BUILD_SAMPLES=ON \ -DUSERVER_BUILD_ALL_COMPONENTS=1 \ -DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF \ + -DUSERVER_FORCE_DOWNLOAD_ABSEIL=OFF \ -DUSERVER_FEATURE_YDB=ON \ -DUSERVER_FEATURE_CLICKHOUSE=OFF \ -DUSERVER_FEATURE_PATCH_LIBPQ=OFF \ diff --git a/scripts/docker/ubuntu-24.04-userver.dockerfile b/scripts/docker/ubuntu-24.04-userver.dockerfile index 70419747d9d6..d88482630f32 100644 --- a/scripts/docker/ubuntu-24.04-userver.dockerfile +++ b/scripts/docker/ubuntu-24.04-userver.dockerfile @@ -9,6 +9,6 @@ RUN apt install -y pycodestyle sudo RUN git clone https://github.com/userver-framework/userver \ && cd userver \ - && BUILD_OPTIONS="-DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF -DUSERVER_FEATURE_GRPC_CHANNELZ=1 -DUSERVER_FEATURE_YDB=1" ./scripts/build_and_install_all.sh \ + && BUILD_OPTIONS="-DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF -DUSERVER_FORCE_DOWNLOAD_ABSEIL=OFF -DUSERVER_FEATURE_GRPC_CHANNELZ=1 -DUSERVER_FEATURE_YDB=1" ./scripts/build_and_install_all.sh \ && cd .. \ && rm -rf userver/