Enhance Docker (#6504)

Refactored deprecated functionalities:
  - Used 'celery worker' command instead of 'superset worker' which is
    deprecated since 0.26.0
  - Used 'gunicorn' command instead of 'superset runserver'
This commit is contained in:
oliviermichaelis 2019-01-03 20:33:31 +01:00 committed by Maxime Beauchemin
parent 142e7b6df7
commit c01230afb7
2 changed files with 12 additions and 4 deletions

View File

@ -7,6 +7,7 @@ services:
- 6379:6379
volumes:
- redis:/data
postgres:
image: postgres:10
restart: unless-stopped
@ -18,6 +19,7 @@ services:
- 5432:5432
volumes:
- postgres:/var/lib/postgresql/data
superset:
build:
context: ../../
@ -44,6 +46,7 @@ services:
- ./superset_config.py:/home/superset/superset/superset_config.py
# this is needed for development, remove with SUPERSET_ENV=production
- ../../superset:/home/superset/superset
volumes:
postgres:
external: false

View File

@ -4,14 +4,19 @@ set -ex
if [ "$#" -ne 0 ]; then
exec "$@"
elif [ "$SUPERSET_ENV" = "development" ]; then
superset worker &
celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair &
# needed by superset runserver
(cd superset/assets/ && npm ci && npm run sync-backend)
(cd superset/assets/ && npm run dev) &
flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0
FLASK_APP=superset:app flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0
elif [ "$SUPERSET_ENV" = "production" ]; then
superset worker &
superset runserver -a 0.0.0.0 -w $((2 * $(getconf _NPROCESSORS_ONLN) + 1))
celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair &
gunicorn --bind 0.0.0.0:8088 \
--workers $((2 * $(getconf _NPROCESSORS_ONLN) + 1)) \
--timeout 60 \
--limit-request-line 0 \
--limit-request-field_size 0 \
superset:app
else
superset --help
fi