diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2e3b1c12345..06be5b7706be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,8 @@ jobs: -DUSERVER_BUILD_ALL_COMPONENTS=1 -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 @@ -129,6 +131,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 2162a2c339bb..7a618f5f6919 100644 --- a/.mapping.json +++ b/.mapping.json @@ -5370,6 +5370,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", @@ -6687,4 +6688,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 6ee834c9474f..c5b231ee30e5 100755 --- a/scripts/debian-rules +++ b/scripts/debian-rules @@ -5,16 +5,15 @@ 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 +# TODO: pg patch +# TODO: clickhouse CMAKE_OPTS = \ -DUSERVER_INSTALL=ON \ -DUSERVER_BUILD_SAMPLES=ON \ -DUSERVER_BUILD_ALL_COMPONENTS=1 \ - -DUSERVER_FEATURE_UTEST=ON \ - -# These features have no apt package for their C++ client libraries and are -# not shipped as libuserver-*-dev packages in this PPA -CMAKE_OPTS += \ - -DUSERVER_FEATURE_YDB=OFF \ + -DUSERVER_DOWNLOAD_PACKAGE_YDBCPPSDK=OFF \ + -DUSERVER_FORCE_DOWNLOAD_ABSEIL=OFF \ + -DUSERVER_FEATURE_YDB=ON \ -DUSERVER_FEATURE_CLICKHOUSE=OFF \ -DUSERVER_FEATURE_RABBITMQ=OFF \ -DUSERVER_FEATURE_PATCH_LIBPQ=OFF \ 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..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_FEATURE_GRPC_CHANNELZ=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/ diff --git a/scripts/docs/en/deps/ubuntu-24.04.md b/scripts/docs/en/deps/ubuntu-24.04.md index 40103f87499e..120deee918e5 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 90e0a34e3ad2..db5f1f8a33cc 100644 --- a/scripts/docs/en/deps/ubuntu-24.04/ydb +++ b/scripts/docs/en/deps/ubuntu-24.04/ydb @@ -1,3 +1,5 @@ +libydb-cpp-dev +libydb-cpp-iam-dev ragel python3-jinja2 python3-sqlparse 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