[database-chassis]: Fix the way database-chassis start (#6099)

The service crash when the platform boots due to missing waits.
/usr/bin/database.sh tries to operate on a missing socket and fails.
We now wait for the chassis database to be ready the same way we do database.
This commit is contained in:
Samuel Angebault 2020-12-04 10:09:35 -08:00 committed by GitHub
parent 2895b79482
commit 8576911a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -50,8 +50,6 @@ 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..."
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
mkdir -p /var/run/redis/sonic-db
cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db
# generate all redis server supervisord configuration file # 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/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
rm $db_cfg_file_tmp rm $db_cfg_file_tmp

View File

@ -144,6 +144,10 @@ function postStartAction()
# Add redis UDS to the redis group and give read/write access to the group # Add redis UDS to the redis group and give read/write access to the group
REDIS_SOCK="/var/run/redis${DEV}/redis.sock" REDIS_SOCK="/var/run/redis${DEV}/redis.sock"
else else
until [[ ($(docker exec -i ${DOCKERNAME} pgrep -x -c supervisord) -gt 0) &&
($(docker exec -i ${DOCKERNAME} $SONIC_DB_CLI CHASSIS_APP_DB PING | grep -c True) -gt 0) ]]; do
sleep 1
done
REDIS_SOCK="/var/run/redis-chassis/redis_chassis.sock" REDIS_SOCK="/var/run/redis-chassis/redis_chassis.sock"
fi fi
chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK