Skip to content

Commit

Permalink
ceph: improve building of dev images
Browse files Browse the repository at this point in the history
- Set `NVMEOF_GW` for `vstart` to work with nvmeof.
- Help debug ceph.repo issues.
- Add new `CEPH_CLUSTER_CEPH_REPO_BASEURL` alternative to setting
  `CEPH_BRANCH` and `CEPH_SHA`.
- Fix setting `CEPH_CLUSTER_CEPH_REPO_BASEURL` in `Makefile` not to
  override value if externally set (via .env).

Signed-off-by: Ernesto Puerta <[email protected]>
  • Loading branch information
epuertat committed Mar 20, 2024
1 parent a97e6fa commit 742bba9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ SPDK_CENTOS_REPO_VER="9.0-21.el9"

# Ceph Cluster
CEPH_CLUSTER_VERSION="${CEPH_VERSION}"
#CEPH_CLUSTER_VSTART_VERSION="v${CEPH_VERSION}"
CEPH_CLUSTER_VSTART_VERSION="main"
CEPH_BRANCH=ceph-nvmeof-mon
CEPH_SHA=a4f2962ef7ad30b6e015c14e2c398015a766695a
CEPH_VSTART_ARGS="--memstore"
CEPH_DEVEL_MGR_PATH=../ceph
#CEPH_CLUSTER_CEPH_REPO_BASEURL=https://1.chacra.ceph.com/r/ceph/main/71e6beb6de9ad34b7d44be0ccdf38721ae92202d/centos/9/flavors/default

# Demo settings
RBD_POOL=rbd
Expand Down
20 changes: 14 additions & 6 deletions Dockerfile.ceph
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ FROM quay.io/centos/centos:stream9-minimal AS build


ARG CEPH_CLUSTER_VERSION
ARG CEPH_CLUSTER_VSTART_VERSION
ARG CEPH_CLUSTER_CEPH_REPO_BASEURL
ARG CEPH_BRANCH
ARG CEPH_SHA
ARG CEPH_CLUSTER_EPEL_REPO_URL="https://copr.fedorainfracloud.org/coprs/ceph/el9/repo/epel-9/ceph-el9-epel-9.repo"

ARG MICRODNF_OPTS="\
Expand Down Expand Up @@ -48,6 +51,9 @@ RUN <<EOF
echo ======================================================================
echo CEPH_CLUSTER_CEPH_REPO_BASEURL=$CEPH_CLUSTER_CEPH_REPO_BASEURL
echo CEPH_CLUSTER_VERSION=$CEPH_CLUSTER_VERSION
echo CEPH_CLUSTER_VSTART_VERSION=$CEPH_CLUSTER_VSTART_VERSION
echo CEPH_BRANCH=$CEPH_BRANCH
echo CEPH_SHA=$CEPH_SHA
echo ======================================================================
EOF

Expand All @@ -73,6 +79,8 @@ RUN rpm -vih https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.
RUN rpm --import 'https://download.ceph.com/keys/release.asc'
RUN curl -O --output-dir /etc/yum.repos.d/ ${CEPH_CLUSTER_EPEL_REPO_URL:?}

RUN cat /etc/yum.repos.d/ceph.repo

RUN --mount=type=cache,target=/var/cache/microdnf \
microdnf install -y $MICRODNF_OPTS \
$CEPH_PACKAGES \
Expand All @@ -83,12 +91,12 @@ RUN --mount=type=cache,target=/var/cache/microdnf \
#------------------------------------------------------------------------------
FROM build

LABEL maintainer \
LABEL maintainer="$MAINTAINER" \
ceph=True \
RELEASE \
GIT_REPO \
GIT_BRANCH \
GIT_COMMIT
RELEASE="$RELEASE" \
GIT_REPO="$GIT_REPO" \
GIT_BRANCH="$GIT_BRANCH" \
GIT_COMMIT="$GIT_COMMIT"

ENV MON=1 \
MGR=1 \
Expand Down Expand Up @@ -118,7 +126,7 @@ RUN ln -sf $EC_PATH/* $CEPH_LIB && \
USER ceph
WORKDIR /ceph
ADD --chown=ceph:ceph --chmod=755 \
https://raw.githubusercontent.com/ceph/ceph/v${CEPH_CLUSTER_VERSION:?}/src/vstart.sh .
https://raw.githubusercontent.com/ceph/ceph/${CEPH_CLUSTER_VSTART_VERSION:?}/src/vstart.sh .

COPY <<EOF ./CMakeCache.txt
ceph_SOURCE_DIR:STATIC=/ceph
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.spdk
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ ARG SPDK_CENTOS_REPO_VER="9.0-21.el9"

ARG SPDK_PKGDEP_ARGS \
SPDK_CONFIGURE_ARGS \
SPDK_MAKEFLAGS
SPDK_MAKEFLAGS \
SPDK_TARGET_ARCH

ARG SPDK_NAME \
SPDK_SUMMARY \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build: export SPDK_GIT_BRANCH != git -C spdk name-rev --name-only HEAD
build: export SPDK_GIT_COMMIT != git rev-parse HEAD:spdk
build: export BUILD_DATE != date -u +"%Y-%m-%d %H:%M:%S %Z"
build: export NVMEOF_GIT_MODIFIED_FILES != git status -s | grep -e "^ *M" | sed 's/^ *M //' | xargs
build: export CEPH_CLUSTER_CEPH_REPO_BASEURL != curl -s https://shaman.ceph.com/api/repos/ceph/$(CEPH_BRANCH)/$(CEPH_SHA)/centos/9/ | jq -r '.[0].url'
build: export CEPH_CLUSTER_CEPH_REPO_BASEURL ?= $(shell curl -s https://shaman.ceph.com/api/repos/ceph/$(CEPH_BRANCH)/$(CEPH_SHA)/centos/9/ | jq -r '.[0].url' )

up: ## Launch services
up: SCALE?= 1 ## Number of gateways
Expand Down
7 changes: 4 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ services:
dockerfile: Dockerfile.ceph
args:
CEPH_CLUSTER_VERSION:
CEPH_CLUSTER_VSTART_VERSION:
CEPH_CLUSTER_CEPH_REPO_BASEURL:
CEPH_BRANCH:
CEPH_SHA:
labels:
io.ceph.nvmeof:
environment:
TOUCHFILE: /tmp/ceph.touch
NVMEOF_GW: ${NVMEOF_IP_ADDRESS}:${NVMEOF_GW_PORT}
entrypoint: >-
sh -c './vstart.sh --new $$CEPH_VSTART_ARGS &&
ceph osd pool create rbd &&
echo ceph dashboard nvmeof-gateway-add -i <(echo nvmeof-devel:5500) nvmeof.1 &&
sleep infinity'
healthcheck:
test: ceph osd pool stats rbd
Expand Down

0 comments on commit 742bba9

Please sign in to comment.