From da0b6863698fb03536d2299848c7515cc67a645a Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Tue, 5 Dec 2017 23:46:18 -0500 Subject: [PATCH] Adding jupyter notebook support to the AWX development environment * Jupyter starts alongside the other awx services and is available on 0.0.0.0:8888 * make target: make jupyter * default settings in settings/development.py * Added jupyter, matplotlib, numpy to dev dependencies --- Makefile | 12 ++++++------ awx/settings/development.py | 12 ++++++++++++ requirements/requirements_dev.txt | 2 ++ tools/docker-compose.yml | 1 + tools/docker-compose/Procfile | 1 + tools/docker-compose/supervisor.conf | 8 ++++++++ 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f2beb88570..2d6b276aab 100644 --- a/Makefile +++ b/Makefile @@ -334,18 +334,18 @@ receiver: fi; \ $(PYTHON) manage.py run_callback_receiver -socketservice: - @if [ "$(VENV_BASE)" ]; then \ - . $(VENV_BASE)/awx/bin/activate; \ - fi; \ - $(PYTHON) manage.py run_socketio_service - nginx: nginx -g "daemon off;" rdb: $(PYTHON) tools/rdb.py +jupyter: + @if [ "$(VENV_BASE)" ]; then \ + . $(VENV_BASE)/awx/bin/activate; \ + fi; \ + $(MANAGEMENT_COMMAND) shell_plus --notebook + reports: mkdir -p $@ diff --git a/awx/settings/development.py b/awx/settings/development.py index e7482520e7..bf36a09cac 100644 --- a/awx/settings/development.py +++ b/awx/settings/development.py @@ -19,6 +19,18 @@ from split_settings.tools import optional, include # Load default settings. from defaults import * # NOQA +# awx-manage shell_plus --notebook +NOTEBOOK_ARGUMENTS = [ + '--NotebookApp.token=', + '--ip', '0.0.0.0', + '--port', '8888', + '--allow-root', + '--no-browser', +] + +# print SQL queries in shell_plus +SHELL_PLUS_PRINT_SQL = False + # show colored logs in the dev environment # to disable this, set `COLOR_LOGS = False` in awx/settings/local_settings.py LOGGING['handlers']['console']['()'] = 'awx.main.utils.handlers.ColorHandler' diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index 9cf2c55573..328a4eecd9 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -13,3 +13,5 @@ pytest-mock logutils flower uwsgitop +jupyter +matplotlib diff --git a/tools/docker-compose.yml b/tools/docker-compose.yml index 767bf8f7cb..ef9c4cad79 100644 --- a/tools/docker-compose.yml +++ b/tools/docker-compose.yml @@ -12,6 +12,7 @@ services: CELERY_RDB_HOST: 0.0.0.0 AWX_GROUP_QUEUES: tower ports: + - "8888:8888" - "8080:8080" - "5555:5555" - "8013:8013" diff --git a/tools/docker-compose/Procfile b/tools/docker-compose/Procfile index 83488b891d..bd0b222175 100644 --- a/tools/docker-compose/Procfile +++ b/tools/docker-compose/Procfile @@ -5,3 +5,4 @@ celeryd: make celeryd receiver: make receiver flower: make flower uwsgi: make uwsgi +jupyter: make jupyter \ No newline at end of file diff --git a/tools/docker-compose/supervisor.conf b/tools/docker-compose/supervisor.conf index c37033c7f8..7f72e269c4 100644 --- a/tools/docker-compose/supervisor.conf +++ b/tools/docker-compose/supervisor.conf @@ -59,6 +59,14 @@ redirect_stderr=true stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 +[program:jupyter] +command = make jupyter +autostart = true +autorestart = true +redirect_stderr=true +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 + [group:awx-processes] programs=celeryd,receiver,runworker,uwsgi,daphne,nginx,flower priority=5