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
194 changes: 119 additions & 75 deletions .circleci/config.yml

Large diffs are not rendered by default.

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

ARG REDIS_VER=6.2.5
ARG REDISEARCH_BRANCH=master

ARG OSNICK=bullseye
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
FROM redisfab/redis:6.2.6-x64-bullseye AS redis
FROM debian:bullseye-slim AS builder

ARG OSNICK
ARG OS
ARG ARCH
ARG REDIS_VER
ARG PACK
ARG TEST
ARG REDISEARCH_BRANCH
RUN if [ -f /root/.profile ]; then sed -ie 's/mesg n/tty -s \&\& mesg -n/g' /root/.profile; fi
SHELL ["/bin/bash", "-l", "-c"]

RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]"
RUN echo "Building for bullseye (debian:bullseye-slim) for x64 [with Redis 6.2.6]"

WORKDIR /build
COPY --from=redis /usr/local/ /usr/local/
Expand All @@ -35,42 +17,25 @@ RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy3
RUN ./sbin/system-setup.py

RUN bash -l -c make
RUN /usr/local/bin/redis-server --version

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/
RUN make build SHOW=1

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK}
FROM redisfab/redisearch:master-x64-bullseye AS search
FROM redisfab/redis:6.2.6-x64-bullseye

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 mkdir -p "/usr/lib/redis/modules"

COPY --from=builder /build/bin/linux-x64-release/rejson.so* "/usr/lib/redis/modules/"
RUN true
COPY --from=builder /build/bin/linux-${ARCH}-release/rejson.so "$LIBDIR"
COPY --from=search /usr/lib/redis/modules/redisearch.so* "/usr/lib/redis/modules/"
RUN true
COPY --from=builder /build/bin/redisearch.so "$LIBDIR"

EXPOSE 6379
RUN chown -R redis:redis /usr/lib/redis/modules

CMD ["redis-server", \
"--loadmodule", "/usr/lib/redis/modules/rejson.so", \
"--loadmodule", "/usr/lib/redis/modules/redisearch.so"]
"--loadmodule", "/usr/lib/redis/modules/redisearch.so"]
32 changes: 23 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ endif
export SAN
endif # SAN

#----------------------------------------------------------------------------------------------

ROOT=.
ifeq ($(wildcard $(ROOT)/deps/readies/*),)
$(info $(shell git submodule update --init --recursive &> /dev/null))
___:=$(shell git submodule update --init --recursive &> /dev/null)
endif

MK.pyver:=3
Expand Down Expand Up @@ -52,15 +54,21 @@ make pytest # run flow tests using RLTest
VERBOSE=1 # display more RLTest-related information

make pack # build package (RAMP file)
make upload-artifacts # copy snapshot packages to S3
OSNICK=nick # copy snapshots for specific OSNICK
make upload-release # copy release packages to S3

common options for upload operations:
STAGING=1 # copy to staging lab area (for validation)
FORCE=1 # allow operation outside CI environment
VERBOSE=1 # show more details
NOP=1 # do not copy, just print commands

make coverage # perform coverage analysis
make show-cov # show coverage analysis results (implies COV=1)
make upload-cov # upload coverage analysis results to codecov.io (implies COV=1)

make docker
make docker_push

make platform # build for specific Linux distribution
make docker # build for specific Linux distribution
OSNICK=nick # Linux distribution to build for
REDIS_VER=ver # use Redis version `ver`
TEST=1 # test aftar build
Expand Down Expand Up @@ -226,7 +234,13 @@ bench benchmark: $(TARGET)
pack:
$(SHOW)MODULE=$(abspath $(TARGET)) ./sbin/pack.sh

.PHONY: pack
upload-release:
$(SHOW)RELEASE=1 ./sbin/upload-artifacts

upload-artifacts:
$(SHOW)SNAPSHOT=1 ./sbin/upload-artifacts

.PHONY: pack upload-artifacts upload-release

#----------------------------------------------------------------------------------------------

Expand All @@ -253,10 +267,10 @@ docker_push:

#----------------------------------------------------------------------------------------------

platform:
$(SHOW)make -C build/platforms build
docker:
$(SHOW)$(MAKE) -C build/docker
ifeq ($(PUBLISH),1)
$(SHOW)make -C build/platforms publish
$(SHOW)make -C build/docker publish
endif

ifneq ($(wildcard /w/*),)
Expand Down
23 changes: 13 additions & 10 deletions build/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ ROOT=../..
MK.pyver:=3
include $(ROOT)/deps/readies/mk/main

REDIS_VERSION=6.2.5
PRODUCT=rejson
REPO=rejson

OSNICK ?= bullseye
OSNICK_OFFICIAL=bullseye
REDIS_VERSION=6.2.6

# 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.
export REDISEARCH_VERSION=$(VERSION)
export ART_INT_DIR=/usr/lib/redis/modules/
OSNICK.official=bullseye

include $(MK)/docker.rules
INT_BRANCHES=2.0 1.2 1.0
LATEST_BRANCH=2.0
PREVIEW_BRANCH=2.0

ART_DIR=$(ROOT)/bin/artifacts

REDISEARCH_VERSION=master
DOCKER_VARS += REDISEARCH_VERSION

include $(MK)/module.docker.rules
62 changes: 42 additions & 20 deletions build/docker/dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -1,43 +1,65 @@

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}} AS redis
FROM {{REDIS_OS}} AS builder
FROM redisfab/redis:{{REDIS_VERSION}}-{{ARCH}}-{{OSNICK}} AS redis
FROM {{OS}} AS builder

RUN if [ -f /root/.profile ]; then sed -ie 's/mesg n/tty -s \&\& mesg -n/g' /root/.profile; fi
SHELL ["/bin/bash", "-l", "-c"]

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

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

ADD . /build

{% include 'setup_environment.yml' %}
RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy3
RUN ./sbin/system-setup.py

RUN bash -l -c make
RUN /usr/local/bin/redis-server --version

RUN make build SHOW=1

{% if PACK == "1" %}
RUN mkdir -p bin/artifacts
{% if REDIS_PACK == "1" %}
RUN bash -e -l -c "make pack"
RUN make pack
RUN set -e ;\
echo "Artifacts:" ;\
du -ah --apparent-size /build/bin/artifacts
{% endif %}

{% if REDIS_TEST == "1" %}
{% if TEST == "1" %}
RUN TEST='' make test
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 .
tar -czf /build/bin/artifacts/pytest-logs-{{ARCH}}-{{OSNICK}}.tgz .
{% endif %}
RUN BRANCH={{REDISEARCH_VERSION}} ./sbin/get-redisearch ;\
cp /build/bin/linux-${REDIS_OSNICK}-${REDIS_ARCH}/RediSearch/redisearch.so /build/bin/

# RUN BRANCH={{REDISEARCH_VERSION}} ./sbin/get-redisearch
# RUN cp /build/bin/linux-{{OSNICK}}-{{ARCH}}/RediSearch/redisearch.so /build/bin/

#----------------------------------------------------------------------------------------------
FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}}
FROM redisfab/redisearch:{{REDISEARCH_VERSION}}-{{ARCH}}-{{OSNICK}} AS search
FROM redisfab/redis:{{REDIS_VERSION}}-{{ARCH}}-{{OSNICK}}

WORKDIR /data
{% set LIBDIR= "/usr/lib/redis/modules" %}
RUN mkdir -p {{LIBDIR}}

COPY --from=builder /build/bin/linux-${{REDIS_ARCH}}-release/rejson.so {{LIBDIR}}/rejson.so
RUN mkdir -p "{{MODULES_DIR}}"

COPY --from=builder /build/bin/linux-{{ARCH}}-release/rejson.so* "{{MODULES_DIR}}/"
RUN true
COPY --from=search {{MODULES_DIR}}/redisearch.so* "{{MODULES_DIR}}/"
# COPY --from=builder /build/bin/redisearch.so {{MODULES_DIR}}/redisearch.so
RUN true
COPY --from=builder /build/bin/redisearch.so {{LIBDIR}}/redisearch.so
RUN chown -R redis:redis {{LIBDIR}}
EXPOSE 6379
CMD ["redis-server", "--loadmodule", "{{LIBDIR}}/rejson.so", "--loadmodule", "{{LIBDIR}}/redisearch.so"]

{% if ARTIFACTS == "1" %}
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/
{% endif %}

RUN chown -R redis:redis {{MODULES_DIR}}

CMD ["redis-server", "--loadmodule", "{{MODULES_DIR}}/rejson.so", "--loadmodule", "{{MODULES_DIR}}/redisearch.so"]
68 changes: 0 additions & 68 deletions build/platforms/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions build/platforms/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion deps/readies
Loading