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

Wait more smartly for mysql DB to be ready

We replace the custom script wait-for-greenlight by dockerize: it is a
generic tool that allows for different services to be up. Also, on day,
it will allow us to generate config files dynamically (maybe).
This commit is contained in:
Régis Behmo 2018-06-08 18:31:26 -04:00
parent 7a179c079c
commit 85e7e45067
3 changed files with 9 additions and 14 deletions

View File

@ -22,11 +22,11 @@ update:
docker-compose pull
provision:
$(DOCKER_COMPOSE_RUN) lms bash /openedx/config/provision.sh
$(DOCKER_COMPOSE_RUN) lms bash -c "dockerize -wait tcp://mysql:3306 && bash /openedx/config/provision.sh"
migrate-openedx:
$(DOCKER_COMPOSE_RUN_OPENEDX) lms bash -c "wait-for-greenlight.sh && ./manage.py lms migrate"
$(DOCKER_COMPOSE_RUN_OPENEDX) cms bash -c "wait-for-greenlight.sh && ./manage.py cms migrate"
$(DOCKER_COMPOSE_RUN_OPENEDX) lms bash -c "dockerize -wait tcp://mysql:3306 && ./manage.py lms migrate"
$(DOCKER_COMPOSE_RUN_OPENEDX) cms bash -c "dockerize -wait tcp://mysql:3306 && ./manage.py cms migrate"
migrate-forum:
$(DOCKER_COMPOSE_RUN) forum bash -c "bundle exec rake search:initialize && \

View File

@ -49,8 +49,13 @@ RUN ln -s /openedx/config/lms.env.json /openedx/ \
&& ln -s /openedx/config/lms.auth.json /openedx/ \
&& ln -s /openedx/config/cms.auth.json /openedx/
# Dockerize will be useful to wait for mysql DB availability
ENV DOCKERIZE_VERSION v0.6.1
RUN curl -L -o dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize.tar.gz \
&& rm dockerize.tar.gz
# Copy convenient scripts
COPY ./bin/wait-for-greenlight.sh /usr/local/bin/
COPY ./bin/docker-entrypoint.sh /usr/local/bin/
# service variant is "lms" or "cms"

View File

@ -1,10 +0,0 @@
#!/bin/bash
echo "Checking system..."
until ./manage.py $SERVICE_VARIANT check
do
printf "."
sleep 1
done
echo -e "\nSystem is ready \\o/"