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
6 changes: 2 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ commands:
name: Build for platform
command: |
ROOT=$PWD
cd build/platforms
make build OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH ARTIFACTS=1 TEST=1 SHOW=1
make -C build/docker build DOCKER_SUFFIX=".<<parameters.platform>>" OSNICK=<<parameters.platform>> PACK=1 TEST=1 VERBOSE=1
cd $ROOT
mkdir -p tests/pytest/logs
tar -C tests/pytest/logs -xzf bin/artifacts/pytest-logs*.tgz
Expand All @@ -188,8 +187,7 @@ commands:
name: Build for platform (publish)
command: |
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
cd build/platforms
make publish OSNICK="<<parameters.platform>>" VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH OFFICIAL=0 SHOW=1 VERBOSE=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"
- persist-artifacts

benchmark-steps:
Expand Down
67 changes: 0 additions & 67 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pack:
#----------------------------------------------------------------------------------------------

docker:
docker build --pull -t rejson:latest .
@$(MAKE) -C ./build/docker

docker_push:
docker push redislabs/rejson:latest
Expand Down
15 changes: 15 additions & 0 deletions build/docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
REDIS_VERSION=6.2.5
PRODUCT=rejson

OSNICK ?= bullseye
OSNICK_OFFICIAL=bullseye

# if there's a need to manually set the version, override.
# by default this uses ${VERSION} but in a private branch testing with
# VERSION=master, VERSION=2.0 is requireed.
REDISEARCH_VERSION=${VERSION}
export REDISEARCH_VERSION

ROOT=../../
READIES=${ROOT}/deps/readies
include ${READIES}/mk/docker.rules
41 changes: 41 additions & 0 deletions build/docker/dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#----------------------------------------------------------------------------------------------
FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}} AS redis
FROM {{REDIS_OS}} AS builder

RUN echo "Building for {{REDIS_OSNICK}} ({{REDIS_OS}}) for {{REDIS_ARCH}} [with Redis {{REDIS_VERSION}}]"

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

ADD . /build

{% include 'setup_environment.yml' %}
RUN ./system-setup.py

RUN bash -l -c make

RUN mkdir -p bin/artifacts
{% if REDIS_PACK == "1" %}
RUN bash -e -l -c "make pack"
{% endif %}

{% if REDIS_TEST == "1" %}
RUN set -e ;\
bash -l -c "TEST= make test" ;\
cd /build/tests/pytest/logs ;\
rm -f *.aof *.rdb ;\
tar -czf /build/bin/artifacts/pytest-logs-{{REDIS_ARCH}}-{{REDIS_OSNICK}}.tgz .
{% endif %}
RUN BRANCH={{REDISEARCH_VERSION}} ./sbin/get-redisearch

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}}
WORKDIR /data
{% set LIBDIR= "/usr/lib/redis/modules" %}
RUN mkdir -p {{LIBDIR}}

COPY --from=builder /build/target/release/rejson.so {{LIBDIR}}/rejson.so
COPY --from=builder /build/bin/linux-{{REDIS_OSNICK}}-{{REDIS_ARCH}}/RediSearch/module-enterprise.so {{LIBDIR}}/redisearch.so
RUN chown -R redis:redis {{LIBDIR}}
EXPOSE 6379
CMD ["redis-server", "--loadmodule", "{{LIBDIR}}/rejson.so", "--loadmodule", "{{LIBDIR}}/redisearch.so"]
18 changes: 0 additions & 18 deletions build/platforms/Makefile

This file was deleted.

119 changes: 119 additions & 0 deletions sbin/get-redisearch
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/bin/bash

set -e

HERE=`dirname ${0}`
ROOT=$(cd $HERE/.. && pwd)
READIES=${ROOT}/deps/readies
. ${READIES}/shibumi/defs

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

get-redisearch [--help|help]

Argument variables:
OSNICK=nick Get binaries for given osnick
BRANCH=name Use given branch
REPO_PATH=dir Get binaries from given repo path
FORCE=1 Download module even if already present
NOP=1 No operation
HELP=1 Show help

END
exit 0
fi

BRANCH=${BRANCH:-master}

OP=""
[[ $NOP == 1 ]] && OP=echo

os="$($READIES/bin/platform --os)"
arch="$($READIES/bin/platform --arch)"

if [[ ! -z $REPO_PATH ]]; then
platform="$($READIES/bin/platform -t)"
else
if [[ $os != linux && $os != macos || $arch != x64 ]]; then
eprint "Cannot match binary artifacts - build RediSearch and set REPO_PATH"
exit 1
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
nick="ubuntu20.04"
elif [[ $nick == "bionic" ]]; then
nick="ubuntu18.04"
elif [[ $nick == "xenial" ]]; then
nick="ubuntu16.04"
elif [[ $nick == "trusty" ]]; then
nick="ubuntu14.04"
fi
elif [[ $dist == debian ]]; 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
nick="rhel8"
else
nick="rhel7"
fi
elif [[ ! -z $OSNICK ]]; then
nick=$OSNICK
fi
platform="${os}-${nick}-${arch}"
fi

MOD_S3_URL="https://redismodules.s3.amazonaws.com/redisearch/snapshots"
MOD_RAMP="redisearch.${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
echo "RediSearch is in ${DEST_DIR}:"
$OP du -ah --apparent-size $DEST_DIR
exit 0
fi

$OP mkdir -p $(dirname ${DEST_DIR})
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
echo "Download RediSearch [${MOD_S3_URL}/${MOD_RAMP}] ..."
$OP wget -P ${WORK_DIR} ${MOD_S3_URL}/${MOD_RAMP}
fi
else
F_MOD_RAMP="${REPO_PATH}/artifacts/snapshots/${MOD_RAMP}"
if [[ ! -f $F_MOD_RAMP ]]; then
eprint "$F_MOD_RAMP is missing - build RediSearch and set REPO_PATH"
exit 1
fi
fi


$OP unzip -q $F_MOD_RAMP -d $WORK_DIR
if [[ -e ${DEST_DIR} ]]; then
echo "Removing existing ${DEST_DIR}"
$OP rm -rf ${DEST_DIR}
fi
# $OP mv $WORK_DIR $DEST_DIR
$OP rsync -a --no-owner --no-group --remove-source-files $WORK_DIR/* $DEST_DIR

echo "RediSearch installed into ${DEST_DIR}:"
if [[ $os == linux ]]; then
$OP du -ah --apparent-size $DEST_DIR
else
$OP du -ah $DEST_DIR
fi
5 changes: 3 additions & 2 deletions system-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def __init__(self, nop=False):

def common_first(self):
self.install_downloaders()
self.install("unzip")
self.pip_install("wheel")
self.pip_install("setuptools --upgrade")

self.install("git")
self.install("git rsync")

if not self.has_command("clang"):
if not self.has_command("clang"):
self.run("%s/bin/getclang --modern" % READIES)
if not self.has_command("rustc"):
self.run("%s/bin/getrust" % READIES)
Expand Down