On Jan 10, 2019, at 05:17, Joseph St.Amand <[email protected]> wrote:
One difference I noticed is that I use the "--use-xheaders" option when starting my bokeh server.
I have those environment variables set to:
BOKEH_SERVER_HOSTNAME = bokeh // this is the name of the docker container running my bokeh server, it gets resolved to an IP in the docker network (it's 172.18.0.something)
HOST_IP = 10.240.0.10 // this is the local network IP of the machine hosting the docker apps.
Best,
-Joe
On Wed, Jan 9, 2019 at 7:27 PM <[email protected]> wrote:
Joe
Appreciate your help! I am not using docker but I do have a virtualenv that I am launching my Flask based website from. I adapted my Flask app route from what you have provided, but its much more straightforward to carry out my initial testing within the local network:
@app.route('/test')
def test():
bokeh_app = 'bokeh/myapp'
app_url = 'http://%s:%s/%s' % ('127.0.0.1', '5100', bokeh_app)
session = pull_session(url=app_url)
script = server_session(None, session.id, url=app_url)
return render_template("test.html", script=script, template="Flask")
My Nginx is setup similar to yours. When I call my bokeh app with "--prefix /bokeh" option, the page link to /test (localhost/test) shows all the headers and content except the embedded bokeh app. This is what I use for starting my Bokeh server:
bokeh serve myapp --port 5100 --allow-websocket-origin='*'
However, starting the bokeh server without the "--prefix /bokeh" option and changing the variable
bokeh_app = 'myapp'
in Flask shows the embedded Bokeh app fine. I am struggling to find what is different in my setup from yours, since I would like all my Bokeh apps to appear under the /bokeh.
Also do you mind advising on what to set for the environmental variables like 'BOKEH_SERVER_HOSTNAME' and 'HOST_IP' just so that I am clear? Thanks again.
On Wednesday, January 9, 2019 at 1:39:11 PM UTC, Joseph St.Amand wrote:
Yes it definitely works great for what I am doing here -- on my website I have four separate bokeh apps embedding in various webpages, it's been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.
Since you aren't using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc ...
I'd check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.
Best,
-Joe
On Wed, Jan 9, 2019 at 3:28 AM <[email protected]> wrote:
Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.
Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can't get it to work.
And I am using the latest, Bokeh 1.0.3.
On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:
That's what I would suggest as well.
I had some trouble getting everything working with nginx as a reverse proxy as well, I'm glad to share what I can about what I cludged together (Disclaimer: I'm not a web developer).
I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the "--use-xheaders" and "--prefix /bokeh" options appended to my "bokeh serve ...." command. I've attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.
Best,
-Joe
On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven <[email protected]> wrote:
Hi,
Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).
Thanks,
Bryan
> On Jan 3, 2019, at 13:49, kaushikma...@gmail.com wrote:
>
> Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.
> However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.
>
> On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
> Hi,
>
> You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".
>
> Thanks,
>
> Bryan
>
> > On Jan 3, 2019, at 13:25, kaushikma...@gmail.com wrote:
> >
> > Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
> >
> > Once again, I made it work! The culprit seems to be the line:
> >
> > try_files $uri $uri/ =404;
> >
> > Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.
> >
> > However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
> >
> > On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
> > Hi,
> >
> > You have both:
> >
> > location / { ... }
> >
> > and:
> >
> > index index.html index.htm index.nginx-debian.html;
> >
> > I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
> >
> > Thanks,
> >
> > Bryan
> >
> > > On Jan 3, 2019, at 12:49, kaushikma...@gmail.com wrote:
> > >
> > > Sarah, Thanks for your suggestion.
> > > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
> > >
> > > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
> > >
> > >
> > > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
> > > Have you tried starting bokeh on port 80? (you might need sudo to do that)
> > >
> > > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
> > > nginx redirect http to https with custom port server - Stack Overflow
> > >
> > >
> > > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
> > > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
> > >
> > > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
> > >
> > > bokeh serve appA appB appC --port 5100
> > >
> > > When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
> > >
> > > Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in Bokeh server — Bokeh 3.3.2 Documentation
> > >
> > > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
> > >
> > > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
> > >
> > > --
> > > 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 bokeh+un...@continuum.io.
> > > To post to this group, send email to bo...@continuum.io.
> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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 bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
On Wednesday, January 9, 2019 at 6:39:11 AM UTC-7, Joseph St.Amand wrote:
Yes it definitely works great for what I am doing here -- on my website I have four separate bokeh apps embedding in various webpages, it's been running good for about a month now with no issues. All using the same techniques in the flask app file I had sent.
Since you aren't using docker, you will have to change the app.py file for your own setup and fill in all the environment variables, rename app route and bokeh_app, etc ...
I'd check in your flask app that the host_url and app_url variables are what you expect. Also keep an eye on the bokeh logs to check that the request is reaching your bokeh server and that it is responding.
Best,
-Joe
On Wed, Jan 9, 2019 at 3:28 AM <[email protected]> wrote:
Joseph, Thanks for your guidance and for attaching the config files. I used your Nginx config file and it works nicely for proxy setup. However not so much luck with the bokeh app embedded inside the Flask.
Can you please confirm that the /MyApp link (as defined in your Flask configuration) actually resolves and shows the embedded Bokeh app? I just can't get it to work.
And I am using the latest, Bokeh 1.0.3.
On Monday, January 7, 2019 at 4:27:40 AM UTC-7, Joseph St.Amand wrote:
That's what I would suggest as well.
I had some trouble getting everything working with nginx as a reverse proxy as well, I'm glad to share what I can about what I cludged together (Disclaimer: I'm not a web developer).
I ran everything under docker-compose using three containers(bokeh server, flask-gunicorn, nginx proxy). I used the "--use-xheaders" and "--prefix /bokeh" options appended to my "bokeh serve ...." command. I've attached my nginx config file and also an example of how I call the bokeh server from within flask. The bokeh app gets integrated in a web page just as suggested in the bokeh documentation using {{script | safe}}.
Best,
-Joe
On Mon, Jan 7, 2019 at 2:39 AM Bryan Van de ven <[email protected]> wrote:
Hi,
Definitely more of an Nginx question. FWIW I'd possibly suggest you put the apps under some sort of prefix, e.g. /apps/app1, etc. Then I think you could avoid using try_files, since routes to /apps/ would be unambiguously different from / (but I am not an expert here).
Thanks,
Bryan
> On Jan 3, 2019, at 13:49, kaushikma...@gmail.com wrote:
>
> Bryan, I forgot about those options. Adding --disable-index --disable-index-redirect works nicely for the Bokeh server, not allowing localhost:5100 to show the list of apps.
> However, I want users to go to the "/" and see an index.html file that Nginx serves up first (and not a Page 404). This is more of a Nginx question I guess.
>
> On Thursday, January 3, 2019 at 9:28:50 PM UTC, Bryan Van de ven wrote:
> Hi,
>
> You can start the Bokeh server with the --disable-index and --disable-index-redirect options if you want to make sure Bokeh server does not respond to "/".
>
> Thanks,
>
> Bryan
>
> > On Jan 3, 2019, at 13:25, kaushikma...@gmail.com wrote:
> >
> > Bryan, there is an index file that Nginx serves up if the Bokeh server is not running.
> >
> > Once again, I made it work! The culprit seems to be the line:
> >
> > try_files $uri $uri/ =404;
> >
> > Commenting it out makes the Nginx proxy server work nicely, pointing to the Bokeh server. Meaning I can type in http://localhost and I can see my app running at localhost/myapp.
> >
> > However there is slight issue with the case of running multiple apps. localhost now brings me to the Bokeh server landing page with the list of apps. How do I tweak the Nginx config file to show the index.html file instead? I am assuming the line I just commented out was meant to do that, going by the comments above it.
> >
> > On Thursday, January 3, 2019 at 9:02:02 PM UTC, Bryan Van de ven wrote:
> > Hi,
> >
> > You have both:
> >
> > location / { ... }
> >
> > and:
> >
> > index index.html index.htm index.nginx-debian.html;
> >
> > I'm not an nginx expert but these options seem incompatible? If the "index" statement takes precedence, and there is no index.html to return, that could explain the 404
> >
> > Thanks,
> >
> > Bryan
> >
> > > On Jan 3, 2019, at 12:49, kaushikma...@gmail.com wrote:
> > >
> > > Sarah, Thanks for your suggestion.
> > > I tried that but ran into issues starting the bokeh server on port 80 even with sudo.
> > >
> > > I might be wrong, but I thought the whole idea of using a proxy server like Nginx is to hide which port the bokeh server is running on when the outside users connect to port 80.
> > >
> > >
> > > On Tuesday, January 1, 2019 at 3:48:01 PM UTC, Sarah Bird wrote:
> > > Have you tried starting bokeh on port 80? (you might need sudo to do that)
> > >
> > > Or, what have you done to setup nginx to do the redirect? This isn't something I know a lot about but I found this stack overflow post.
> > > nginx redirect http to https with custom port server - Stack Overflow
> > >
> > >
> > > On Thursday, December 27, 2018 at 11:26:31 PM UTC-6, Kaushik Mallick wrote:
> > > First disclosure: I am not very knowledgeable in setting up reverse proxy etc.
> > >
> > > I am trying to bokeh serve multiple apps, lets say: appA, appB, appC. I have all my apps in separate folders. I have deployed all the apps by issuing:
> > >
> > > bokeh serve appA appB appC --port 5100
> > >
> > > When I go to http://localhost:5100, I see all my apps listed. Clicking each of them fire up the app in its own subfolder. For example I can see my appA working in localhost:5100/appA. So far so good.
> > >
> > > Now I want to set up nginx as reverse proxy to the bokeh server. I am following the instructions in Bokeh server — Bokeh 3.3.2 Documentation
> > >
> > > I have modified the /etc/nginx/sites-enabled/default file (attached) as instructed. After starting the nginx service I can go to http://localhost (port 80) and see all the apps listed there (great!). However when I click on each link for the apps, I get a 404 page error. The apps still function in localhost:5100/app*. I was of the idea that the purpose of the nginx reverse proxy was to allow the apps be reachable directly from port 80.
> > >
> > > What could I be doing wrong? I sense its something simple in my setup. Thanks a lot in advance for any suggestion or advice.
> > >
> > > --
> > > 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 bokeh+un...@continuum.io.
> > > To post to this group, send email to bo...@continuum.io.
> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/46b8c0a9-23d3-41ff-b40d-e9ff61c8e32f%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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 bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a32254da-ac8a-46da-94fc-f2905f0480be%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e987bc3d-70f4-4c5d-8ca9-ae947544a45d%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/E7315D53-5C63-44A4-BF1B-E3EFBD31430B%40anaconda.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
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 bokeh+un...@continuum.io.
To post to this group, send email to bo...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/679cb420-c9f4-428f-b7a6-4712f0bf1b16%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
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/60ba2ab9-3440-4b78-89ea-6bd7edf7cd05%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
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/CAGkeYKbg-K4prXvp27L7VAar5JOpFTo-1Z70rCSPbcQ-jTtLjw%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.