Bokeh server + app on AWS?

Hi all,

I’m a greenhorn who is looking to expose an interactive & animated bokeh app running on the bokeh server to a general audience on the internet via AWS elastic beanstalk. This app presents users with some figures, collects mouse events, and persists those in a database via callbacks from the client to the server.

In developing locally, everything works very well using an iframe pointing to localhost:5006/myapp. Obviously this doesn’t work when I deploy on elastic beanstalk, although I’m stymied on coming up with a solution/atternative. I thought I was missing something to do with proxying, so I’ve been futzing around with my nginx.conf and poring over the workflow details in demo.bokeh.org, although this is perhaps a bit too advanced for my purposes just yet.

Is my general approach wrong? Could anyone offer some advice?

Thanks

1 Like

Bump. Is there a tutorial for newbies on getting a bokeh server running the ‘sliders’ sine wave demo on AWS EB?

Peter

···

On Monday, September 4, 2017 at 6:33:22 PM UTC-7, kevin desimone wrote:

Hi all,

I’m a greenhorn who is looking to expose an interactive & animated bokeh app running on the bokeh server to a general audience on the internet via AWS elastic beanstalk. This app presents users with some figures, collects mouse events, and persists those in a database via callbacks from the client to the server.

In developing locally, everything works very well using an iframe pointing to localhost:5006/myapp. Obviously this doesn’t work when I deploy on elastic beanstalk, although I’m stymied on coming up with a solution/atternative. I thought I was missing something to do with proxying, so I’ve been futzing around with my nginx.conf and poring over the workflow details in demo.bokehplots.com, although this is perhaps a bit too advanced for my purposes just yet.

Is my general approach wrong? Could anyone offer some advice?

Thanks

1 Like

Hi,

At the moment the best I can offer is to point you at this repo:

GitHub - bokeh/demo.bokeh.org: Hosted Bokeh App Demos

Which was used to deploy Bokeh apps to the EC2 instance serving the demo site. It uses Salt and Supervisor which may be overkill for your needs (or maybe not). But it also needs some gentle updating. I tried to push a few changes back to GH just now but the remote operations are suddenly being denied. So I apologize, but the best I can do on short notice is to provide the diff in case that is useful.

Thanks,

Byran

git diff HEAD~1
diff --git a/bokeh/init.sls b/bokeh/init.sls
index d64a48b..c6f5b08 100644
--- a/bokeh/init.sls
+++ b/bokeh/init.sls
@@ -9,11 +9,6 @@ git-bokeh:
     - name: GitHub - bokeh/bokeh: Interactive Data Visualization in the browser, from Python
     - target: /home/ec2-user/bokeh

-git-bokeh-demos:
- git.latest:
- - name: https://github.com/bokeh/bokeh-demos.git
- - target: /home/ec2-user/bokeh-demos

···

-

supervisor-conf:
   file.managed:
diff --git a/bokeh/settings.sls b/bokeh/settings.sls
index 73cc5f5..cacec6a 100644
--- a/bokeh/settings.sls
+++ b/bokeh/settings.sls
@@ -9,13 +9,6 @@

-{% set BOKEH_DEMOS_LIST = ['bokeh/examples/app/movies',
- 'bokeh/examples/app/weather',
- 'bokeh/examples/app/crossfilter',
- 'bokeh/examples/app/gapminder',
- 'bokeh/examples/app/surface3d',
- 'bokeh/examples/app/selection_histogram.py',
+{% set BOKEH_DEMOS_LIST = [
                            'bokeh/examples/app/sliders.py',
- 'bokeh/examples/app/stocks',
- 'bokeh/examples/app/export_csv'
                            ] %}
diff --git a/bokeh/templates/bokeh-server.conf b/bokeh/templates/bokeh-server.conf
index 74b1501..3a46c4a 100644
--- a/bokeh/templates/bokeh-server.conf
+++ b/bokeh/templates/bokeh-server.conf
@@ -2,7 +2,7 @@
{%- from 'bokeh/settings.sls' import BOKEH_DEMOS_LIST with context -%}

[program:bokeh_demos]
-command=/home/ec2-user/miniconda/envs/bokeh/bin/bokeh serve {{ BOKEH_DEMOS_LIST | join(' ') }} --prefix=apps/ --address=127.0.0.1 --port 51%(process_num)02d --host staging.bokehplots.com:443 --host {{PUBLIC_IP}}:443 --allow-websocket-origin=staging.bokehplots.com --use-xheaders
+command=/home/ec2-user/miniconda/envs/bokeh/bin/bokeh serve {{ BOKEH_DEMOS_LIST | join(' ') }} --prefix=/apps --address=127.0.0.1 --port 51%(process_num)02d --allow-websocket-origin=staging.bokehplots.com --use-xheaders
directory=/home/ec2-user/
autostart=false
autorestart=true
diff --git a/deploy.sh b/deploy.sh
index beeb583..6a43010 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -27,17 +27,17 @@ done
echo "Installing Miniconda, Nginx (with $NUM_SERVERS servers) and Bokeh Server"

MINICONDA_VERSION=latest
-MINICONDA="Miniconda-$MINICONDA_VERSION-Linux-x86_64"
+MINICONDA="Miniconda3-$MINICONDA_VERSION-Linux-x86_64"
MINICONDA_URL="http://repo.continuum.io/miniconda/$MINICONDA.sh"
wget -N $MINICONDA_URL
bash $MINICONDA.sh -b -p $HOME/miniconda

PATH=~/miniconda/bin/:$PATH

-conda create -q -y -n bokeh -c bokeh/channel/dev bokeh
+conda create -q -y -n bokeh -c bokeh bokeh
source activate bokeh

-conda install -q -y pandas scikit-learn supervisor
+conda install -q -y pandas scikit-learn numba

PREFIX=~/miniconda
CONDA=$PREFIX/bin/conda
diff --git a/nginx/templates/index.html b/nginx/templates/index.html
index e2e6a59..75447ab 100644
--- a/nginx/templates/index.html
+++ b/nginx/templates/index.html

On Sep 15, 2017, at 16:31, [email protected] wrote:

Bump. Is there a tutorial for newbies on getting a bokeh server running the 'sliders' sine wave demo on AWS EB?

Peter

On Monday, September 4, 2017 at 6:33:22 PM UTC-7, kevin desimone wrote:
Hi all,

I'm a greenhorn who is looking to expose an interactive & animated bokeh app running on the bokeh server to a general audience on the internet via AWS elastic beanstalk. This app presents users with some figures, collects mouse events, and persists those in a database via callbacks from the client to the server.

In developing locally, everything works very well using an iframe pointing to localhost:5006/myapp. Obviously this doesn't work when I deploy on elastic beanstalk, although I'm stymied on coming up with a solution/atternative. I thought I was missing something to do with proxying, so I've been futzing around with my nginx.conf and poring over the workflow details in demo.bokehplots.com, although this is perhaps a bit too advanced for my purposes just yet.

Is my general approach wrong? Could anyone offer some advice?

Thanks

--
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/4abca225-e501-4252-82cd-9aae19a8563d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

Is there any update on this service you mentioned a while back?

https://groups.google.com/a/continuum.io/d/msg/bokeh/GF76yuML8xE/1JtRSsJTAQAJ

···

On Friday, September 15, 2017 at 6:19:55 PM UTC-4, Bryan Van de ven wrote:

Hi,

At the moment the best I can offer is to point you at this repo:

    [https://github.com/bokeh/demo.bokehplots.com](https://github.com/bokeh/demo.bokehplots.com)

Which was used to deploy Bokeh apps to the EC2 instance serving the demo site. It uses Salt and Supervisor which may be overkill for your needs (or maybe not). But it also needs some gentle updating. I tried to push a few changes back to GH just now but the remote operations are suddenly being denied. So I apologize, but the best I can do on short notice is to provide the diff in case that is useful.

Thanks,

Byran

git diff HEAD~1

diff --git a/bokeh/init.sls b/bokeh/init.sls

index d64a48b…c6f5b08 100644

— a/bokeh/init.sls

+++ b/bokeh/init.sls

@@ -9,11 +9,6 @@ git-bokeh:

 - name: [https://github.com/bokeh/bokeh.git](https://github.com/bokeh/bokeh.git)

 - target: /home/ec2-user/bokeh

-git-bokeh-demos:

supervisor-conf:

file.managed:

diff --git a/bokeh/settings.sls b/bokeh/settings.sls

index 73cc5f5…cacec6a 100644

— a/bokeh/settings.sls

+++ b/bokeh/settings.sls

@@ -9,13 +9,6 @@

-{% set BOKEH_DEMOS_LIST = [‘bokeh/examples/app/movies’,

  •                       'bokeh/examples/app/weather',
    
  •                       'bokeh/examples/app/crossfilter',
    
  •                       'bokeh/examples/app/gapminder',
    
  •                       'bokeh/examples/app/surface3d',
    
  •                       'bokeh/examples/app/selection_histogram.py',
    

+{% set BOKEH_DEMOS_LIST = [

                        'bokeh/examples/app/sliders.py',
  •                       'bokeh/examples/app/stocks',
    
  •                       'bokeh/examples/app/export_csv'
    
                          ] %}
    

diff --git a/bokeh/templates/bokeh-server.conf b/bokeh/templates/bokeh-server.conf

index 74b1501…3a46c4a 100644

— a/bokeh/templates/bokeh-server.conf

+++ b/bokeh/templates/bokeh-server.conf

@@ -2,7 +2,7 @@

{%- from ‘bokeh/settings.sls’ import BOKEH_DEMOS_LIST with context -%}

[program:bokeh_demos]

-command=/home/ec2-user/miniconda/envs/bokeh/bin/bokeh serve {{ BOKEH_DEMOS_LIST | join(’ ') }} --prefix=apps/ --address=127.0.0.1 --port 51%(process_num)02d --host staging.bokehplots.com:443 --host {{PUBLIC_IP}}:443 --allow-websocket-origin=staging.bokehplots.com --use-xheaders

+command=/home/ec2-user/miniconda/envs/bokeh/bin/bokeh serve {{ BOKEH_DEMOS_LIST | join(’ ') }} --prefix=/apps --address=127.0.0.1 --port 51%(process_num)02d --allow-websocket-origin=staging.bokehplots.com --use-xheaders

directory=/home/ec2-user/

autostart=false

autorestart=true

diff --git a/deploy.sh b/deploy.sh

index beeb583…6a43010 100755

— a/deploy.sh

+++ b/deploy.sh

@@ -27,17 +27,17 @@ done

echo “Installing Miniconda, Nginx (with $NUM_SERVERS servers) and Bokeh Server”

MINICONDA_VERSION=latest

-MINICONDA=“Miniconda-$MINICONDA_VERSION-Linux-x86_64”

+MINICONDA=“Miniconda3-$MINICONDA_VERSION-Linux-x86_64”

MINICONDA_URL=“http://repo.continuum.io/miniconda/$MINICONDA.sh

wget -N $MINICONDA_URL

bash $MINICONDA.sh -b -p $HOME/miniconda

PATH=~/miniconda/bin/:$PATH

-conda create -q -y -n bokeh -c bokeh/channel/dev bokeh

+conda create -q -y -n bokeh -c bokeh bokeh

source activate bokeh

-conda install -q -y pandas scikit-learn supervisor

+conda install -q -y pandas scikit-learn numba

PREFIX=~/miniconda

CONDA=$PREFIX/bin/conda

diff --git a/nginx/templates/index.html b/nginx/templates/index.html

index e2e6a59…75447ab 100644

— a/nginx/templates/index.html

+++ b/nginx/templates/index.html

On Sep 15, 2017, at 16:31, [email protected] wrote:

Bump. Is there a tutorial for newbies on getting a bokeh server running the ‘sliders’ sine wave demo on AWS EB?

Peter

On Monday, September 4, 2017 at 6:33:22 PM UTC-7, kevin desimone wrote:

Hi all,

I’m a greenhorn who is looking to expose an interactive & animated bokeh app running on the bokeh server to a general audience on the internet via AWS elastic beanstalk. This app presents users with some figures, collects mouse events, and persists those in a database via callbacks from the client to the server.

In developing locally, everything works very well using an iframe pointing to localhost:5006/myapp. Obviously this doesn’t work when I deploy on elastic beanstalk, although I’m stymied on coming up with a solution/atternative. I thought I was missing something to do with proxying, so I’ve been futzing around with my nginx.conf and poring over the workflow details in demo.bokehplots.com, although this is perhaps a bit too advanced for my purposes just yet.

Is my general approach wrong? Could anyone offer some advice?

Thanks


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/4abca225-e501-4252-82cd-9aae19a8563d%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan, appreciate the help. Could you let us know when your changes are pushed to GitHub?

Peter

···

On Friday, September 15, 2017 at 4:51:15 PM UTC-7, kevin desimone wrote:

Hi Bryan,

Is there any update on this service you mentioned a while back?

https://groups.google.com/a/continuum.io/d/msg/bokeh/GF76yuML8xE/1JtRSsJTAQAJ

On Friday, September 15, 2017 at 6:19:55 PM UTC-4, Bryan Van de ven wrote:

Hi,

At the moment the best I can offer is to point you at this repo:

    [https://github.com/bokeh/demo.bokehplots.com](https://github.com/bokeh/demo.bokehplots.com)

Which was used to deploy Bokeh apps to the EC2 instance serving the demo site. It uses Salt and Supervisor which may be overkill for your needs (or maybe not). But it also needs some gentle updating. I tried to push a few changes back to GH just now but the remote operations are suddenly being denied. So I apologize, but the best I can do on short notice is to provide the diff in case that is useful.

Thanks,

Byran

git diff HEAD~1

diff --git a/bokeh/init.sls b/bokeh/init.sls

index d64a48b…c6f5b08 100644

— a/bokeh/init.sls

+++ b/bokeh/init.sls

@@ -9,11 +9,6 @@ git-bokeh:

 - name: [https://github.com/bokeh/bokeh.git](https://github.com/bokeh/bokeh.git)

 - target: /home/ec2-user/bokeh

-git-bokeh-demos:

supervisor-conf:

file.managed:

diff --git a/bokeh/settings.sls b/bokeh/settings.sls

index 73cc5f5…cacec6a 100644

— a/bokeh/settings.sls

+++ b/bokeh/settings.sls

@@ -9,13 +9,6 @@

-{% set BOKEH_DEMOS_LIST = [‘bokeh/examples/app/movies’,

  •                       'bokeh/examples/app/weather',
    
  •                       'bokeh/examples/app/crossfilter',
    
  •                       'bokeh/examples/app/gapminder',
    
  •                       'bokeh/examples/app/surface3d',
    
  •                       'bokeh/examples/app/selection_histogram.py',
    

+{% set BOKEH_DEMOS_LIST = [

                        'bokeh/examples/app/sliders.py',
  •                       'bokeh/examples/app/stocks',
    
  •                       'bokeh/examples/app/export_csv'
    
                          ] %}
    

diff --git a/bokeh/templates/bokeh-server.conf b/bokeh/templates/bokeh-server.conf

index 74b1501…3a46c4a 100644

— a/bokeh/templates/bokeh-server.conf

+++ b/bokeh/templates/bokeh-server.conf

@@ -2,7 +2,7 @@

{%- from ‘bokeh/settings.sls’ import BOKEH_DEMOS_LIST with context -%}

[program:bokeh_demos]

-command=/home/ec2-user/miniconda/envs/bokeh/bin/bokeh serve {{ BOKEH_DEMOS_LIST | join(’ ') }} --prefix=apps/ --address=127.0.0.1 --port 51%(process_num)02d --host staging.bokehplots.com:443 --host {{PUBLIC_IP}}:443 --allow-websocket-origin=staging.bokehplots.com --use-xheaders

+command=/home/ec2-user/miniconda/envs/bokeh/bin/bokeh serve {{ BOKEH_DEMOS_LIST | join(’ ') }} --prefix=/apps --address=127.0.0.1 --port 51%(process_num)02d --allow-websocket-origin=staging.bokehplots.com --use-xheaders

directory=/home/ec2-user/

autostart=false

autorestart=true

diff --git a/deploy.sh b/deploy.sh

index beeb583…6a43010 100755

— a/deploy.sh

+++ b/deploy.sh

@@ -27,17 +27,17 @@ done

echo “Installing Miniconda, Nginx (with $NUM_SERVERS servers) and Bokeh Server”

MINICONDA_VERSION=latest

-MINICONDA=“Miniconda-$MINICONDA_VERSION-Linux-x86_64”

+MINICONDA=“Miniconda3-$MINICONDA_VERSION-Linux-x86_64”

MINICONDA_URL=“http://repo.continuum.io/miniconda/$MINICONDA.sh

wget -N $MINICONDA_URL

bash $MINICONDA.sh -b -p $HOME/miniconda

PATH=~/miniconda/bin/:$PATH

-conda create -q -y -n bokeh -c bokeh/channel/dev bokeh

+conda create -q -y -n bokeh -c bokeh bokeh

source activate bokeh

-conda install -q -y pandas scikit-learn supervisor

+conda install -q -y pandas scikit-learn numba

PREFIX=~/miniconda

CONDA=$PREFIX/bin/conda

diff --git a/nginx/templates/index.html b/nginx/templates/index.html

index e2e6a59…75447ab 100644

— a/nginx/templates/index.html

+++ b/nginx/templates/index.html

On Sep 15, 2017, at 16:31, [email protected] wrote:

Bump. Is there a tutorial for newbies on getting a bokeh server running the ‘sliders’ sine wave demo on AWS EB?

Peter

On Monday, September 4, 2017 at 6:33:22 PM UTC-7, kevin desimone wrote:

Hi all,

I’m a greenhorn who is looking to expose an interactive & animated bokeh app running on the bokeh server to a general audience on the internet via AWS elastic beanstalk. This app presents users with some figures, collects mouse events, and persists those in a database via callbacks from the client to the server.

In developing locally, everything works very well using an iframe pointing to localhost:5006/myapp. Obviously this doesn’t work when I deploy on elastic beanstalk, although I’m stymied on coming up with a solution/atternative. I thought I was missing something to do with proxying, so I’ve been futzing around with my nginx.conf and poring over the workflow details in demo.bokehplots.com, although this is perhaps a bit too advanced for my purposes just yet.

Is my general approach wrong? Could anyone offer some advice?

Thanks


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/4abca225-e501-4252-82cd-9aae19a8563d%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Peter,

It may be a week or two, because it involves some people coordination, which always makes things take longer. Which also means I may in all likely hood not remember to come back to this thread. A more more direct solution I would suggest would be to follow the repo on GH so you are notified automatically of pushes and changes (it is a very low activity repo):

GitHub - bokeh/demo.bokeh.org: Hosted Bokeh App Demos

Thanks,

Bryan

I’ve just had some success deploying Bokeh as a Flask app on AWS Lambda.

Found zappa to be a great help.

Started with this repo and made small tweaks in the bokeh_flask folder (see attached .zip):

  • Pipfile specifies bokeh 0.12.5 (with bokeh.charts)
  • zappa_settings.json created by zappa init
  • Added a static folder with a favicon.ico
  • Finally,

bokeh_flask.zip (7.45 KB)

···

``

in iris_index1.html