at my dockerized Django application I have the following bash function at my docker-entrypoint.sh. This basically only checks if the database is available:
function check_mariadb {
while ! mysqladmin --user=$MYSQL_USER --password=$MYSQL_PASSWORD --host $MYSQL_HOST ping --silent &> /dev/null; do
echo "Waiting for MariaDB service to become available"
sleep 3
done
echo "MariaDB is up and available"
}
As my application can start in 3 modes (as application, Celery_worker or Celery_beat) I somehow have to make sure that all migration are done before celery starts. Otherwise I'm running into issues that celery is missing one of these tables:
django_celery_results_chordcounter
django_celery_results_groupresult
django_celery_results_taskresult
Can somebody give me a hint what might be the best practices to check for open migration in this context? And only let celery start if all migrations are done?!... Would be awesome if this could also be handled in a simple bash function like the one above.
Would be awesome If I could do more than just:
python manage.py showmigrations | grep '\[ \]'
Thanks in advance.