Skip to content

Commit

Permalink
feat: add fdb
Browse files Browse the repository at this point in the history
  • Loading branch information
id committed Apr 26, 2024
1 parent fe5fb42 commit e34617b
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 96 deletions.
42 changes: 14 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,20 @@ FROM ${BUILD_FROM}

ENV EMQX_BUILDER_IMAGE=${BUILD_FROM}

ARG OTP_VERSION

COPY get-otp.sh /get-otp.sh
RUN /get-otp.sh ${OTP_VERSION}

ARG ELIXIR_VERSION

COPY get-elixir.sh /get-elixir.sh
RUN /get-elixir.sh ${ELIXIR_VERSION}

RUN mkdir /tools

ARG EMQTT_BENCH_REF

COPY get-emqtt-bench.sh /get-emqtt-bench.sh
RUN /get-emqtt-bench.sh "${EMQTT_BENCH_REF:-0.4.17}"

ARG LUX_REF
ENV LUX_REF=${LUX_REF:-lux-2.9.1}

RUN git clone --depth=1 --branch=${LUX_REF} https://github.com/hawk/lux /tools/lux \
&& cd /tools/lux \
&& autoconf \
&& ./configure \
&& make \
&& make install \
&& cd /tools \
&& rm -rf lux
ARG OTP_VERSION=26.2.3-1
ARG ELIXIR_VERSION=1.15.7
ARG FDB_VERSION=7.3.27
ARG EMQTT_BENCH_REF=0.4.17
ARG LUX_REF=lux-2.9.1

COPY get-otp.sh get-elixir.sh get-fdb.sh get-emqtt-bench.sh get-lux.sh /

RUN /get-otp.sh ${OTP_VERSION} && \
/get-elixir.sh ${ELIXIR_VERSION} && \
env FDB_VERSION=${FDB_VERSION} /get-fdb.sh && \
env EMQTT_BENCH_REF=${EMQTT_BENCH_REF} /get-emqtt-bench.sh && \
env LUX_REF=${LUX_REF} /get-lux.sh && \
rm /get-otp.sh /get-elixir.sh /get-fdb.sh /get-emqtt-bench.sh /get-lux.sh

WORKDIR /
CMD [ "/bin/bash" ]
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
IMAGES = alpine3.15 amzn2 amzn2023 debian10 debian11 debian12 el7 el8 el9 ubuntu18.04 ubuntu20.04 ubuntu22.04

.PHONY: all
all: $(IMAGES)

.PHONY: $(IMAGES)
define gen-build-image-target
$1:
@docker build -t ghcr.io/emqx/emqx-builder:$1-base $1
@docker build --build-arg BUILD_FROM=ghcr.io/emqx/emqx-builder:$1-base -t ghcr.io/emqx/emqx-builder:$1 .
endef
$(foreach img,$(IMAGES),$(eval $(call gen-build-image-target,$(img))))

.PHONY: $(IMAGES:%=%-push)
define gen-push-image-target
$1-push:
@docker push ghcr.io/emqx/emqx-builder:$1-base
@docker push ghcr.io/emqx/emqx-builder:$1
endef
$(foreach img,$(IMAGES),$(eval $(call gen-push-image-target,$(img))))
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ List per major version used by EMQX, quic, rocksdb builds
OTP version from emqx/otp.git:

+ OTP-25.3.2-2
+ OTP-26.2.1-2
+ OTP-26.2.3-1

Elixir version from elixir-lang/elixir.git:
Expand Down
17 changes: 11 additions & 6 deletions get-emqtt-bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -xeuo pipefail

VSN="${1:-0.4.17}"

if grep -q -i 'rhel' /etc/os-release; then
. /etc/os-release
if [[ "${ID_LIKE:-}" =~ rhel|fedora ]]; then
DIST='el'
VERSION_ID="$(rpm --eval '%{rhel}')"
else
DIST="$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')"
VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')"
case ${ID} in
amzn)
VERSION_ID="7"
;;
*)
VERSION_ID="${VERSION_ID%%.*}"
;;
esac
fi
SYSTEM="$(echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g')"
SYSTEM="${ID}${VERSION_ID}"

# no quic on raspbian9 and centos7
case "$SYSTEM" in
Expand Down
49 changes: 49 additions & 0 deletions get-fdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -euo pipefail

ARCH=$(arch)
if [ "${ARCH}" != "x86_64" ]; then
echo "Unsupported architecture: ${ARCH}"
exit 0
fi

BASE_URL="https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}"
. /etc/os-release
if [[ "${ID_LIKE:-}" =~ rhel|fedora ]]; then
DIST='el'
case ${ID} in
amzn)
VERSION_ID="7"
;;
*)
VERSION_ID="${VERSION_ID%%.*}"
;;
esac
SYSTEM="${DIST}${VERSION_ID}"
case ${SYSTEM} in
el7)
wget "${BASE_URL}/foundationdb-clients-${FDB_VERSION}-1.${SYSTEM}.${ARCH}.rpm" -O ./foundationdb-clients.rpm
rpm -i ./foundationdb-clients.rpm
rm ./foundationdb-clients.rpm
;;
*)
echo "Unsupported system: ${SYSTEM}"
exit 0
;;
esac
else if [[ "${ID:-}" =~ debian|ubuntu ]]; then
ARCH=$(dpkg --print-architecture)
SYSTEM="${ID}${VERSION_ID}"
case ${SYSTEM} in
debian11 | debian12 | ubuntu20.04 | ubuntu22.04)
wget "${BASE_URL}/foundationdb-clients_${FDB_VERSION}-1_${ARCH}.deb" -O foundationdb-clients.deb
dpkg -i foundationdb-clients.deb
rm foundationdb-clients.deb
;;
*)
echo "Unsupported system: ${SYSTEM}"
exit 0
;;
esac
fi
15 changes: 15 additions & 0 deletions get-lux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -xeuo pipefail

LUX_REF="${LUX_REF:-lux-2.9.1}"

mkdir -p /tools
git clone --depth=1 --branch=${LUX_REF} https://github.com/hawk/lux /tools/lux
cd /tools/lux
autoconf
./configure
make
make install
cd /tools
rm -rf lux
62 changes: 0 additions & 62 deletions ubuntu22.04fdb/Dockerfile

This file was deleted.

0 comments on commit e34617b

Please sign in to comment.