From 74a7d2d7515d48178d92e221439747c60d758d35 Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Tue, 24 Jan 2023 04:35:55 +0800 Subject: [PATCH] [chassis] Fixed critical process not correct for database-chassis docker (#13445) (#13486) --- dockers/docker-database/Dockerfile.j2 | 2 +- dockers/docker-database/critical_processes | 1 - dockers/docker-database/critical_processes.j2 | 5 +++++ dockers/docker-database/docker-database-init.sh | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 dockers/docker-database/critical_processes create mode 100644 dockers/docker-database/critical_processes.j2 diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 899c111da4..ebd430be91 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -37,12 +37,12 @@ RUN apt-get clean -y && \ ' /etc/redis/redis.conf COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"] +COPY ["critical_processes.j2", "/usr/share/sonic/templates/"] COPY ["docker-database-init.sh", "/usr/local/bin/"] COPY ["database_config.json.j2", "/usr/share/sonic/templates/"] COPY ["database_global.json.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["files/sysctl-net.conf", "/etc/sysctl.d/"] -COPY ["critical_processes", "/etc/supervisor"] COPY ["files/update_chassisdb_config", "/usr/local/bin/"] COPY ["flush_unused_database", "/usr/local/bin/"] diff --git a/dockers/docker-database/critical_processes b/dockers/docker-database/critical_processes deleted file mode 100644 index 53a45931df..0000000000 --- a/dockers/docker-database/critical_processes +++ /dev/null @@ -1 +0,0 @@ -program:redis diff --git a/dockers/docker-database/critical_processes.j2 b/dockers/docker-database/critical_processes.j2 new file mode 100644 index 0000000000..1f524132e9 --- /dev/null +++ b/dockers/docker-database/critical_processes.j2 @@ -0,0 +1,5 @@ +{% if INSTANCES %} +{% for redis_inst, redis_items in INSTANCES.items() %} +program:{{ redis_inst }} +{%- endfor %} +{%- endif %} diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index 413bbc0b20..263d50cef6 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -52,6 +52,7 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then update_chassisdb_config -j $db_cfg_file_tmp -k -p $chassis_db_port # generate all redis server supervisord configuration file sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf + sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes rm $db_cfg_file_tmp exec /usr/local/bin/supervisord exit 0 @@ -69,6 +70,7 @@ fi # delete chassisdb config to generate supervisord config update_chassisdb_config -j $db_cfg_file_tmp -d sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf +sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes if [[ "$start_chassis_db" != "1" ]] && [[ -z "$chassis_db_address" ]]; then cp $db_cfg_file_tmp $db_cfg_file