From 8c189cb46b8c7f95d1863ee71dc7b9e9a30fcbcb Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 28 Oct 2016 18:05:16 -0700 Subject: [PATCH 1/4] Install redis-server>=3.2.4 --- dockers/docker-database/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dockers/docker-database/Dockerfile b/dockers/docker-database/Dockerfile index 4499f4a8f8fa..991c8c1860dc 100755 --- a/dockers/docker-database/Dockerfile +++ b/dockers/docker-database/Dockerfile @@ -1,8 +1,12 @@ FROM docker-base -## Pre-install the fundamental packages +## TODO: remove if redis-server 3.2.4 comes into stable sources +COPY backports.list /etc/apt/sources.list.d/ + +## Install packages ## Clean up -RUN apt-get -y install \ +RUN apt-get update && \ + apt-get -y -t jessie-backports install \ redis-server \ && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y From 96cc92f72116b0e8b37eec46246fbc8b99414c7d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 28 Oct 2016 18:27:27 -0700 Subject: [PATCH 2/4] Reformat --- dockers/docker-database/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dockers/docker-database/Dockerfile b/dockers/docker-database/Dockerfile index 991c8c1860dc..54538984239d 100755 --- a/dockers/docker-database/Dockerfile +++ b/dockers/docker-database/Dockerfile @@ -6,9 +6,7 @@ COPY backports.list /etc/apt/sources.list.d/ ## Install packages ## Clean up RUN apt-get update && \ - apt-get -y -t jessie-backports install \ - redis-server \ - && \ + apt-get -y -t jessie-backports install redis-server && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \ From 310a30d96177a192179c60af8fbfbf911199307b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 31 Oct 2016 14:05:01 -0700 Subject: [PATCH 3/4] Build redis from source code --- Makefile | 28 ++++++++++++++++------------ dockers/docker-database/Dockerfile | 9 +++++---- src/Makefile | 2 +- src/redis/build.sh | 13 +++++-------- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 03a67bde0937..e78552bb8b46 100644 --- a/Makefile +++ b/Makefile @@ -22,14 +22,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/,,$@) - + ## Rules: docker-fpm dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd mkdir -p `dirname $@` && cp $< $(dir $@) @@ -41,13 +41,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 $@) @@ -59,7 +59,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 $@) @@ -86,6 +86,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 $@) @@ -101,7 +105,7 @@ 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,%,$@),$@) @@ -109,11 +113,11 @@ target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-sy 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,%,$@),$@) @@ -121,7 +125,7 @@ target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docke 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,%,$@),$@) @@ -129,12 +133,12 @@ target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/ 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_3.2.4-1~bpo8+1_amd64.deb redis-tools_3.2.4-1~bpo8+1_amd64.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_3.2.4-1~bpo8+1_amd64.deb redis-tools_3.2.4-1~bpo8+1_amd64.deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-database/Dockerfile b/dockers/docker-database/Dockerfile index 54538984239d..2014cd8919f0 100755 --- a/dockers/docker-database/Dockerfile +++ b/dockers/docker-database/Dockerfile @@ -1,12 +1,13 @@ FROM docker-base -## TODO: remove if redis-server 3.2.4 comes into stable sources -COPY backports.list /etc/apt/sources.list.d/ +COPY ["deps/redis-tools_*.deb", "deps/redis-server_*.deb", "/deps/"] ## Install packages ## Clean up -RUN apt-get update && \ - apt-get -y -t jessie-backports 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 \ diff --git a/src/Makefile b/src/Makefile index 0fc5aff8c3c2..93328add84a2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,7 +25,7 @@ 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_3.2.4-1~bpo8+1_amd64.deb redis-server_3.2.4-1~bpo8+1_amd64.deb redis-tools_3.2.4-1~bpo8+1_amd64.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 diff --git a/src/redis/build.sh b/src/redis/build.sh index 44f3e06018cb..9ff33de6d137 100755 --- a/src/redis/build.sh +++ b/src/redis/build.sh @@ -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 .. From ff28b4fb3cf2bad3eeda84bec57c1168cf1d52b9 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 31 Oct 2016 17:01:08 -0700 Subject: [PATCH 4/4] Add Makefile var: REDIS_VERSION --- Makefile | 9 ++++++--- src/Makefile | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e78552bb8b46..fc48ee3294e5 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -28,7 +31,7 @@ endef ## 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 @@ -134,11 +137,11 @@ target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/dep docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-database.gz: target/docker-base.gz $(addprefix dockers/docker-database/deps/,redis-server_3.2.4-1~bpo8+1_amd64.deb redis-tools_3.2.4-1~bpo8+1_amd64.deb) +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.2.4-1~bpo8+1_amd64.deb redis-tools_3.2.4-1~bpo8+1_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,%,$@),$@) diff --git a/src/Makefile b/src/Makefile index 93328add84a2..e9f415e272ac 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 @@ -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-sentinel_3.2.4-1~bpo8+1_amd64.deb redis-server_3.2.4-1~bpo8+1_amd64.deb redis-tools_3.2.4-1~bpo8+1_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: @@ -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)