All-in-one Raspberry Pi Media box handling torrents, game streaming, media and storage. VESA mounted on the back of the Telly with external HDD.
Featuring:
- Moonlight streams games from desktop PC
- DLNA server used for watching movies/TV on smart TV or laptop
- Torrents through VPN
- Sonarr/Radarr/Jackett for searching and downloading torrents
- Airsonic for music streaming i.e. replace google music
- SAMBA network drive for media
- Syncthing for backing up
- beets for music collection organising
- Raspberry Pi 4GB
- WD Elements 2TB HDD WDBU6Y0020BBK
- 40mm fan and heatsink (I used this one )
- Push buttons and an LED
- 3D print case, lids and button holder
- Power, HDMI and Ethernet cable
- USB Hub for controllers (This one worked ok)
RPi 4 with 2TB USB3 HDD, this was cheaper than SSD but cannot use two HDDs at once due to power limitations so will run into problem if expansion needed.
Case is based on this excellent case with accompanying 40 mm fan and heatsink, expanded to house the HDD and fit 200 mm VESA screw holes. The STEP, STL and 3mf for PrusaSlicer files are found in cad
folder. Printed with 3 perimeters, no top or bottom layers and with hexagonal infill. I connected used 3.3 V rather than to reduce noise.
Two push buttons and an indicator LED was added to easily shutdown the Pi and also to start Moonlight streaming. Many ways of starting program at boot detailed here
Doesnt need GUI and needs to run as root so add the following line to rc.local
before the line exit 0
to run at startup.
sudo /usr/bin/python3 /home/pi/PiNAS/code/shutdown.py &
Currently the Moonlight-qt button does not start properly, so it uses moonlight embedded (defaulting to Steam). This requires using systemd to get GUI working and to run as pi user (for configs etc.). Combination of the guide here and PiDocs. Created service file /etc/systemd/system/BTN.service
:
[Unit]
Description=Get Button listening service running at boot
[Service]
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
ExecStart=/usr/bin/python3 /home/pi/PiNAS/code/moonlight.py
Restart=always
StandardOutput=inherit
StandardError=inherit
SyslogIdentifier=BTN
User=pi
Group=pi
KillMode=process
TimeoutSec=infinity
[Install]
WantedBy=graphical.target
The are many steps to this! I have included the ones I can remember and what guides I used to help me.
- SSH key for remote access Pi Docs and copying keys
- Added SSH key to Putty by converting to puttykey through puttygen
.ppk
file needed for FTP in Filezilla too- VNC server using ssh key here needed to add IP address in tunnelling settings in Putty due to ssh key
- Unattended upgrades
- Fail2ban, UFW.
- Install Docker and Docker-compose. Remember to use container names not IP addresses for ports and containers in same network. i.e. 192.168.1.1:4040 should be jacket:7878.
- Mount NTFS drive automatically (I wanted to be able to use the drive in my PC incase of problems so kept it NTFS) Pidocs
- Add SAMBA share 1 2 ADD UFW RULE. Needed to add smb client in windows 10
- DLNA player 1 2 ADD UFW RULE! Added reference to
poster.jpg
andfanart.jpg
in album art as thats what Sonarr and Radarr use ncdu
for checking folder size- On laptop added music folder as samba network drive. Fine to use but indexing was slow in Foobar
- NordVPN - needed to use the service credentials user and pass as mentioned here
- Use backport for docker related package to fix Radarr, Plex and NGinx here
- Docker-Deluge Runs Deluge in a container with VPN, ensures all torrent traffic goes through VPN. Possible that docker continuously cannot find a config file for the server, in which case you should rebuild the container, or copy across new configs.
- Web access through port
8112
. - Change password and set move completed downloads to
completed
folder. - Set watch folder for torrents, then point jackett to this.
- Torrent setup, largely based on this.
- Add RuTracker and set blackhole directory in Jackett.
- Add indexers to Sonarr/Radarr remember to use
Jackett
instead of IP i.e.http://jackett:9117/api/v2.0/indexers/thepiratebay/results/torznab/
- Add Deluge as Download client remember to use
delugevpn
(the container name from above) as the ip/host - Bazarr used OpenSubtitles.org
- Web access through port
Install syncthing guide
Current only backup music folder. I dont expose the port externally instead use use ssh port forwarding ssh -L 9090:127.0.0.1:8384 [email protected]
- Used Airsonic behind NGinx server following this great guide
- I used duckDNS for the DNS
- Opened Ports on Router
- Moonlight-qt install guide. I like this better than moonlight embedded as it allows multiple apps to open like steam/retroarch and changing stream settings in app. Remember to increase GPU memory
- Moonlight embedded repo guide. Command is
moonlight stream -1080 -bitrate 50000 -remote -quitappafter -app Steam
It defaults to steam, but can swap to-app retroarch
etc. working with steam, retroarch, psnow and pcsx2 - Steam Link - I found moonlight better but useful for checking network and controllers