Skip to content

Blog

Blog Relaunched

For a while I was dredding to create new blog posts because it was too cumbersome for me with using WordPress. This also included keeping WordPress up to date along with the plugins and any customizations to it.

A few years ago, I came across the amazing Material for MkDocs. It is a technical documentation theme for MkDocs with many great features. Documentation is written in Markdown and can be version controlled in a repository. This is basically "documentation as code".

I first introduced it at work a few years ago for various documentation sites. Together with Material for MkDocs this has been fantastic.

Since Material for MkDocs has a blog plugin I've been wanting to switch to this for a while. I knew that this will allow me to write blog posts more naturally (in a text editor) and treat everything as code. I finally got around to it and migrated my old WordPress site.

It is live now 😄.

In a follow-up post I will write about the process I took to migrate everything and how it is set up.

Django, django_tables2 and Bootstrap Table

I was always intrigued by Django. After all, it's slogan is

Quote

The web framework for perfectionists with deadlines

Last year I started a project for a client who needed a web app to manage a digital printing workflow. I evaluated Django and did their tutorial (which is really well made by the way). Since the project also required lots of data processing of different data sources (CSV, XML, etc.) Python made a lot of sense. So in the end the choice was to use Django.

I needed to create several tabIes showing data from the Django models. In this post I explain how I combined django_tables2 (for the table definitions) and Bootstrap Table (for visualizing the tables and client-side table features).

COVID-19 Montréal Dashboard

Thanks in particular to the great German podcast Das Coronavirus-Update from NDR with two fantastic virologists (Christian Drosten and Sandra Ciesek) I gained a better understanding of the pandemic and this coronavirus (SARS-CoV-2) and learned quite a lot new stuff. Maybe because of this, I felt for a while that there was a lack here (in Québec/Montréal) about how the data is presented/visualized. But I had this realization "late" (Fall 2020) and didn't have past data so I didn't want to start something from scratch.

One day I randomly came across a repository on GitHub of a dashboard for Montreal. Unfortunately, the website hadn't been updated in a while so I reached out to Jeremy Moreau who created it. We had a chat and I started helping him adding the data, adjusting to new data formats and automating the data retrieval and processing. Adding the missing data from the past was possible thanks to the Wayback Machine and (for the most part) to the hard work by Jean-Paul Soucy archiving all Canada-wide data for the COVID-19 Canada Open Data Working Group.

SEPAQ Availability Scraper

Recently, we were trying to find an available camp site on SEPAQ during the summer. We were late to the party, though, and most (interesting) sites were already booked or had single days left here and there.

Finding the remaining sites at flexible dates is actually quite cumbersome since you need to go to each camp site (and click through a calendar week by week there) or go to a single spot of a camp site to see its availability calendar. This is especially cumbersome if you are flexible in terms of the dates and the park.

Long story short, I looked at how to get the availability of the camp sites and hacked together a scraper. It recursively finds all camping spots and downloads the availability for each of them. Once they are downloaded it can parse them and filter for available spots (with minimum days and a desired date range).

You can find the code here: https://github.com/mschoettle/sepaq-availability-scraper

There's definitely some things that could be improved but it got the job done.

Setting up msmtp

For a long time I struggled with setting up cronjobs properly. It always took a lot of trial and error. Most of the times this was due to an environment problem (or a typo). You could test your cronjob but it would also be nice to be notified whenever something goes wrong (such as your backup script failing).

In this post I explain how to set up msmtp so that your system will send you emails.

Notes on traefik v2, Nextcloud, etc

Now that the Raspberry Pi is set up and Docker ready to be used, Gitea is running nicely. However, without TLS and just accessible by the IP address and port. So before setting up Nextcloud, I wanted to get a reverse proxy ready that also takes care of TLS termination. I use traefik which supports/integrates with Docker. Here I document how I configured it to put all my services (this includes Pi-Hole and my router's web interface) behind the reverse proxy with TLS.

At the end, I'll briefly note how Nextcloud is set up.

Migrating Data to Nextcloud

If you need to migrate your data to Nextcloud you probably don't want to upload all your files through the web interface.

I suggest to first try the below instructions with a small amount of data (for example, one folder) to verify that it works. Since Nextcloud runs as a container in my case some of the commands are specific to that, but if you don't you can just use the main command that is executed.

As previously noted, my data was "in the cloud" (encrypted at rest) so not already on an external drive (besides my backup of course). In general, although it depends on the size of your data, I therefore suggest to copy the data on to an external drive instead of copying it over the network from your machine to your server. Unless the server is not physically accessible of course (such as a virtual server somewhere). Even then, you can use the same procedure I used.

Notes on Docker

I've never really followed the hype around Docker but to be honest also never really taken the time to look into it more. That's until my friend Harald told me that he is using it on his Raspberry Pi to run some services. What sounded appealing is that you can reproduce builds, you are not "polluting" the host system, you can keep all configs etc. in one place, and move your services somewhere else quickly. The latter is especially interesting when you want to reinstall the host system. Furthermore, you can put the build as well as configuration in version control. Of course, you are adding another layer of complexity in the mix. I thought I'd give it a try. Here are some notes pertinent to the setup with my Raspberry Pi.