From 2e81eff2e8a878d48fb53183808e4a1260336f12 Mon Sep 17 00:00:00 2001 From: "Marty Y. Lok" <76118573+mlok-nokia@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:20:12 -0400 Subject: [PATCH] [Supervisor][datbase-chassis] Fixthe failure of starting redis_chassis in database-chassis on Supervisor (#18242) Why I did it redis_chassis process fails to start in the database-chassis on the supervisor card. How I did it The redis and redis_chassis processes in supervisor.conf has been modified to start with 'redis' as user. The modification only added redis and redis group for database containers except database-chassis container. This commit adds code to the docker-database-init.sh to add redis and redis group for the database-chassis to address this issue. How to verify it Booting the image on Supervisor. And verify the database-chassis container should be in UP state, and the database-chassis.service is in active(running) state admin@ixre-cpm-chassis15:~$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9691c6111e0f docker-fpm-frr:latest "/usr/bin/docker_ini?" 16 hours ago Up 16 hours bgp5 ... c7c7159d4e0c docker-database:latest "/usr/local/bin/dock?" 31 hours ago Up 16 hours database-chassis admin@ixre-cpm-chassis15:~$ sudo systemctl status database-chassis ? database-chassis.service - database-chassis container Loaded: loaded (/lib/systemd/system/database-chassis.service; enabled-runtime; preset: enabled) Active: active (running) since Sun 2024-03-03 04:43:12 UTC; 16h ago Process: 1640 ExecStartPre=/usr/bin/database.sh start chassisdb (code=exited, status=0/SUCCESS) Main PID: 1938 (database.sh) Tasks: 10 (limit: 38307) Memory: 49.7M CGroup: /system.slice/database-chassis.service ??1938 /bin/bash /usr/bin/database.sh wait chassisdb ??1940 docker wait database-chassis Notice: journal has been rotated since unit was started, output may be incomplete. admin@ixre-cpm-chassis15:~$ Signed-off-by: mlok --- dockers/docker-database/docker-database-init.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index f6f8522bb9..f3679e08ae 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -61,12 +61,16 @@ cp $db_cfg_file $db_cfg_file_tmp if [[ $DATABASE_TYPE == "chassisdb" ]]; then # Docker init for database-chassis echo "Init docker-database-chassis..." + VAR_LIB_REDIS_CHASSIS_DIR="/var/lib/redis_chassis" + mkdir -p $VAR_LIB_REDIS_CHASSIS_DIR 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 \ -t /usr/share/sonic/templates/critical_processes.j2,/etc/supervisor/critical_processes rm $db_cfg_file_tmp + chown -R redis:redis $VAR_LIB_REDIS_CHASSIS_DIR + chown -R redis:redis $REDIS_DIR exec /usr/local/bin/supervisord exit 0 fi