mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-07-28 16:32:37 -04:00
34 lines
1019 B
Bash
Executable File
34 lines
1019 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# set ping interval
|
|
if [ -z "$PING_INTERVAL" ]; then
|
|
PING_INTERVAL=5
|
|
elif [ "$PING_INTERVAL" -lt 5 ]; then
|
|
echo ""
|
|
echo "Ping interval lower than 5 seconds is not recommended. Please use an interval of 5 seconds or higher. Automatically set to 5 seconds."
|
|
echo ""
|
|
PING_INTERVAL=5
|
|
fi
|
|
|
|
# create django secret key
|
|
cd /app/backend/ || exit
|
|
if [ -z "$DJANGO_SECRET_KEY" ]; then
|
|
DJANGO_SECRET_KEY=$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')
|
|
export DJANGO_SECRET_KEY
|
|
fi
|
|
|
|
# init django
|
|
python3 manage.py makemigrations
|
|
python3 manage.py migrate
|
|
python3 manage.py collectstatic --noinput
|
|
python3 manage.py shell < setup.py
|
|
python3 -m celery -A backend worker &
|
|
python3 -m celery -A backend beat &
|
|
python3 -m gunicorn --bind 0.0.0.0:"${BACKEND_PORT}" --workers 4 backend.asgi:application -k uvicorn.workers.UvicornWorker &
|
|
|
|
# start frontend
|
|
cd /app/frontend/ || exit
|
|
npm install
|
|
npm run build
|
|
PORT=$FRONTEND_PORT npm start
|