2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00
InvenTree/docker/start.sh

33 lines
885 B
Bash

#!/bin/sh
echo "Starting InvenTree server..."
# Check that the database engine is specified
if [ -z "$INVENTREE_DB_ENGINE" ]; then
echo "INVENTREE_DB_ENGINE not configured"
exit 1
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
sleep 10
echo "Running InvenTree database migrations and collecting static files..."
# We assume at this stage that the database is up and running
# Ensure that the database schema are up to date
python manage.py check || exit 1
python manage.py migrate --noinput || exit 1
python manage.py migrate --run-syncdb || exit 1
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 $INVENTREE_HOME/supervisord.conf