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

[database]: Mount /var/run/redis/ folder from host for all dockers #418

Merged
merged 2 commits into from
Mar 23, 2017
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
3 changes: 3 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip
sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0'
## Note: keep pip installed for maintainance purpose
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you upgrade the access to the redis DB, may I suggest to also add here python redis module installation?
sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. I will add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add this in the file files/build_templates/sonic_debian_extension.j2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andriymoroz-mlnx could you check?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with ONE Image build. Works fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the verification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan tested internally and it worked.


## Create /var/run/redis folder for docker-database to mount
sudo mkdir -p $FILESYSTEM_ROOT/var/run/redis

## Config DHCP for eth0
sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null <<EOF

Expand Down
2 changes: 2 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ start() {
if [ "$?" -eq "0" ]; then
docker start {{docker_container_name}}
else

docker run -d {{docker_image_run_opt}} \
-v /var/run/redis:/var/run/redis:rw \
-v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \
-v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \
--name={{docker_container_name}} {{docker_image_name}}
Expand Down
5 changes: 4 additions & 1 deletion files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
# Install SONiC config engine
CONFIG_ENGINE_WHL_NAME=`basename {{config_engine}}`
sudo cp {{config_engine}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHL_NAME
sudo chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHL_NAME
sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHL_NAME

# Install Python client for Redis
sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis

# Install SONiC Utilities (and its dependencies via 'apt-get -y install -f')
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \
Expand Down
1 change: 0 additions & 1 deletion platform/broadcom/docker-orchagent-brcm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM)

$(DOCKER_ORCHAGENT_BRCM)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --volumes-from database
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
Expand Down
1 change: 0 additions & 1 deletion platform/broadcom/docker-syncd-brcm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ $(DOCKER_SYNCD_BRCM)_CONTAINER_NAME = syncd
$(DOCKER_SYNCD_BRCM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd
$(DOCKER_SYNCD_BRCM)_RUN_OPT += --volumes-from database
$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

$(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd
Expand Down
1 change: 0 additions & 1 deletion platform/cavium/docker-orchagent-cavm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM)

$(DOCKER_ORCHAGENT_CAVM)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --volumes-from database
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
Expand Down
1 change: 0 additions & 1 deletion platform/cavium/docker-syncd-cavm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM)
$(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd
$(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SYNCD_CAVM)_RUN_OPT += --volumes-from database
$(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1 change: 0 additions & 1 deletion platform/centec/docker-orchagent-centec.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC)

$(DOCKER_ORCHAGENT_CENTEC)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --volumes-from database
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
Expand Down
1 change: 0 additions & 1 deletion platform/centec/docker-syncd-centec.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ $(DOCKER_SYNCD_CENTEC)_CONTAINER_NAME = syncd
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --volumes-from database
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1 change: 0 additions & 1 deletion platform/mellanox/docker-orchagent-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX)

$(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --volumes-from database
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
Expand Down
1 change: 0 additions & 1 deletion platform/mellanox/docker-syncd-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
$(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd
$(DOCKER_SYNCD_MLNX)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SYNCD_MLNX)_RUN_OPT += --volumes-from database
$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
2 changes: 0 additions & 2 deletions rules/docker-database.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE)

$(DOCKER_DATABASE)_CONTAINER_NAME = database
$(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t
$(DOCKER_DATABASE)_RUN_OPT += -v /var/run/redis

$(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli

2 changes: 0 additions & 2 deletions rules/docker-fpm-gobgp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP)

$(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp
$(DOCKER_FPM_GOBGP)_RUN_OPT += --net=host --privileged -t
$(DOCKER_FPM_GOBGP)_RUN_OPT += --volumes-from database
$(DOCKER_FPM_GOBGP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

1 change: 0 additions & 1 deletion rules/docker-fpm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM)

$(DOCKER_FPM)_CONTAINER_NAME = bgp
$(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_FPM)_RUN_OPT += --volumes-from database
$(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

$(DOCKER_FPM)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh
1 change: 0 additions & 1 deletion rules/docker-lldp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)
$(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp
$(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t
$(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_LLDP_SV2)_RUN_OPT += --volumes-from database

$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl
1 change: 0 additions & 1 deletion rules/docker-snmp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
$(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp
$(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_SNMP_SV2)_RUN_OPT += --volumes-from database
2 changes: 0 additions & 2 deletions rules/docker-teamd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD)
$(DOCKER_TEAMD)_CONTAINER_NAME = teamd
$(DOCKER_TEAMD)_RUN_OPT += --net=host --privileged -t
$(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_TEAMD)_RUN_OPT += --volumes-from database

$(DOCKER_TEAMD)_BASE_IMAGE_FILES += teamdctl:/usr/bin/teamdctl