|
| 1 | +# Jupyter kernel for DeltaQ |
| 2 | + |
| 3 | +A customized Jupyter iHaskell kernel for use with the [deltaq](https://github.com/DeltaQ-SD/deltaq) tool. |
| 4 | + |
| 5 | + |
| 6 | +## Running a Jupyter server using Nix |
| 7 | + |
| 8 | +Launch Jupyter with the iHaskell kernel including the `deltaq` and `probability-polynomial` packages: |
| 9 | + |
| 10 | +```bash |
| 11 | +nix run |
| 12 | +``` |
| 13 | + |
| 14 | +In fact, this Jupyter kernel can be launced without directly cloning this repository: |
| 15 | + |
| 16 | +```bash |
| 17 | +nix run github:functionally/deltaq-jupyter |
| 18 | +``` |
| 19 | + |
| 20 | +## Docker |
| 21 | + |
| 22 | + |
| 23 | +### Building a docker image using Nix |
| 24 | + |
| 25 | +First build the image. |
| 26 | + |
| 27 | +```console |
| 28 | +$ nix build -o deltaq-jupyter-docker.tar.gz ".#docker" |
| 29 | + |
| 30 | +$ docker load --quiet < deltaq-jupyter-docker.tar.gz |
| 31 | +Loaded image: localhost/jupyter-deltaq:2mf9zcagms0isg5n94xsml34kj4bn42k |
| 32 | +``` |
| 33 | + |
| 34 | + |
| 35 | +### Push to docker registry |
| 36 | + |
| 37 | +You can push the image to a registry. |
| 38 | + |
| 39 | +```bash |
| 40 | +docker push localhost/jupyter-deltaq:2mf9zcagms0isg5n94xsml34kj4bn42k \ |
| 41 | + docker.io/bwbush/jupyter-deltaq:2mf9zcagms0isg5n94xsml34kj4bn42k |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +### Run the server in docker. |
| 46 | + |
| 47 | +You can run the local image, exposing the service on port 9999 for example. The container should have at least 4 GB of memory and two CPUs, but larger computations require more memory. If you deploy this on kubernetes, you can use the HTTP path `/api` as the health check. |
| 48 | + |
| 49 | +Locally, |
| 50 | + |
| 51 | +```bash |
| 52 | +docker run --publish 9999:8888 localhost/jupyter-deltaq:2mf9zcagms0isg5n94xsml34kj4bn42k |
| 53 | +``` |
| 54 | + |
| 55 | +or from DockerHub, |
| 56 | + |
| 57 | +```bash |
| 58 | +docker run --publish 9999:8888 ghcr.io/functionally/deltaq-jupyter:latest |
| 59 | +``` |
| 60 | + |
| 61 | +The default password is `deltaq`: you can change this by visiting http://localhost:9999/lab in a web browser. Alternatively, you can use with the default password by visiting http://localhost:9999/lab?token=deltaq. |
| 62 | + |
| 63 | +Use the "upload" and "download" features to move notebooks in and out of the container. |
| 64 | + |
| 65 | + |
| 66 | +## Updates |
| 67 | + |
| 68 | +In order to use the latest version of the `deltaq` packages, update the nix flake. |
| 69 | + |
| 70 | +```bash |
| 71 | +nix flake lock --update-input deltaq |
| 72 | +``` |
0 commit comments