[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 <marty.lok@nokia.com>
This commit is contained in:
Marty Y. Lok 2024-03-22 17:20:12 -04:00 committed by GitHub
parent d4300fc34f
commit 2e81eff2e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,12 +61,16 @@ cp $db_cfg_file $db_cfg_file_tmp
if [[ $DATABASE_TYPE == "chassisdb" ]]; then if [[ $DATABASE_TYPE == "chassisdb" ]]; then
# Docker init for database-chassis # Docker init for database-chassis
echo "Init docker-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 update_chassisdb_config -j $db_cfg_file_tmp -k -p $chassis_db_port
# generate all redis server supervisord configuration file # generate all redis server supervisord configuration file
sonic-cfggen -j $db_cfg_file_tmp \ 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/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf \
-t /usr/share/sonic/templates/critical_processes.j2,/etc/supervisor/critical_processes -t /usr/share/sonic/templates/critical_processes.j2,/etc/supervisor/critical_processes
rm $db_cfg_file_tmp 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 exec /usr/local/bin/supervisord
exit 0 exit 0
fi fi