From 92d20794601ae5ccd47c0f021897fb46a351daee Mon Sep 17 00:00:00 2001 From: Kristi Nikolla Date: Tue, 2 Jul 2024 22:38:54 +0000 Subject: [PATCH 1/2] Enable RBD backed on SPDK We want to be able to offer SPDK as a backend too for users who want more stability, while we iron out LSVD. --- .github/workflows/build.yaml | 0 Makefile | 2 +- subprojects/packagefiles/spdk/configure-spdk.sh | 8 ++++---- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..e69de29b diff --git a/Makefile b/Makefile index a067ad93..3f46145c 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ install-deps: libzstd-dev ninja-build zlib1g-dev # SPDK deps sudo apt install -y libnuma-dev libarchive-dev libibverbs-dev librdmacm-dev \ - python3-pyelftools libcunit1-dev libaio-dev nasm + python3-pyelftools libcunit1-dev libaio-dev nasm librados-dev librbd-dev # LSVD deps sudo apt install -y meson mold libfmt-dev librados-dev \ libjemalloc-dev libradospp-dev pkg-config uuid-dev diff --git a/subprojects/packagefiles/spdk/configure-spdk.sh b/subprojects/packagefiles/spdk/configure-spdk.sh index 560af082..24033368 100644 --- a/subprojects/packagefiles/spdk/configure-spdk.sh +++ b/subprojects/packagefiles/spdk/configure-spdk.sh @@ -2,14 +2,14 @@ debug() { echo '===Building SPDK in debug mode...' - ./configure --enable-debug --without-fuse --without-nvme-cuse \ - --without-rbd --without-shared --without-xnvme + ./configure --enable-debug --with-rbd --without-fuse --without-nvme-cuse \ + --without-shared --without-xnvme } release() { echo '===Building SPDK in release mode...' - ./configure --without-fuse --without-nvme-cuse \ - --without-rbd --without-shared --without-xnvme + ./configure --with-rbd --without-fuse --without-nvme-cuse \ + --without-shared --without-xnvme } if [ $# -lt 1 ]; then From 6601c9e2e7b84944314ca8650641d8f7b376b895 Mon Sep 17 00:00:00 2001 From: Kristi Nikolla Date: Tue, 2 Jul 2024 22:41:37 +0000 Subject: [PATCH 2/2] Build SPDK & LSVD Container The container will be built and published to the GitHub container registry every time a PR is merged or a new release is cut. --- .github/workflows/build.yaml | 68 ++++++++++++++++++++++++++++++++++++ Dockerfile | 21 +++++++++++ docker-compose.yaml | 14 ++++++++ 3 files changed, 103 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e69de29b..9748f400 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -0,0 +1,68 @@ +name: Build + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + push: + branches: [main] + # Publish semver tags as releases. + tags: ['v*.*.*'] + pull_request: + branches: [main] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern=v{{version}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} + type=ref,event=branch + type=ref,event=pr + type=sha + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a9f728ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:22.04 + +# TODO(knikolla): Move (or remove) dependencies in the appropriate Makefile section +RUN apt-get update \ + && apt-get install -y git curl build-essential sudo cmake python3 python3-pip libssl-dev \ + && pip install -U meson + +RUN sudo apt-get install -y wget lsb-release software-properties-common gnupg \ + && wget https://apt.llvm.org/llvm.sh \ + && chmod +x llvm.sh \ + && ./llvm.sh 18 + +WORKDIR /app +COPY Makefile /app/Makefile +COPY meson.* /app/ +COPY src /app/src +COPY subprojects /app/subprojects +COPY test /app/test + +RUN make install-deps \ + && make debug diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..b99c8593 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +services: + spdk-lsvd: + image: lsvd-rbd + build: . + volumes: + - /dev/hugepages:/dev/hugepages + - /etc/ceph:/etc/ceph + - /var/tmp:/var/tmp + - /dev/shm:/dev/shm + network_mode: host + stdin_open: true + tty: true + privileged: true + entrypoint: /bin/bash