add redis container in start.sh in case it is not running in dev mode

This commit is contained in:
Viktor Barzin 2025-08-28 20:48:42 +00:00
parent ff57117054
commit 62329a2eb4
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863

View file

@ -6,8 +6,6 @@ set -eux
ENV_MODE=${ENV:-"dev"} # Defaults to "dev" if ENV_MODE is unset
echo "Checking connection to redis is successful..."
python celery_app.py
case "$ENV_MODE" in
dev)
@ -16,12 +14,20 @@ case "$ENV_MODE" in
pkill -f celery
pkill watchmedo
set -e
if ! netstat -tlnp |grep 6379; then
echo "Did not find a running redis on 6379. Starting a new instance..."
docker run -d --rm --name redis-server -p 6379:6379 redis:latest
fi
echo "Checking connection to redis is successful..."
python celery_app.py
watchmedo auto-restart --directory=./ --pattern='*.py' --recursive -- celery -A celery_app worker & # DEV to autoreload on changes
CELERY_PID=$!
;;
prod)
echo "🚀 Running in PRODUCTION mode"
echo "Checking connection to redis is successful..."
python celery_app.py
alembic upgrade head
celery -A celery_app worker --beat &
CELERY_PID=$!