2019-05-17 00:56:02 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Make non-zero exit codes & other errors fatal.
|
|
|
|
set -euo pipefail
|
|
|
|
|
2020-03-31 23:16:56 +03:00
|
|
|
export DATABASE_URL=${DATABASE_URL:-mysql://root@127.0.0.1:3306/treeherder}
|
2020-03-23 21:12:42 +03:00
|
|
|
# Only execute if we're using the Mysql container
|
2020-03-31 23:16:56 +03:00
|
|
|
if [ "${DATABASE_URL}" == "mysql://root@mysql/treeherder" ] ||
|
|
|
|
[ "${DATABASE_URL}" == "mysql://root@127.0.0.1:3306/treeherder" ]; then
|
2020-03-23 21:12:42 +03:00
|
|
|
# Initialize migrations and SETA
|
|
|
|
echo '-----> Running Django migrations and loading reference data'
|
|
|
|
./manage.py migrate --noinput
|
|
|
|
./manage.py load_initial_data
|
|
|
|
echo '-----> Initialize SETA'
|
|
|
|
./manage.py initialize_seta
|
|
|
|
fi
|
2019-05-17 00:56:02 +03:00
|
|
|
|
|
|
|
exec "$@"
|