mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-05 15:12:10 +00:00
Fix SQL race condition
When running "wait-for-mysql.sh", the "echo 'show tables' | manage.py dbshell" command is always considered a success, even if the database is unreachable ($? == 0). So we replace this command by a global system check. This closes #3.
This commit is contained in:
parent
1fcae62d2f
commit
6361b9ad58
4
Makefile
4
Makefile
@ -11,8 +11,8 @@ build:
|
||||
docker-compose build
|
||||
|
||||
migrate:
|
||||
docker-compose run --rm lms bash -c "./wait-for-mysql.sh && ./manage.py lms --settings=production migrate"
|
||||
docker-compose run --rm cms bash -c "./wait-for-mysql.sh && ./manage.py cms --settings=production migrate"
|
||||
docker-compose run --rm lms bash -c "./wait-for-greenlight.sh && ./manage.py lms --settings=production migrate"
|
||||
docker-compose run --rm cms bash -c "./wait-for-greenlight.sh && ./manage.py cms --settings=production migrate"
|
||||
|
||||
assets:
|
||||
docker-compose run --rm lms paver update_assets lms --settings=production
|
||||
|
@ -47,7 +47,7 @@ COPY ./config/lms.auth.json /openedx/
|
||||
COPY ./config/cms.auth.json /openedx/
|
||||
|
||||
# Copy convenient script
|
||||
COPY ./wait-for-mysql.sh .
|
||||
COPY ./wait-for-greenlight.sh .
|
||||
|
||||
############ End of code common to lms & cms
|
||||
|
||||
|
10
edxapp/wait-for-greenlight.sh
Executable file
10
edxapp/wait-for-greenlight.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Checking system..."
|
||||
until ./manage.py lms --settings=production check
|
||||
do
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo -e "\nSystem is ready \\o/"
|
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Waiting for mysql database"
|
||||
until echo "show tables;" | ./manage.py lms --settings=production dbshell
|
||||
do
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo -e "\nmysql database ready"
|
Loading…
Reference in New Issue
Block a user