Request for nginx config for Flask + Bokeh server

@Gopi_M

For the final setup this topic landed on, namely nginx+flask+bokeh with HTTPS, I would circle back to the possibility that you can do this with a cloud or platform-as-a-service such as Heroku.

For setups like you have with the server running separately, Heroku was the only one that I found worked.

If you’re able to refactor things and invoke the server programmatically as a worker thread in the flask app, then others cloud services work and the CORS issues also disappear when running serving locally in that case, if I recall correctly.

If you did try Heroku, the way you would need to set it up is to have two separate dynos, one running the flask app and the other running the bokeh server via bokeh serve ...

This will give you HTTPS without having to manage yourself. And, given the above-mentioned architecture, you can run the bokeh server dyno with the --allow-websocket-origin set to the URL of the Flask app so that it is the only way to connect to the server.

Heroku also has an NGINX buildpack as one of its extensions too.

Admittedly, this would require a small expenditure of time to get set up with Heroku deployment, but it is well documented in my opinion.

As of a few months ago, they had a free-level (no cost) for dynos and a next-tier hobby-level, which cost approx. $7/US per dyno per month. I think the main thing with the hobby level is that your app doesn’t have to wake up when someone hits the site. And you can scale up from there through as your needs require.