2022-03-14 05:09:20 -05:00
|
|
|
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
|
2022-01-11 11:23:42 -06:00
|
|
|
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
|
2022-07-21 16:15:16 -05:00
|
|
|
{% if CONFIGURED_ARCH == "armhf" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
|
2022-03-14 05:09:20 -05:00
|
|
|
FROM {{ prefix }}multiarch/debian-debootstrap:armhf-bullseye
|
2022-07-21 16:15:16 -05:00
|
|
|
{% elif CONFIGURED_ARCH == "arm64" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
|
2022-03-14 05:09:20 -05:00
|
|
|
FROM {{ prefix }}multiarch/debian-debootstrap:arm64-bullseye
|
2022-01-11 11:23:42 -06:00
|
|
|
{% else %}
|
2022-03-14 05:09:20 -05:00
|
|
|
FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:bullseye
|
2022-01-11 11:23:42 -06:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
# Clean documentation in FROM image
|
|
|
|
RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true
|
|
|
|
|
|
|
|
# Clean doc directories that are empty or only contain empty directories
|
|
|
|
RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done && \
|
|
|
|
rm -rf \
|
|
|
|
/usr/share/man/* \
|
|
|
|
/usr/share/groff/* \
|
|
|
|
/usr/share/info/* \
|
|
|
|
/usr/share/lintian/* \
|
|
|
|
/usr/share/linda/* \
|
|
|
|
/var/cache/man/* \
|
|
|
|
/usr/share/locale/*
|
|
|
|
|
|
|
|
# Make apt-get non-interactive
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
# Configure data sources for apt/dpkg
|
|
|
|
COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
|
2022-11-08 18:09:53 -06:00
|
|
|
COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
|
2022-01-11 11:23:42 -06:00
|
|
|
COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"]
|
|
|
|
COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"]
|
2022-11-20 18:05:16 -06:00
|
|
|
COPY ["apt-multiple-retries", "/etc/apt/apt.conf.d"]
|
2022-01-11 11:23:42 -06:00
|
|
|
|
|
|
|
# Update apt cache and
|
|
|
|
# pre-install fundamental packages
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get -y install \
|
|
|
|
curl \
|
|
|
|
less \
|
|
|
|
perl \
|
|
|
|
procps \
|
|
|
|
python3 \
|
|
|
|
python3-distutils \
|
|
|
|
python3-pip \
|
2022-08-31 19:13:24 -05:00
|
|
|
python-is-python3 \
|
2022-01-11 11:23:42 -06:00
|
|
|
vim-tiny \
|
|
|
|
# Install redis-tools
|
|
|
|
redis-tools \
|
|
|
|
# common dependencies
|
|
|
|
libdaemon0 \
|
|
|
|
libdbus-1-3 \
|
|
|
|
libjansson4 \
|
|
|
|
# ip and ifconfig utility missing in docker for arm arch
|
|
|
|
iproute2 \
|
|
|
|
net-tools \
|
|
|
|
# for processing/handling json files in bash environment
|
|
|
|
jq \
|
|
|
|
# for sairedis zmq rpc channel
|
2022-05-05 18:21:30 -05:00
|
|
|
libzmq5 \
|
|
|
|
libwrap0
|
2022-01-11 11:23:42 -06:00
|
|
|
|
2022-08-04 17:10:34 -05:00
|
|
|
# default rsyslog version is 8.2110.0 which has a bug on log rate limit,
|
|
|
|
# use backport version 8.2206.0-1~bpo11+1
|
|
|
|
RUN apt-get -t bullseye-backports -y install rsyslog
|
|
|
|
|
2022-01-11 11:23:42 -06:00
|
|
|
# Upgrade pip via PyPI and uninstall the Debian version
|
|
|
|
RUN pip3 install --upgrade pip
|
|
|
|
RUN apt-get purge -y python3-pip
|
|
|
|
|
|
|
|
# setuptools and wheel are necessary for installing some Python wheel packages
|
|
|
|
RUN pip3 install --no-cache-dir setuptools==49.6.00
|
|
|
|
RUN pip3 install --no-cache-dir wheel==0.35.1
|
|
|
|
|
|
|
|
# For templating
|
|
|
|
RUN pip3 install j2cli
|
|
|
|
|
|
|
|
# Install supervisor
|
|
|
|
RUN pip3 install supervisor==4.2.1
|
|
|
|
|
|
|
|
# Add support for supervisord to handle startup dependencies
|
|
|
|
RUN pip3 install supervisord-dependent-startup==1.4.0
|
|
|
|
|
2022-12-08 10:58:35 -06:00
|
|
|
RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
|
2022-01-11 11:23:42 -06:00
|
|
|
|
[VOQ][saidump] Install rdbtools into the docker base related containers. (#16466)
Fix #13561
The existing saidump use https://github.com/sonic-net/sonic-swss-common/blob/master/common/table_dump.lua script which loops the ASIC_DB more than 5 seconds and blocks other processes access.
This solution uses the Redis SAVE command to save the snapshot of DB each time and recover later, instead of looping through each entry in the table.
Related PRs:
sonic-net/sonic-utilities#2972
sonic-net/sonic-sairedis#1288
sonic-net/sonic-sairedis#1298
How did I do it?
To use the Redis-db SAVE option to save the snapshot of DB each time and recover later, instead of looping through each entry in the table and saving it.
1. Updated dockers/docker-base-bullseye/Dockerfile.j2, install Python library rdbtools into the all the docker-base-bullseye containers.
2. Updated sonic-buildimage/src/sonic-sairedis/saidump/saidump.cpp, add a new option -r, which updates the rdbtools's output-JSON files' format.
3. To add a new script file: syncd/scripts/saidump.sh into the sairedis repo. This shell script does the following steps:
For each ASIC, such as ASIC0,
3.1. Config Redis consistency directory.
redis-cli -h $hostname -p $port CONFIG SET dir $redis_dir > /dev/null
3.2. Save the Redis data.
redis-cli -h $hostname -p $port SAVE > /dev/null
3.3. Run rdb command to convert the dump files into JSON files
rdb --command json $redis_dir/dump.rdb | tee $redis_dir/dump.json > /dev/null
3.4. Run saidump -r to update the JSON files' format as same as the saidump before.
Then we can get the saidump's result in standard output."
saidump -r $redis_dir/dump.json -m 100
3.5. Clear the temporary files.
rm -f $redis_dir/dump.rdb
rm -f $redis_dir/dump.json
4. Update sonic-buildimage/src/sonic-utilities/scripts/generate_dump. To check the asic db size and if it is larger than ROUTE_TAB_LIMIT_DIRECT_ITERATION (with default value 24000) entries, then do with REDIS SAVE, otherwise, to do with old method: looping through each entry of Redis DB.
How to verify it
On T2 setup with more than 96K routes, execute CLI command -- generate_dump
No error should be shown
Download the generate_dump result and verify the saidump file after unpacking it.
2023-11-08 13:57:25 -06:00
|
|
|
# Install gcc, libc6-dev and python3-dev for compiling python-lzf
|
|
|
|
RUN apt-get -y install build-essential libc6-dev python3-dev
|
|
|
|
|
|
|
|
# Install python-lzf
|
|
|
|
RUN pip3 install 'python-lzf==0.2.4'
|
|
|
|
|
|
|
|
# Install rdbtools
|
|
|
|
RUN pip3 install 'rdbtools==0.1.15'
|
|
|
|
|
|
|
|
# Uninstall gcc, libc6-dev and python3-dev for compiling python-lzf
|
|
|
|
RUN apt-get -y purge build-essential libc6-dev python3-dev
|
|
|
|
|
|
|
|
# Uninstall unused dependencies
|
|
|
|
RUN apt autoremove -y --purge
|
|
|
|
|
2022-01-11 11:23:42 -06:00
|
|
|
RUN apt-get -y purge \
|
|
|
|
exim4 \
|
|
|
|
exim4-base \
|
|
|
|
exim4-config \
|
|
|
|
exim4-daemon-light
|
|
|
|
|
|
|
|
{% if docker_base_bullseye_debs.strip() -%}
|
|
|
|
# Copy locally-built Debian package dependencies
|
|
|
|
{{ copy_files("debs/", docker_base_bullseye_debs.split(' '), "/debs/") }}
|
|
|
|
|
|
|
|
# Install built Debian packages and implicitly install their dependencies
|
|
|
|
{{ install_debian_packages(docker_base_bullseye_debs.split(' ')) }}
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
# Clean up apt
|
|
|
|
# Remove /var/lib/apt/lists/*, could be obsoleted for derived images
|
|
|
|
RUN apt-get clean -y && \
|
|
|
|
apt-get autoclean -y && \
|
|
|
|
apt-get autoremove -y && \
|
2022-03-15 20:12:49 -05:00
|
|
|
rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache
|
2022-01-11 11:23:42 -06:00
|
|
|
|
2023-12-20 01:12:03 -06:00
|
|
|
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
|
2022-01-11 11:23:42 -06:00
|
|
|
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
|
|
|
|
COPY ["root/.vimrc", "/root/.vimrc"]
|
|
|
|
|
|
|
|
RUN ln /usr/bin/vim.tiny /usr/bin/vim
|
|
|
|
|
|
|
|
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
|