A derived and lightened version of BinderHub for private repositories hosted on gitlab without kubernetes.
Booklab allow you to BUILD and RUN a docker image using GitLab repository, then CONNECT with JupyterHub and that allows users to interact with the code and environment within a live JupyterHub instance.
Binder is a wonderful tool but limited to public GitHub repository and associated with kubernetes in fact mainly google cloud. So an entry ticket to expensive for a small but smart jupyter on demand service.
Simple is beautiful
A web app supported by flask and the oauth plugin, authenticate and configure jupyterhub setup via redis A runner, checkout source code, build the docker image (repo2docker) and run jupyter. The philosophy is 1 runner > 1 notebook. To scale booklab, increase number of runners.
Booklab used Redis and Træfik to setup the service.
Booklab workflow for one click deployement :
- The home page display the list of your project on gitlab configured server (via an oauth request)
- You click on the repository to use (path + branch) and go to the deploy page
- BL create a pair of ssh key, push the public version on gitlab for the repository selected and the private key in redis.
- BL set the status of path:branch with the flag 'todo'
- A runner select atomically a path:branch to deploy. Retrieve the private ssh key, clone the repo, build the docker image and run it.
- Traefik detect a new label instanciate by docker container and configure the route http://pathbranch.local
- The deploy page has displayed the logs in real time during step 3 to 6 and now redirect to the new notebook
Redis structure :
TYPE | key | description |
---|---|---|
SET | runners | set of runner (token) declared |
STR | heartbeat: | expire each 30 seconds, and set by runner in waiting mode |
HASH | status | key : value : current deployment status |
LIST | log:: | deployment logs |
STR | token:: | jupyter token authentication |
HASH | conf | key:value shared from the webapp to the runner |
Configuration is done with config.yml
Define the FQDN
and TMPDIR
environment variables, e.g.
export FQDN=localhost
export TMPDIR=/tmp
in the config.yaml
file, define the values for gitlab/host
, gitlab/consumer_key
, gitlab/consumer_secret
Then start an instance with docker-compose:
docker-compose up
GNU AFFERO GENERAL PUBLIC LICENSE
https://www.gnu.org/licenses/agpl-3.0.txt
1- Configure your DNS with the wildcard : *.example.com 2- Set TMPDIR and FQDN environment variable (ex TMPDIR=/tmp and FQDN=example.com) 3- docker network create traefik 4- docker-compose up
To improve number of runner: docker-compose scale runner=20
- Author: Sebastien Campion [email protected]
- Font : Bangers