Raspberry Pi Self-Hosting Server
Overview
Long history: Somewhat of a consolidation project. We have had a number of network services running on various RPI's over the years - Ad blocking, IoT Bridge services, network monitors, media servers, etc. Somewhat of a rats-nest as playthings come and go.
ServerPi is an attempt to organize this mess by creating a home server environment that can be used to host long-standing network services and as a foundation for future self-hosted apps. Including a friendly web-interface for family/nontechie access.
ServerPi: Multi Purpose Home Server
Original: 2020, 2021, 2022, 2023
Last Update: August 2024: Internal/External. DietPi Update
Background & Capabilities
ServerPi was initially built to replace our undocumented NetAidPi, which was a very old RPI (Model B!) that had been running on the network for quite a long time (Pi-hole, Murmer and some other services that I didn't even remember!).
It ultimatly become THE SINGLE home for our network services, including Apple Homekit (replacing HomePi), Pi-Hole and many more.
It was ultimatly cloned and is now run on two subnets to limit services offered to IOT devices (Pi-Hole, Homebridge)
... will likely continue to evolve ...
Level of Difficulty & Prep Time
Some networking knowledge is required (e.g. Static vs dynamic addressing, TCP ports, etc). Basic Linux administration skills will also come in handy (navigating the filesystem, editing config files, etc).
Simple setup via Dietpi. Probably <1 hour to get foundational ServerPi up and running.
Additional time will vary depending on complexity of software installed on top of DietPi.
Hardware
ServerPi was built using spare parts (as usual).
Current hardware looks a little like this:
Case w/ Fan, Heatsinks & 3A Power Supply* - $12 in Oct 2018
Raspberry Pi 3 B+ Motherboard* - $37 in Oct 2018
32g Sandisk Ultra Plus* - $17 in 2018
Ethernet connect
*Note: Affiliate Links, I may get kickback from Amazon if you click/buy!
Software
Here's the what/why of our ServerPi:
Dietpi.com - Currently ARMv8/Bookworm (Donate!)
Dietpi optimized Software:
DietPi-Dashboard: Raspberry Pi System/Network Monitor
Pi-Hole: Local DNS server and Network-wide Ad Blocker
Homebridge: Apple Homekit Bridge (Replaced HomePi)
Grafana: UI for Home Network Metrics (SentinelPi)
Homer: Simple Homepage
ProFTPD: FTP Server
Lighttpd: Web Server
Step By Step
DietPi Install
Foundational OS Prep (DietPi IS RaspOS) with some handy optimized packages ...
Downloaded latest DietPi via https://dietpi.com/#download and followed along with latest Installation Guide
// Used DietPi_RPi-ARMv8-Bullseye.7z (~135 MiB Download) //Easiest to start DietPi install with Ethernet, keyboard & monitor then switch to ssh after first boot
Login (root/dietpi), wait for updates ... then ... Change passwords & Disable serial/UART (~5min)
Couple of configuration tweaks via Dietpi-Config utility (in menu). Minimally, set the following:
DietPi-Config/Language&Regional->Local=en.US.UTF-8 + Timezone + Keyboard[us]
// Season to taste, keyboard and country - IF not already done //DietPi-Config/Network Adapters-> Ethernet
// Set static IP for Ethernet adapter, we will need it for Pi-hole //DietPi-Config/Security Options->Change Hostname
// Changing Hostname will force reboot //SSH Server->OpenSSH
Reboot here and ssh in for the rest of this
DietPi Software
After boot, run through dietpi-software to setup ServerPi packages ... this was done in stages because major packages had a quite a few dependencies & choices. Simply an attempt to find sequence that worked best ...
Stage 1 -Some Foundational software. Dietpi would install many of these but I like to know/control some of this stuff This also installs web & DB servers and PHP
82 LLMP: Lighttpd + MariaDB + PHP
152 Avahi-Daemon: Hostname broadcast via mDNS (Zeroconf, Bonjour)
Stage 2 - A few other HomeNet and Self-Hosting helpers
... Homer, ProFTPD, DietPi-Dashboard and grafana (so it is in only one place on our network)
77 Grafana: platform for analytics and monitoring
94 ProFTPD: Efficient, lightweight FTP server
200 DietPi-Dashboard: Official lightweight DietPi web interface (Rust)
205 Homer: Simple HOMepage for your servER to keep your services on hand
50 Syncthing: Backup and sync server with web interface
Stage 3 - These guys need to be acessible to IOT Devices
211 Homebridge: Bringing HomeKit support where there is none
... Pi-hole otes (so I don't forget). Our Pi-Hole setup is on phys eth0, not docker. Static IP
93 Pi-hole: block adverts for any device on your network
Unbound = Yes (Tiny DNS server, locally hosted)
DNS Provider - Quad9 unfiltered no DNSSEC = 9.9.9.9 (I think)
Include 3rd Party lists
Privacy = Show Everything
Installation Summary: Check it and make note of initial admin PW - it's easy to miss !
Block Public access to admin console
Finally ... a few non-dietpi add-ons
apt-get install joe (my fav editor)
<something else ... I'll remember>
Pull it all Together
Here's whats/where at this point (ports):
ProFTPD is on port 21
DietPi-Dashboard @ http://<ServerPi-IP>:5252
grafana @ http://<ServerPi-IP>:3001
Pi-Hole @ http://<ServerPi-IP>/admin
Homer @ http://<ServerPi-IP>homer
Lighttpd (Web Server) on Port 80. Placeholder Page @ http://<ServerPi-IP>/
Homebridge (Apple Homekit). Web interface @ http://<ServerPi-IP>:8581
Syncthing @ http://<ServerPi-IP>:8384
Samba Server @ Address = \\<ServerPi-IP>>\dietpi
A few app touchups:
ProFTPD: Config @ /etc/proftpd/proftpd.conf.
Season to taste (RootLogin, DefaultRoot, etc)
DietPi-Dashboard: Config @ /opt/dietpi-dashboard/config.toml
Set security (password protection)
Additional nodes as needed to watch over other Pi's (HomePi, SentinelPi ...)
Grafana: Connect via http://<ServerPi-IP>:3001
uc/pw=admin/<yourdiepipw>
Add data sources and import dashboard(s) as needed. (e.g. access SentinelPi in our world)
Set Default Dashboard via Administration -> Default Preferences
PI-Hole: Connect via http://<ServerPi-IP>/admin
Login with password you remembered to record during install!
Homer to tie it all together: Config @ /var/www/homer/assets/config.yml
Worth the read: https://github.com/bastienwirtz/homer/blob/main/README.md
See also: https://github.com/bastienwirtz/homer/blob/main/docs/customservices.md
Migration Notes: Stuff to remember when moving after a rebuild. Don't forget /var/www!
/var/www/admin - is pi-hole admin, move at your own risk. May be best to install fresh
/var/www/homer
/var/www/html
/var/www/pihole
Homebridge:
First run "Getting Started" to set up Admin user
Homebridge @ https://homebridge.io/. Nice doc and help @ https://github.com/homebridge/homebridge/wiki
Homebridge UI Backup/Restore worked like a charm for the move from HomePi
Lighttpd: Config @ /etc/lighttpd/lighttpd.conf
Redirect default (/) homepage to homer (inserted right after server.document-root stuff)
# TPed was here - attempt to make homer startpage
# Redirect directive for default homepage
url.redirect = ("^/$" => "/homer/index.html")Also enabled directory listings so it displays files/directories stored under /var/www/html
# TPed was here again - enable directory listing
server.dir-listing = "enable"
Samba: Config @ /etc/samba/smb.conf
Notes & Log
Tweaks/Log
September 2024:
Cloned/Split ServerPi into 2. Original (Homebridge + Pi-Hole) on isolated IOT subnet, and New ServerPi (Homer, Syncthing, Grafana, samba ...) on private subnet
So I don't forget: nmap & ip html formatting
nmap
Save Scan Results as Nmap XML Format
Transform via: xsltproc <scanfile.xml> -o <scanfile.html>
Home net
Paste Unformatted text into 'PrettyNet"
Export/Save as XHTML
April 2024: New Internet connection! ServerPi gets Speedtest-Tracker and temporary upgrade to RPi4 for Gigabit Ethernet tests. Breadcrumbs in case I need to revisit:
Installed via ServerPi's Portainer using Docker Compose ... too easy! Disable when not in use.
Access via http://ServerPi:8080 ... login as admin@example.com/password
Homer Custom Service @ https://github.com/bastienwirtz/homer/blob/main/docs/customservices.md#SpeedtestTracker
Later in October .... Have to be careful to watch requirements of Homebridge plug-in's. Dietpi can't watch over these
Added ffmpeg via dietpi-software because I noticed Homekit cameras were not responding.
October 2023 - Rebuild with fresh Dietpi (Bookworm) because Homebridge is in Dietpi's list of optimized software!
Added Apple HomeKit Services to ServerPi's list of duties. HomePi has served it's time and ServerPi seemed to have plenty of horsepower. HomePi is now retired.
Eliminated Play-Stuff ... no docker/portainer (until needed), OwnCloud wasn't really needed since ServerPi will now remain relatively static, no grampsweb, etc
Migration to new ServerPi to ... pretty easy
Homebridge via UI: Download Backup on old, Restore backup on new!
Homer: FTP Drag 'n Drop
Sept 2023 - Figuring out Portainer ... using grampsweb (geneology). Deployed OK (watch for duplicate ports) but ate the PI alive!
Looked like memory usage and swapping/thrashing ... stopped/removed stacks, containers and frinds .... Will regroup
9/3/2023 - Added Avahi so we can find/access serverpi.local
[*] 152 Avahi-Daemon: Hostname broadcast via mDNS (Zeroconf, Bonjour)