[bokeh] Hosted Bokeh Server in Flask on AWS ElasticBeanstalk - Unable to connect (ERR_CONNECTION_REFUSED)

What's in the browser JS console logs, and the bokeh server run logs? Best guess is that EB needs some configuration to do websocket forwarding. Past the initial HTTP request, all Bokeh server communication is on a websocket, so e.g. if the app is behind a reverse proxy like nginx that is not configured to forward websocket connections, then things will definitely not be able to function.

Thanks,

Bryan

···

On Jan 4, 2019, at 20:25, [email protected] wrote:

Also temporarily open all ports in/out for the security group.

On Friday, January 4, 2019 at 11:11:14 PM UTC-5, Eric Valente wrote:
HI - I've been having a very hard time getting my Bokeh/Flask running on ElasticBeanstalk.

The code works locally. From what I can gather it seems to have to do with the Bokeh Server denying the connect, but I've set the allow_websocket_origin to *. This works fine locally - the Flask HTTP server on port 80 loads the embeded Btk. lakeh Server.

But no matter what I try I can't connect once I deploy to Elastic Beanstalk. The HTTP server on port 80 works but the embeded Bokeh App does no load and if I try to navigate directly to the app at http://hostname.elasticbeanstalk.com:5006/bkapp I get ERR_CONNECTION_REFUSED.

Versions:
appnope==0.1.0

arrow==0.12.1

backcall==0.1.0

bleach==3.0.2

bokeh==1.0.3

boto3==1.9.70

botocore==1.12.70

certifi==2018.11.29

Click==7.0

colorama==0.4.1

decorator==4.3.0

defusedxml==0.5.0

docutils==0.14

entrypoints==0.2.3

Flask==1.0.2

ipykernel==5.1.0

ipython==7.2.0

ipython-genutils==0.2.0

ipywidgets==7.4.2

itsdangerous==1.1.0

jedi==0.13.2

Jinja2==2.10

jmespath==0.9.3

jsonschema==2.6.0

jupyter==1.0.0

jupyter-client==5.2.4

jupyter-console==6.0.0

jupyter-core==4.4.0

MarkupSafe==1.1.0

mistune==0.8.4

nbconvert==5.4.0

nbformat==4.4.0

notebook==5.7.4

numpy==1.15.4

packaging==18.0

pandas==0.23.4

pandocfilters==1.4.2

parso==0.3.1

pexpect==4.6.0

pickleshare==0.7.5

Pillow==5.3.0

prometheus-client==0.5.0

prompt-toolkit==2.0.7

ptyprocess==0.6.0

Pygments==2.3.1

pyparsing==2.3.0

python-dateutil==2.7.5

pytz==2018.7

pywinpty==0.5.5

PyYAML==3.13

pyzmq==17.1.2

qtconsole==4.4.3

s3fs==0.2.0

s3transfer==0.1.13

scikit-learn==0.20.2

scipy==1.2.0

Send2Trash==1.5.0

six==1.12.0

sklearn==0.0

terminado==0.8.1

testpath==0.4.2

tornado==4.5.3

traitlets==4.3.2

urllib3==1.24.1

wcwidth==0.1.7

webencodings==0.5.1

Werkzeug==0.14.1

widgetsnbextension==3.4.2

wincertstore==0.2

@application.route('/', methods=['GET'])
def bokeh_chart():
    script = server_document('http://hostname.elasticbeanstalk.com:5006/bkapp') ****<-- When running this locally I change to 0.0.0.0:5006/bkapp
    return render_template('embed.html', script=script, template="Flask")

#Creates the Bokeh Server instance to embed in the Flask route
def bokeh_worker():
    from bokeh.server.server import Server
    server = Server({'/bkapp': start_server}, allow_websocket_origin=["*"], address="0.0.0.0", port=5006, io_loop=IOLoop(), use_xheaders=True)

    server.start()
    server.io_loop.start()

from threading import Thread
Thread(target=bokeh_worker).start()

if __name__ == '__main__':
    application.debug = True
    application.run(host='0.0.0.0', port=80)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cf017e7-fcfd-4238-b300-cc8c92e29a12%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.