Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install redis-server>=3.2.4 in docker-database image #46

Merged
merged 4 commits into from
Nov 1, 2016
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
33 changes: 20 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
USERNAME=
PASSWORD_ENCRYPTED=

## Redis server/tools version
REDIS_VERSION=3.2.4-1~bpo8+1_amd64

## Select bash for commands
SHELL := /bin/bash

Expand All @@ -22,14 +25,14 @@ define build_docker
mkdir -p `dirname $(2)`
docker save $(1) | gzip -c > $(2)
endef

## Rules: phony targets
.phony : brcm-all mlnx-all cavm-all p4-all

## Rules: redirect to sub directory
src/%:
$(MAKE) -C src $(subst src/,,$@)
$(MAKE) REDIS_VERSION=$(REDIS_VERSION) -C src $(subst src/,,$@)

## Rules: docker-fpm
dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd
mkdir -p `dirname $@` && cp $< $(dir $@)
Expand All @@ -41,13 +44,13 @@ dockers/docker-team/deps/teamsyncd: src/teamsyncd
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-team/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)

## Rules: docker-orchagent-mlnx
$(addprefix dockers/docker-orchagent-mlnx/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-mlnx/deps/%.deb : src/mlnx/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)

## Rules: docker-orchagent-cavm
$(addprefix dockers/docker-orchagent-cavm/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-cavm/deps/%.deb : src/cavm/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
Expand All @@ -59,7 +62,7 @@ $(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimet
mkdir -p `dirname $@` && cp $< $(dir $@)
dockers/docker-orchagent/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)

## Rules: docker-syncd-mlnx
$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
Expand All @@ -86,6 +89,10 @@ $(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_a
dockers/docker-syncd/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)

## Rules: docker-database
dockers/docker-database/deps/%.deb: src/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)

## Rules: docker-sonic (p4)
$(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb
mkdir -p `dirname $@` && cp $< $(dir $@)
Expand All @@ -101,40 +108,40 @@ target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/d
touch dockers/docker-syncd/deps/{dsserve,bcmcmd}
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBTEAM-DEBS))
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
target/docker-database.gz: target/docker-base.gz

target/docker-database.gz: target/docker-base.gz $(addprefix dockers/docker-database/deps/,redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb)
target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb)
docker load < $<
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)

Expand Down
11 changes: 7 additions & 4 deletions dockers/docker-database/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM docker-base

## Pre-install the fundamental packages
COPY ["deps/redis-tools_*.deb", "deps/redis-server_*.deb", "/deps/"]

## Install packages
## Clean up
RUN apt-get -y install \
redis-server \
&& \
RUN apt-get update && \
dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/redis-tools_*.deb && \
dpkg_apt /deps/redis-server_*.deb && \
apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y

RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \
Expand Down
8 changes: 5 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.ONESHELL:
SHELL := /bin/bash

REDIS_VERSION=3.2.4-1~bpo8+1_amd64

## Function: build_project, directory
## Build the project and save the .deb target in the same directory
## TRICK: clean dh state so it will force recreating .deb later
Expand All @@ -25,10 +27,10 @@ libnl-%.deb:
libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb: libnl-%.deb
pushd libteam; ./build.sh; popd

redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb:
redis-sentinel_$(REDIS_VERSION).deb redis-$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb:
pushd redis; ./build.sh; popd

libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb
libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb
pushd hiredis; ./build.sh; popd

libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb thrift-compiler_0.9.3-2_amd64.deb:
Expand Down Expand Up @@ -58,7 +60,7 @@ p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3
quagga_0.99.24.1-2.1_amd64.deb:
$(call build_project, sonic-quagga)

libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb
libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb
$(foreach dep, $^, $(call install_deb, $(dep)))
$(call build_project, sonic-swss-common)

Expand Down
13 changes: 5 additions & 8 deletions src/redis/build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/bin/bash -x

export REDIS_DOWNLOAD_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7.orig.tar.gz
export REDIS_PACKAGING_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7-2.debian.tar.xz
wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4.orig.tar.gz'
wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4-1~bpo8+1.dsc'
wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4-1~bpo8+1.debian.tar.xz'

wget -O redis_3.0.7-2.dsc 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.dsc?sv=2015-04-05&sr=b&sig=evQtsWTIUFlgWbzLLifS1lDgop%2BzlqIP8ehZl3p%2FCKI%3D&se=2026-07-24T01%3A48%3A19Z&sp=r'
wget -O redis_3.0.7.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7.orig.tar.gz?sv=2015-04-05&sr=b&sig=0ht16%2Fi8%2FPZQHp1PrDPYW0iRwcLfUPw1JpKUapizu8o%3D&se=2026-07-24T01%3A48%3A49Z&sp=r'
wget -O redis_3.0.7-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=4a33ECTvURfNUEDkS436ZlSsIpLIC9QdJrBBRIoWpW0%3D&se=2026-07-24T01%3A49%3A22Z&sp=r'
dpkg-source -x redis_3.2.4-1~bpo8+1.dsc

dpkg-source -x redis_3.0.7-2.dsc

pushd redis-3.0.7; fakeroot debian/rules binary; popd
pushd redis-3.2.4; fakeroot debian/rules binary; popd

cp *.deb ..