Giter VIP home page Giter VIP logo

pinas's Introduction

PiNAS ฯ€๐Ÿ’พ ๐Ÿ†๐Ÿ“

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

Parts used

  • 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)

Hardware Setup

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.

Shutdown and game stream buttons

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

Shutdown Button

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 &

Moonlight Button

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

Software Setup

The are many steps to this! I have included the ones I can remember and what guides I used to help me.

Networking and security

  • 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.

Media Setup

  • 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 and fanart.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

Torrents

  • 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

Cloudstorage/backup

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]

Music Streaming or Google Music Replacement

Video Game Streaming

  • 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

Controllers

  • PS3 Dual Shock wired
  • Xbox 360 Wired drivers
  • Xbox Series X controller drivers, working wired, but bluetooth would not work, a common issue with these workaround was found here
  • jstest useful to check controller inputs

pinas's People

Contributors

jimbles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.