Skip to content

Commit

Permalink
Refactor RestAPI startup and add Celery worker support
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackOrder committed Jan 4, 2024
1 parent 9dae416 commit 5646a1a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docker/restapi-docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ set -e
echo 'Cleaning lock files'
rm -f /tmp/*.lock

# RestAPI http Mode
# If RestAPI http Mode, start Guicorn
if [ "$RESTAPI_HTTP_MODE" = 1 ]; then
# If Celery Worker is enabled, start Celery worker
# start restapi
exec gunicorn -b 0.0.0.0:8080 jasmin.protocols.rest:api --access-logfile /var/log/jasmin/rest-api.access.log --disable-redirect-access-to-syslog

# If Celery Worker is enabled, start Celery worker
elif [ "$RESTAPI_WORKER_MODE" = 1 ]; then
echo 'Starting Celery worker'
exec celery -A jasmin.protocols.rest.tasks worker -l INFO -c 4 --autoscale=10,3
else
# start restapi
exec gunicorn -b 0.0.0.0:8080 jasmin.protocols.rest:api --access-logfile /var/log/jasmin/rest-api.access.log --disable-redirect-access-to-syslog
fi
echo 'Starting Celery worker'
exec celery -A jasmin.protocols.rest.tasks worker -l INFO -c 4 --autoscale=10,3

# Else start jasmind
else
if [ "$2" = "--enable-interceptor-client" ]; then
echo 'Starting interceptord'
Expand Down

0 comments on commit 5646a1a

Please sign in to comment.