Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow access from remote hosts #386

Merged
merged 1 commit into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ endif
($(SA) $(ENV) && GATEWAY_HOST=$(ITEST_HOST) KERNEL_USERNAME=$(ITEST_USER) nosetests -v enterprise_gateway.itests)
@echo "Run \`docker logs itest\` to see enterprise-gateway log."

PREP_TIMEOUT?=60
docker-prep:
@-docker rm -f itest >> /dev/null
@echo "Starting enterprise-gateway container (run \`docker logs itest\` to see container log)..."
@-docker run -itd -p 8888:8888 -h itest --name itest -v `pwd`/enterprise_gateway/itests:/tmp/byok elyra/enterprise-gateway:$(ENTERPRISE_GATEWAY_TAG) --elyra
@(r="1"; attempts=0; while [ "$$r" == "1" -a $$attempts -lt 30 ]; do echo "Waiting for enterprise-gateway to start..."; sleep 2; ((attempts++)); docker logs itest |grep 'Jupyter Enterprise Gateway at http'; r=$$?; done; if [ $$attempts -ge 30 ]; then echo "Wait for startup timed out!"; exit 1; fi;)
@(r="1"; attempts=0; while [ "$$r" == "1" -a $$attempts -lt $(PREP_TIMEOUT) ]; do echo "Waiting for enterprise-gateway to start..."; sleep 2; ((attempts++)); docker logs itest |grep 'Jupyter Enterprise Gateway at http'; r=$$?; done; if [ $$attempts -ge $(PREP_TIMEOUT) ]; then echo "Wait for startup timed out!"; exit 1; fi;)
9 changes: 9 additions & 0 deletions enterprise_gateway/enterprisegatewayapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,21 @@ def init_configurables(self):

self.personality.init_configurables()

def init_webapp(self):
super(EnterpriseGatewayApp, self).init_webapp()

# As of Notebook 5.6, remote kernels are prevented: https://github.com/jupyter/notebook/pull/3714/ unless
# 'allow_remote_access' is enabled. Since this is the entire purpose of EG, we'll unconditionally set that
# here. Because this is a dictionary, we shouldn't have to worry about older versions as this will be ignored.
self.web_app.settings['allow_remote_access'] = True

def start(self):
"""Starts an IO loop for the application. """

# Note that we *intentionally* reference the KernelGatewayApp so that we bypass
# its start() logic and just call that of JKG's superclass.
super(KernelGatewayApp, self).start()

self.log.info('Jupyter Enterprise Gateway at http{}://{}:{}'.format(
's' if self.keyfile else '', self.ip, self.port
))
Expand Down
1 change: 1 addition & 0 deletions etc/docker/enterprise-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM elyra/yarn-spark:2.1.0
# Install Enterprise Gateway wheel and kernelspecs
COPY jupyter_enterprise_gateway*.whl /tmp
RUN pip install /tmp/jupyter_enterprise_gateway*.whl && \
pip install --upgrade ipykernel jupyter-client notebook && \
rm -f /tmp/jupyter_enterprise_gateway*.whl

ADD jupyter_enterprise_gateway*.tar.gz /usr/local/share/jupyter/kernels/
Expand Down