generator-uniovi-bokeh-template
v1.13.0
Published
Bokeh basic authentication template generator
Readme
Description
Bokeh basic authentication template generator
Install template
First install Yeoman template manager. It is assumed that node is already installed node.js in your computer:
$ npm install -g yoInstall the last generator-uniovi-bokeh-template npm package from npm:
$ npm install -g generator-uniovi-bokeh-templateUpdate template
If you have already has installed a bokeh generator version and you want update it, execute again this command:
npm install -g generator-uniovi-bokeh-templateGenerate your project from template
Then you can generate your new project from template. Follow the promt question to configure your project:
$ yo uniovi-bokeh-templatePost project generation
Create a virtual environment and active it for your project to develop your application
$ python3 -m venv .venv$ source .venv/bin/activateInstall default dependencies
$ pip install -r requirements.txtIf exist any problem with the python dependencies in your python environment install this tool:
pip install purand update your requirements file with the last dependencies for your environment. Then try again to install the dependencies:
pur -r requirements.txtExecute default template just created
$ python bootstrap.pyDevelop your own application
By default the generator create a basic Bokeh application to be serve by Bokeh Server. This application is implemented in the main.py python module. Now you must substitute this module with your own application
An example
Bokeh template prompt

Bokeh Login

Bokeh sample application

Template tree folder structure
├───auth -> Bokeh basic authentication module
│ ├──auth.py
│ └──login.html
├───static -> Bokeh login styles and image resources
│ ├───css
│ │ └───styles.css
│ └───images
│ ├──login_background.png
│ └──login_gsdpi.png
├───.gitignore -> git ignore default application configuration
├───bootstrap.py -> application bootstrap
├───Dockerfile -> dockerfile to build appplication docker image
├───main.py -> main python application module
├───README -> application README file
├───requirements.txt -> application python dependenciesBuild, run and publish your docker image
After finalize your proyect you can build your docker image, run and publish it. Follow these steps:
Build your image:
$ docker build -t my-app:1.0.0 .Start a container from your image and test:
$ docker run --rm --name my-app -p 5000:5006 my-app:1.0.0If you want publish your image, tag your docker image to be uploaded to your repository:
$ docker tag my-app:1.0.0 your-account/my-app:1.0.0Finally push the docker image to your repository:
$ docker push your-account/my-app:1.0.0Open your application from your browser:
http://localhost:9000/my-app
Start bokeh server in production(AVISPE Server)
Configure HAProxy and add a proxy rule to access to boker application like this:
frontend k8s-frontend
...
# Frotend epigenomics application redirection
use_backend my-application if { path /my-app } || { path_beg /my-app/ }
backend my-application
# redirect to bokeh applications rules
...
server my-app localhost:5000Start Bokeh Server executing this command
$ docker run -d --name my-app -p 5000:5006 -e BOKEH_ALLOW_WS_ORIGIN=avispe.edv.uniovi.es -e BOKEH_RESOURCES=cdn my-app:1.0.0