Raspberry Pi Home Server

This year’s project during xmas vacation was to replace the old Raspberry Pi 1 by a new Raspberry Pi 3 with the official touch display and to increase the functional range. While the old one was just a music home entertainment installation running Volumio, the new one is more like a full featured home server based on Raspbian:

  • OpenVPN: It routes the local network into the VPN network provided by one of my servers in the internet.

  • Nextcloud: It runs a nextcloud installation that is reverse proxied by another server in the internet.

  • Mopidy: It runs the music server Mopidy with web radio, spotify, music on the NAS and more.

  • Home screen: It provides a kind of dashboard that shows on the main page the pending birthday dates, clock and a weather forecast and on another page a web interface to Mopidy.

Raspberry pi on the stereo system

OpenVPN

I have a local IPv4 network (192.168.19.0/24) at home with a router, a NAS, a printer, and more. In the internet I have two servers. The first one provides a couple of services like DNS (for www.sthu.org or {router,printer,nas}.sbg.sthu.org). In particular, it runs a OpenVPN server for the VPN 192.168.17.0/24.

The raspberry pi connects to this VPN and together with VPS1 they do the routing between 192.168.19.0/24 and 192.168.17.0/24. This allows me to connect to my home LAN from my notebook anytime.

OpenVPN routing

Nextcloud

The Raspberry Pi runs a Nextcloud installation. The whole point of a cloud is to be accessible from outside, so the VPS2 handles cloud.sthu.org as a caching reverse-proxy to the Raspberry Pi (cloud.sbg.sthu.org) over the VPN. For fast access within the LAN – say you want to share something from at home – one can simply upload files directly to cloud.sbg.sthu.org.

Mopidy

The music server Mopidy supports different front- and backends. As backends I run in particular Spotify, OE11, TuneIn2, and of course the local music on a USB memory drive and the NAS. As frontends Mopidy provides MPD and multiple web interfaces from which I chose the musicbox webclient. The nginx werbserver on the Raspberry Pi delivers this web interface via http://hifi.sbg.sthu.org on the local network.

Home screen

What I disliked about the old Raspberry Pi music player was that I necessarily had to use the web interface from my mobile phone or the computer. With the official touch display attached I can simply run a browser (chromium, in my case) in kiosk mode as a standalone X application to provide the web interface of http://hifi.sbg.sthu.org.

But of course, once there is a display I would like to have some kind of “dashboard” with the current time, weather forecast and birthday calendar seems nice, too.3 Below is a screenshot of http://screen.sbg.sthu.org.4

Dashboard

The clock is trivial javascript. The weather forecast uses the openweathermap API and some javascript JSON scripting. For the birthday list I used PHP icalendar in order to access the DAViCal server on VPS2, where I had a birthday calendar for a long time already.5

On the left is a small tab bar which allows to switch to the hifi page, which then simply embeds http://hifi.sbg.sthu.org in an iframe.

Hifi web interface

  1. Ö1 is a high quality public radio broadcaster in Austria. This backend extension not only provides a live stream to Ö1 but also the broadcasts of the last 7 days. In the morning I can now simply listen to the latest news. 

  2. TuneIn provides basically all radio stations that exist, including very local ones. 

  3. Actually, these wishes were mostly motivated by a friend who currently builds his own magic mirror

  4. The screenshot shows the Firefox rendering with responsive design feature set 800x480 screen size. 

  5. I used the PHP icalendar also for the event list on sbg.chaostreff.at but the guys replaced it by some ruby code some time ago. See this blog article for some technical details on this website.