-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
29 lines (25 loc) · 853 Bytes
/
start.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
#!/bin/bash
# some of the env needed
APP_NAME="${APP_NAME:-searchtool}"
APP_DIR=/piyusg/code/searchtool
STATIC_DIR=${APP_DIR}/static
MEDIA_DIR=${APP_DIR}/media
mkdir -p /piyusg/code /piyusg/service/logs
# run the db sync if need it will create tables
cd ${APP_DIR}
python3 manage.py migrate
if [[ "${CELERY_JOB}" ]]; then
echo "Starting up the celery job..."
cd ${APP_DIR}
celery -A searchtool worker -l info
else
echo "Configuring the weservice to run with uwsgi+nginx..."
cp ${APP_DIR}/conf/searchtool.conf /etc/nginx/conf.d/searchtool.conf
sed -i '1i daemon off;' /etc/nginx/nginx.conf
uwsgi --ini ${APP_DIR}/conf/uwsgi.ini &
# forward nginx request and error logs to docker log collector
ln -sf /dev/stdout /var/log/nginx/access.log
ln -sf /dev/stderr /var/log/nginx/error.log
exec nginx
fi
# EOF