Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ commands:
name: Build for platform
command: |
ROOT=$PWD
make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1
# make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1
cd build/platforms
make build OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH ARTIFACTS=1 TEST=1 SHOW=1
cd $ROOT
mkdir -p tests/pytest/logs
tar -C tests/pytest/logs -xzf bin/artifacts/pytest-logs*.tgz
Expand All @@ -187,7 +189,9 @@ commands:
name: Build for platform (publish)
command: |
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1 PUBLISH=1 DOCKERWRAPPER_EXTRA_VARS="DOCKER_PUSH_ONLY=1"
# make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1 PUBLISH=1 DOCKERWRAPPER_EXTRA_VARS="DOCKER_PUSH_ONLY=1"
cd build/platforms
make publish OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH OFFICIAL=0 SHOW=1 VERBOSE=1
- persist-artifacts

benchmark-steps:
Expand Down Expand Up @@ -421,3 +425,4 @@ workflows:
jobs:
- performance-automation:
context: common

79 changes: 79 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# BUILD redisfab/rejson:${VERSION}-${ARCH}-${OSNICK}

ARG REDIS_VER=6.2.5
ARG REDISEARCH_BRANCH=master

# OSNICK=focal|bionic|xenial|bullseye|centos8|centos7
ARG OSNICK=bullseye

# OS=debian:bullseye-slim|ubuntu:bionic|centos:7
ARG OS=debian:bullseye-slim

# ARCH=x64|arm64v8|arm32v7
ARG ARCH=x64

ARG PACK=0
ARG TEST=0

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis
FROM ${OS} AS builder

ARG OSNICK
ARG OS
ARG ARCH
ARG REDIS_VER
ARG PACK
ARG TEST
ARG REDISEARCH_BRANCH

RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]"

WORKDIR /build
COPY --from=redis /usr/local/ /usr/local/

ADD . /build

RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy3
RUN ./system-setup.py

RUN bash -l -c make

RUN mkdir -p bin/artifacts
RUN set -e ;\
if [ "$PACK" = "1" ]; then bash -l -c "make pack"; fi
RUN set -e ;\
if [ "$TEST" = "1" ]; then \
bash -l -c "TEST= make test" ;\
cd /build/tests/pytest/logs ;\
rm -f *.aof *.rdb ;\
tar -czf /build/bin/artifacts/pytest-logs-${ARCH}-${OSNICK}.tgz . ;\
fi
RUN set -e ;\
BRANCH=$REDISEARCH_BRANCH ./sbin/get-redisearch ;\
cp /build/bin/linux-${OSNICK}-${ARCH}/RediSearch/redisearch.so /build/bin/

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK}

ARG REDIS_VER
ARG OSNICK
ARG ARCH

ENV LIBDIR /usr/lib/redis/modules
WORKDIR /data
RUN mkdir -p "$LIBDIR"

RUN mkdir -p /var/opt/redislabs/artifacts
RUN chown -R redis:redis /var/opt/redislabs
COPY --from=builder /build/bin/artifacts/ /var/opt/redislabs/artifacts
RUN true
COPY --from=builder /build/target/release/rejson.so "$LIBDIR"
RUN true
COPY --from=builder /build/bin/redisearch.so "$LIBDIR"

EXPOSE 6379
CMD ["redis-server", \
"--loadmodule", "/usr/lib/redis/modules/rejson.so", \
"--loadmodule", "/usr/lib/redis/modules/redisearch.so"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ pack:
#----------------------------------------------------------------------------------------------

docker:
@$(MAKE) -C ./build/docker
@make -C build/platforms build

docker_push:
docker push redislabs/rejson:latest
@make -C build/platforms publish

.PHONY: docker docker_push

Expand Down
1 change: 1 addition & 0 deletions build/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ OSNICK_OFFICIAL=bullseye
# VERSION=master, VERSION=2.0 is requireed.
REDISEARCH_VERSION=${VERSION}
export REDISEARCH_VERSION
export ART_INT_DIR=/usr/lib/redis/modules/

ROOT=../../
READIES=${ROOT}/deps/readies
Expand Down
19 changes: 19 additions & 0 deletions build/platforms/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

ROOT=../..
MK.pyver:=3
include $(ROOT)/deps/readies/mk/main

# OSNICK=bullseye|bionic|xenial|centos7|centos8
OSNICK ?= bullseye

REPO=rejson

REDIS_VER=6.2.5
REDISEARCH_VER=master

INT_BRANCHES=2.0 1.2 1.1 1.0

ART_DIR=$(ROOT)/bin/artifacts
ART_INT_DIR=/var/opt/redislabs/artifacts

include $(MK)/docker.native
2 changes: 1 addition & 1 deletion deps/readies
42 changes: 20 additions & 22 deletions sbin/get-redisearch
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

set -e

HERE=`dirname ${0}`
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
ROOT=$(cd $HERE/.. && pwd)
READIES=${ROOT}/deps/readies
. ${READIES}/shibumi/defs
READIES=$ROOT/deps/readies
. $READIES/shibumi/defs

if [[ ${1} == --help || ${1} == help || $HELP == 1 ]]; then
if [[ $1 == --help || $1 == help || $HELP == 1 ]]; then
cat <<-END
Get RediSearch module binaries

Expand All @@ -26,7 +26,7 @@ if [[ ${1} == --help || ${1} == help || $HELP == 1 ]]; then
fi

BRANCH=${BRANCH:-master}
if [ ${BRANCH} == "edge" ]; then
if [[ $BRANCH == edge ]]; then
BRANCH=master
fi

Expand All @@ -45,41 +45,40 @@ else
fi

dist="$($READIES/bin/platform --dist)"
nick="$($READIES/bin/platform --osnick)"

[[ $os == linux ]] && os=Linux
[[ $arch == x64 ]] && arch=x86_64

if [[ $dist == "ubuntu" ]]; then
if [[ $nick == "focal" ]]; then
if [[ -n $OSNICK ]]; then
nick="$OSNICK"
elif [[ $dist == ubuntu ]]; then
if [[ $nick == focal ]]; then
nick="ubuntu20.04"
elif [[ $nick == "bionic" ]]; then
elif [[ $nick == bionic ]]; then
nick="ubuntu18.04"
elif [[ $nick == "xenial" ]]; then
elif [[ $nick == xenial ]]; then
nick="ubuntu16.04"
elif [[ $nick == "trusty" ]]; then
elif [[ $nick == trusty ]]; then
nick="ubuntu14.04"
fi
elif [[ $dist == debian ]]; then
if [[ $nick != "bullseye" ]]; then
if [[ $nick != bullseye ]]; then
nick=ubuntu18.04
else
nick=ubuntu20.04
fi
elif [[ $dist == centos || $dist == redhat || $dist == fedora ]]; then
if [[ $nick == "centos8" ]]; then
if [[ $nick == centos8 ]]; then
nick="rhel8"
else
nick="rhel7"
fi
elif [[ ! -z $OSNICK ]]; then
nick=$OSNICK
else
nick="$($READIES/bin/platform --osnick)"
fi
platform="${os}-${nick}-${arch}"
fi

MOD_S3_URL="https://redismodules.s3.amazonaws.com/redisearch/snapshots"
MOD_RAMP="redisearch.${platform}.$BRANCH-snapshot.zip"
MOD_S3_URL="https://redismodules.s3.amazonaws.com/redisearch-oss/snapshots"
MOD_RAMP="redisearch-oss.${platform}.${BRANCH}-snapshot.zip"

DEST_DIR="$ROOT/bin/$($READIES/bin/platform -t)/RediSearch"
if [[ $FORCE != 1 && -d $DEST_DIR && -f $DEST_DIR/redisearch.so ]]; then
Expand All @@ -93,9 +92,9 @@ WORK_DIR=$(mktemp -d /tmp/redisearch.XXXXXX)

if [[ -z $REPO_PATH ]]; then
F_MOD_RAMP="${WORK_DIR}/${MOD_RAMP}"
if [[ ${FORCE} == 1 || ! -f ${F_MOD_RAMP} ]]; then
if [[ $FORCE == 1 || ! -f $F_MOD_RAMP ]]; then
echo "Download RediSearch [${MOD_S3_URL}/${MOD_RAMP}] ..."
$OP wget -P ${WORK_DIR} ${MOD_S3_URL}/${MOD_RAMP}
$OP wget -q -P ${WORK_DIR} ${MOD_S3_URL}/${MOD_RAMP}
fi
else
F_MOD_RAMP="${REPO_PATH}/artifacts/snapshots/${MOD_RAMP}"
Expand All @@ -105,7 +104,6 @@ else
fi
fi


$OP unzip -q $F_MOD_RAMP -d $WORK_DIR
if [[ -e ${DEST_DIR} ]]; then
echo "Removing existing ${DEST_DIR}"
Expand Down