InvenTree/docker/start.sh

38 lines
972 B
Bash
Raw Normal View History

2021-04-01 13:40:47 +00:00
#!/bin/sh
# Check that the database engine is specified
if [ -z "$INVENTREE_DB_ENGINE" ]; then
echo "INVENTREE_DB_ENGINE not configured"
exit 1
fi
# Check that the base dir is set
if [ -z "$INVENTREE_HOME" ]; then
echo "INVENTREE_HOME not configured"
exit 1
fi
# Activate virtual environment
source $INVENTREE_VENV/bin/activate
2021-04-07 12:27:55 +00:00
sleep 5
2021-04-01 13:40:47 +00:00
# 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
2021-04-07 12:27:55 +00:00
/usr/bin/supervisord -c $INVENTREE_HOME/supervisord.conf