diff --git a/InvenTree/InvenTree/management/commands/wait_for_db.py b/InvenTree/InvenTree/management/commands/wait_for_db.py index 5d152d26ca..9019a168ef 100644 --- a/InvenTree/InvenTree/management/commands/wait_for_db.py +++ b/InvenTree/InvenTree/management/commands/wait_for_db.py @@ -27,5 +27,5 @@ class Command(BaseCommand): # prints success messge in green self.stdout.write(self.style.SUCCESS('InvenTree database connected')) except OperationalError: - self.stdout.write("Database unavailable, waiting 5 seconds ...") + self.stdout.write(self.style.ERROR("Database unavailable, waiting 5 seconds ...")) time.sleep(5) diff --git a/docker/Dockerfile b/docker/Dockerfile index 99131700ee..3eb62af93b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -79,7 +79,7 @@ RUN apk add --no-cache supervisor RUN mkdir ${INVENTREE_HOME}/media ${INVENTREE_HOME}/static ${INVENTREE_HOME}/backup # Copy supervisor file -COPY docker/supervisor.conf /etc/supervisord.conf +COPY docker/supervisord.conf ${INVENTREE_HOME}/supervisord.conf # Copy gunicorn config file COPY docker/gunicorn.conf.py ${INVENTREE_HOME}/gunicorn.conf.py diff --git a/docker/start.sh b/docker/start.sh index 3e1287527b..21334d812a 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -15,6 +15,8 @@ fi # Activate virtual environment source $INVENTREE_VENV/bin/activate +sleep 5 + # Wait for the database to be ready cd $INVENTREE_MNG_DIR python manage.py wait_for_db @@ -32,4 +34,4 @@ python manage.py collectstatic --noinput || exit 1 python manage.py clearsessions || exit 1 # Now we can launch the server and background worker -/usr/bin/supervisord -c /etc/supervisord.conf +/usr/bin/supervisord -c $INVENTREE_HOME/supervisord.conf diff --git a/docker/supervisor.conf b/docker/supervisord.conf similarity index 88% rename from docker/supervisor.conf rename to docker/supervisord.conf index 554200837d..e0eaad4cfb 100644 --- a/docker/supervisor.conf +++ b/docker/supervisord.conf @@ -13,6 +13,7 @@ ; InvenTree uses django-q for this purpose [supervisord] +user=inventree nodaemon=true [program:inventree-server] @@ -31,7 +32,7 @@ stderr_logfile_maxbytes=0 [program:inventree-cluster] user=inventree directory=%(ENV_INVENTREE_SRC_DIR)s/InvenTree -command=%(ENV_INVENTREE_VENV)s/bin/python manage.py qcluster +command=%(ENV_INVENTREE_VENV)s/bin/python DJANGO_SETTINGS_FILE=InvenTree.settings manage.py qcluster startsecs=10 autostart=true autorestart=true