Hugo, Jupyter, Docker

Intro

I have a website where I show a some cool stuff on which I’m working, but I also wanted to have a personal blog where to write some cool stuff about what I learn, and an environment where to use my Jupyter notebooks.

Hugo

I didn’t want something fancy for the blog, and I like to write in Markdown, so I went with Hugo. It’s really easy to create, I just needed to choose the most basic theme and I started writing with Typora as it’s a Markdown editor I like (and it’s multiplatform, since I use OSX, Win10 and Ubuntu).

This is all I needed to start writing my first post (this one, by the way)!

Jupyter on RaspberryPI

Here is where I’m currently exposing some of my work on jupyter to be accessible from anyone. I did it by installing Jupyter on a docker container running on the Raspberry PI 3B that sits behind my TV and works as my server. On my PC I use a docker image (jupyter/datascience-notebook) to run Jupyter but it won’t work on an ARM7 architecture like the one my Raspberry has.

I found an image (andresvidal/jupyter-armv7l) that contained jupyter and a few libraries for datascience, but was still missing most of the ones I usually use (sklearn, scipy, etc…), so I needed to compile them on my RaspberryPI. This would have been a really long task, but luckily PyWheels exists, and simply by using it’s registry of precompiled wheels I could save a lot of time and install all the libraries I use!

The last thing I needed to do was simply to use a volume to allow the jupyter container to access the notebooks in my repo, and I made it read only (by appending :ro at the end of the definition of the volume) so that the container (accessible from the internet) cannot change anything on the host.

Last thing I did, was to convert this heavily modified container to an image that I then uploaded to dockerhub (lucamattiazzi/raspyter), I think that could be useful in the future.

Docker commit

This may be obvious for some people, not so much for me. When you create a Docker container, it’s always possible to convert it back to an image using docker commit. This will save the current state of the container in a replicable image that one can also upload to some docker images hub. No Dockerfile will be produced, but one can nonetheless keep the state of the machine at that specific moment and use it! Pretty useful!