7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-05-29 12:20:49 +00:00

Improve wait for mysql db to be ready

This commit is contained in:
Régis Behmo 2018-09-16 13:24:17 +02:00
parent fd5af3e01c
commit 30bc6df091
3 changed files with 10 additions and 2 deletions

View File

@ -44,7 +44,7 @@ update:
migrate: provision-database migrate-openedx migrate-forum $(extra_migrate_targets) provision-oauth2
provision-database:
$(DOCKER_COMPOSE_RUN) lms bash -c "dockerize -wait tcp://mysql:3306 -timeout 20s && bash /openedx/config/provision.sh"
$(DOCKER_COMPOSE_RUN) lms /openedx/config/provision.sh
provision-oauth2:
$(DOCKER_COMPOSE_RUN) lms /openedx/config/oauth2.sh

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -e
{% if ACTIVATE_NOTES %}
./manage.py lms manage_user notes notes@{{ LMS_HOST }} --staff --superuser

View File

@ -1,3 +1,11 @@
#!/bin/bash -e
dockerize -wait tcp://mysql:3306 -timeout 20s
while ! mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e="\r"; do
echo "Waiting for mysql database to be ready..."
sleep 1
done
mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e 'CREATE DATABASE IF NOT EXISTS {{ MYSQL_DATABASE }};'
mysql -u root --password="{{ MYSQL_PASSWORD }}" --host "mysql" -e 'GRANT ALL ON {{ MYSQL_DATABASE }}.* TO "{{ MYSQL_USERNAME }}"@"%" IDENTIFIED BY "{{ MYSQL_PASSWORD }}";'