Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.

How to deploy the Django and parambokeh sample on a remote web server #78

Open
danielmesser1 opened this issue Mar 11, 2019 · 2 comments

Comments

@danielmesser1
Copy link

How to run the Sample django + parambokeh apps on a web server other than on a local machine?
The web server is an Apache http server running on an EC2 single instance, listening on port 80.
I tried many different host addresses and ports configurations but I don't really understand how things work.
I believe that the following bk_worker code starts the the bokeh server in the background when a new thread is started:

def bk_worker():

Note: num_procs must be 1; see e.g. flask_gunicorn_embed.py for num_procs>1

server = Server({'/bk_sliders_app': bk_sliders.app},
io_loop=IOLoop(),
address=bk_config.server['address'],
port=bk_config.server['port'],
allow_websocket_origin=["localhost:8000"])
server.start()
server.io_loop.start()

What should be the address and port specified there? It is currently set to localhost and 5006 because I believe that, since Server() is called on the web server, then it should spawn a bokeh server on the same local host, correct? If not, then what should be the address and port (I also tried 0.0.0.0 but it didn't work)?

I believe that the bokeh server has started because I see a thread running under the wsgi user and started by httpd when running ps -ael on the EC2 instance:
4 S 0 20701 3057 0 80 0 - 62977 - ? 00:00:00 httpd
0 S 0 20705 20701 0 80 0 - 6295 - ? 00:00:00 rotatelogs
5 S 497 20706 20701 0 80 0 - 247053 - ? 00:00:01 httpd

Is there a better way to check that the bokeh server is running correctly and is there a way to see a log from the bokeh server?

I slightly modified the base.html template to display the output of server_document() called from view.py:

<title>parambokeh in django: sliders</title>
{{server_script}}
{% block content %} {{server_script|safe}} {% endblock %}

The script returned when accessing the http://django2-env.xpy8pjmgjb.us-east-2.elasticbeanstalk.com/sliders/ url is

<script src="http://localhost:5006/bk_sliders_app/autoload.js?bokeh-autoload-element=1002&bokeh-app-path=/bk_sliders_app&bokeh-absolute-url=http://localhost:5006/bk_sliders_app" id="1002"></script>

Where does this script run? Does it run on the client browser or does it run on the web server? If it runs on the client, then the http://localhost:5006 src should be incorrect and should be django2-env.xpy8pjmgjb.us-east-2.elasticbeanstalk.com instead, correct? Then what about the port number? 5006 is not open to internet access, so should it be port 80 instead? In this case, do I need to setup the Apache http server as a proxy/reverse proxy? If yes, how do I do it?

@rsosnowski01
Copy link

Hi, did you finally manage setting proxy/reverse proxy on Apache?
It seems that I have similar issue. I have tried to find answer on Bokeh Discussion group: https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc1a9766-ecc1-41e4-9d21-84cfa8335d65%40continuum.io
I'd appreciate your help if you have finally found answers to your questions.

@danielmesser1
Copy link
Author

danielmesser1 commented May 21, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants