Site Setup

Hugo Site Background

Background

I happen to have an original Raspberry Pi model B at a cottage quite a ways from where I live. My plan is to set up monitoring of temperature and humidity at the cottage including history. The Raspberry Pi is connected to a 4G modem, however usual http ports have been allocated to a surveillance camera.

Plan

Given the limited number of ports, I decided to give ZeroTier a try. That way I could have a kind of VPN between the Raspberry Pi and a VPS for whatever applications I set up at the cottage. This website is a proof of concept.

ZeroTier

ZeroTier have a no cost plan for up to 100 hosts. Setup was very simple using the instructions on the download page. Once both the VPS and the Raspberry Pi had ZeroTier clients installed, I was able to proceed with configuring Apache web servers.

Reverse Proxy

Apache needed to be configured as a reverse proxy on the VPS in order to be able to connect to the Raspberry Pi from any routable IP. This required the Apache modules mod_proxy and mod_proxy_html to be enabled. This is simple enough on Debian based distributions using the a2enmod command. Then I simply enabled the following vhost in Apache using a2ensite. 192.168.196.XXX is the IPv4 address given to the Raspberry Pi by Zerotier.

<VirtualHost *:80>
    ProxyPreserveHost On

    ProxyPass / http://192.168.196.XXX/
    ProxyPassReverse / http://192.168.196.XXX/

    ServerName technotes.torrkulla.net
</VirtualHost>

Apache on Raspberry Pi

A simple sudo apt install apache2 later Apache was running on the Raspberry Pi and I was able to view the Apache default page via the virtualhost created on the VPS. The following step was to create a named virtual host technotes.torrkulla.net on the Raspberry Pi to host this blog. Given the original Raspberry Pi’s low memory, I settled on Hugo as a simple CMS.

Let’s Encrypt

Nothing more than certbot --apache -d technotes.torrkulla.net on the VPS was needed to set up TLS for the virtual host. ZeroTier encrypts the connections between hosts, so there was no need to have TLS in Apache on the Raspberry Pi.

Conclusion

After a few simple steps I have the infrastructure available to continue with remotely available data logging applications on a remote Raspberry Pi.