-
Notifications
You must be signed in to change notification settings - Fork 101
/
entrypoint.sh
executable file
·36 lines (30 loc) · 1.34 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
export PYTHONUNBUFFERED=TRUE
export PYTHONFAULTHANDLER=1
if [[ "$(uname -m)" == "aarch64"* ]]; then
export OPENBLAS_CORETYPE=ARMV8
echo "ARM architecture detected. OPENBLAS_CORETYPE set to ARMV8"
fi
export OPENBLAS_NUM_THREADS=1
export OPENBLAS_MAIN_FREE=1
mkdir -p /logs
python manage.py showmigrations | tee /logs/show_migrate.log
python manage.py migrate | tee /logs/command_migrate.log
python manage.py showmigrations | tee /logs/show_migrate.log
python manage.py collectstatic --no-input
python manage.py start_service all
python manage.py start_cleaning_service
python manage.py clear_cache
python manage.py build_similarity_index 2>&1 | tee /logs/command_build_similarity_index.log
if [[ -n "$ADMIN_USERNAME" ]]; then
python manage.py createadmin -u "$ADMIN_USERNAME" "$ADMIN_EMAIL" 2>&1 | tee /logs/command_createadmin.log
fi
echo "Running backend server..."
python manage.py qcluster 2>&1 | tee /logs/qcluster.log &
if [[ "$DEBUG" = 1 ]]; then
echo "development backend starting"
gunicorn --worker-class=gevent --max-requests 50 --reload --bind 0.0.0.0:8001 --log-level=info librephotos.wsgi 2>&1 | tee /logs/gunicorn_django.log
else
echo "production backend starting"
gunicorn --worker-class=gevent --max-requests 50 --bind 0.0.0.0:8001 --log-level=info librephotos.wsgi 2>&1 | tee /logs/gunicorn_django.log
fi