add redis container in start.sh in case it is not running in dev mode
This commit is contained in:
parent
ff57117054
commit
62329a2eb4
1 changed files with 8 additions and 2 deletions
|
|
@ -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=$!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue