Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

lsst-sqre/squash-bokeh

Repository files navigation

squash-bokeh

The SQuaSH Bokeh serves the squash-bokeh apps, we use the Bokeh plotting library for rich interactive visualizations. You can learn more about SQuaSH at SQR-009.

Build Status

Requirements

squash-bokeh requires the squash-restful-api microservice.

Kubernetes deployment

Assuming you have kubectl configured to access your GCE cluster, you can deploy squash-bokeh using:

TAG=latest make deployment

NOTE: the bokeh apps to be deployed can be configured by setting the following variable:

export SQUASH_BOKEH_APPS="code_changes AMx"

the default is to deploy all the bokeh apps in the /app folder.

Also, it must be consistent with the bokeh apps configured in the squash deployment.

Debugging

You can inspect the deployment using:

kubectl describe deployment squash-bokeh

and view the container logs using:

kubectl logs deployment/squash-bokeh nginx
kubectl logs deployment/squash-bokeh bokeh

Run an interactive shell inside the bokeh container with:

kubectl exec -it <TAB> -c bokeh /bin/bash

Rolling out updates

Check the update history with:

kubectl rollout history deployment squash-bokeh

Modify the squash-bokeh image and then apply the new configuration for the kubernetes deployment:

TAG=latest make build push update

Check the deployment changes:

kubectl describe deployments squash-bokeh

Scaling up the squash-bokeh microservice

Use the kubectl get replicasets command to view the current set of replicas.

kubectl get replicasets

Use the kubectl scale command to scale the squash-bokeh deployment:

kubectl scale deployments squash-bokeh --replicas=3

or change the squash-bokeh-deployment.yaml configuration file and apply the new configuration:

kubectl apply -f squash-bokeh-deployment.yaml

Check the deployment changes:

kubectl describe deployments squash-bokeh
kubectl get pods
kubectl get replicasets

Development workflow

You can install the dependencies and run squash-bokeh locally for development

  1. Install the software dependencies
git clone  https://github.com/lsst-sqre/squash-bokeh.git

cd squash-bokeh

virtualenv env -p python3
source env/bin/activate
pip install -r requirements.txt
  1. Create a new bokeh app
mkdir app/<new app>

you can follow the structrure used in one of the existing apps, e.g. app/monitor.

  1. Run the squash-bokeh app
export SQUASH_API_URL=<squash-api url>  # you can use one of the deployed SQuaSH APIs e.g. export SQUASH_API_URL=http://squash-restful-api-sandbox.lsst.codes/
bokeh serve --log-level debug <path to app 1> [<path to app 2>] # e.g.  bokeh serve --log-level debug app/monitor

when you point to the app directory, the file that is called by the bokeh server is always the main.py.

The app(s) will run at http://localhost:5006.