diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 126 |
1 files changed, 78 insertions, 48 deletions
@@ -1,6 +1,6 @@ # My Homelab Setup -**This is still very much un-stable, and very much a work-in-progress.** +**This is project is now somewhat stable but still a work-in-progress.** So I decided to migrate *most* of my remote VPS to a self-hosted private server. There are 3 reasons for this: 1. Cost savings. VPS SSD storage can get quite [expensive](https://racknerd.com/kvm-vps) as your storage demands increase. Meanwhile I have a few SSDs lying my house around not being utilized. @@ -14,13 +14,14 @@ My requirements are as follows: | | Email | n/a | | :heavy_check_mark: | Syncing/Sharing files, calender, contacts, tasks etc. | [Nextcloud](https://nextcloud.com/) | | :heavy_check_mark: | Hosting misc. static websites | [Nginx](https://www.nginx.com/) | -| :heavy_check_mark: | Media (pictures, tv, movies) Server | [Jellyfin](https://jellyfin.org/) | +| :heavy_check_mark: | Media (pictures, tv, movies) Server | [Plex](https://plex.tv) or [Jellyfin](https://jellyfin.org/) | | :heavy_check_mark: | Meta Search Engine | [Searxng](https://docs.searxng.org/) | | :heavy_check_mark: | Music Server | [Navidrome](https://www.navidrome.org/) | | :heavy_check_mark: | Network accessible storage for media | [Samba](https://www.samba.org/) | | :heavy_check_mark: | Password Hosting/Share | [Bitwarden](https://bitwarden.com/) | | :heavy_check_mark: | VPN | [Wireguard](https://www.wireguard.com/) | | :heavy_check_mark: | Torrents | [Transmission](https://transmissionbt.com/) | +| :heavy_check_mark: | Photo sharing | [Photoprism](https://photoprism.app) | | :heavy_check_mark: | Media downloader | [Sonarr](https://github.com/Sonarr/Sonarr), [Radarr](https://github.com/Radarr/Radarr), [Prowlarr](https://github.com/Prowlarr/Prowlarr) | > Consider items marked as :heavy_check_mark: above to be implemented in this repo. @@ -32,7 +33,7 @@ I don't want it to have much of an impact on my utility (power) bill, which of c so much heat that it requires advanced cooling. ## Architecture - + Notice that this setup requires a very small VPS since we are just running a wireguard client on it. All storage, and compute is being done by the Home Server. This means that my cost went from ~ $13/mo to ~ $1/mo for the VPS service, *while* increasing my SSD storage capacity from 50GB to 2TB (or whatever you have lying around)! And this does not incude the cost savings from self-hosting many of these services in the first place. @@ -46,71 +47,99 @@ There are many cheap VPS providers out there. I use Racknerd now. I have used Vu ## Pre-requisites ### Equipment -1. Raspberry Pi 4B (4GB). -2. USB Hub with **with its own power source**. -3. 2 X TiB external usb SSDs or HDDs for our network-attached-storage (NAS). -4. (optional, but recommended) 1 external usb SSD or HDD as a backup drive. -5. A very cheap VPS - I use Racknerd. +> The equipment I use reflect my current priorities and have changed since this project started and will +continue to change in the future. + +#### NAS Equipment +A [ROCKPro64](https://wiki.pine64.org/wiki/ROCKPro64) 4G model. +Alternatively, an RPi4 or similar would also work if you can get your hands on it. + + +There are many reasons why this board is awesome: +1. In Stock. +2. Similar price/performance/energy usage as the RPi4. +3. PCIe slot!! + +My main reason for switching to this board is the final point above :) +Speaking of the PCIe slot, we can get a PCIe SATA adapter to connect to two SATA drives. + + + +To power the drives, Pine64 all sells power cables: + + + +The drives themselves are 4 TiB 3.5in 5400 RPM CMR such as: + + + +> 7200 RPM drives are more expensive and I won't be pushing this hard enough to notice the benefits. + +> Note there will be cheaper drives using SMR, but I'd recommend CMR is worth the extra cost. + +Remember to buy drives that are not made as part of the same batch, so that the probabity of them +dying together is the lowest. You can also do this by buying different brands. + +Also remember to buy an extra set so that you save yourself some panic during recovery. + +When using the dual SATA adapter, Pine64 recommends a beefier 12V 5A power-supply: + + + +Since this is basically a NAS build, I opted to house all of this in: + + + + +Which comes included with a fan, and the SATA power-cables. + +#### Backup Equipment +An external USB SSD or HDD as a backup drive. + +#### VPS +A VPS (Virtual Private Server) - I use Racknerd. This will give you access to a reliable static IP. ### Base Image setup -For numerous reasons, I have switched to using Alpine Linux `aarch64` as the base OS image. -Going forward this repo will primarily be geared towards it. -That being said, all existing roles will continue to work on Raspi OS (debian) based images as well. - -1. Follow instructions from [Alpine wiki](https://wiki.alpinelinux.org/wiki/Raspberry_Pi) to create a bootable SD card. -2. During the `setup-alpine` process, select the **sys** mode for a persistent install. -3. Reboot -4. -```bash -# TODO: Make these tasks part of an Ansible role. -echo "dtoverlay=gpio-fan,gpiopin=14,temp=70000" > /boot/usercfg.txt - -# enable community packages in /etc/apk/repositories -# enable http://dl-cdn.alpinelinux.org/alpine/edge/testing -apk update -apk upgrade -apk add vim nnn htop bmon rsync py3-pip -apk add wireguard-tools docker docker-compose certbot -modprobe wireguard -# add wireguard to /etc/modules # - -# docker stuff -addgroup username docker -rc-update add docker boot -service docker start -``` -5. Continue to the NAS Setup section. +Once you have a server+storage, and a VPS, you are ready to start. +I have switched to using DietPi images (from Alpine) as they support my hardware, as well as RPis. + +1. Follow instructions from [DietPi wiki](https://dietpi.com/docs/install/) to create a bootable SD card and boot up. +2. On first boot, I recommend you change your `root` password, and change the SSH server to use OpenSSH (from Dropbear). +This makes running automation against it easier. +3. Then you can run our playbook with the `base` tag to install all pre-requisite software. +See the Install section below for getting started with running playbooks from this repo. +4. You should then setup your drives according to your needs. If you are doing ZFS, the section below might be useful. +4. Then see the Deploy section below to start deploying your apps! ### NAS Setup -As a minimum, I recommend setting up two of the external usb drives as a ZFS mirrored pool. +I recommend setting up the two drives as a ZFS mirrored pool. This will allow you to lose up to one drive at a time, and still operate in a degraded state while you replace it. ```bash -# install zfs -apk add udev zfs -modprobe zfs -# add zfs to /etc/modules # +# Install zfs (the base role will do this for you if using a rockpro64) +# Otherwise there are usually two steps: +# 1. Install the kernel headers for your kernel. +# 2. Install the zfs-dkms, and zfsutils-linux packages. + # verify install zfs --version -rc-update add udev sysinit -rc-update add udev-trigger sysinit # assuming your first drive is /dev/sda -zpool create yourpool /dev/sda -zpool export yourpool -zpool import -d /dev/disk/by-id/usb-Samsung_PSSD_T7_Shield_S6SMNS0T701007V-0:0-part1 yourpool -N +# get the ids -> /dev/sdX mapping of your disks by +ls -al /dev/disk/by-id/ +# using ids is recommened because then zpool status will instantly tell you +# which disk in reality is problematic, rather than sda,sdb etc. +zpool create yourpool mirror /dev/disk/by-id/yourdisk1 /dev/disk/by-id/yourdisk2 zfs set mountpoint=/mnt/yourpool yourpool # create datasets zfs create yourpool/media zfs create yourpool/data # for encrypted datasets zfs create -o encryption=on -o keylocation=prompt -o keyformat=passphrase yourpool/priv -# add the second drive to the pool -zpool attach yourpool usb-Samsung_PSSD_T7_Shield_S6SMNS0T701007V-0:0 usb-Samsung_PSSD_T7_S5T3NJ0N907662T-0:0 # zfs useful cmds -zpool scrub yourpool zpool status -v yourpool +zpool scrub yourpool zfs get mountpoint zfs mount -l yourpool/data zfs mount -l yourpool/media @@ -218,3 +247,4 @@ echo "-------Backup ended-------" ## Why self-host? You can read more about my thoughts on why we should self-host on my [website](https://kumardamani.net). +If this repo has helped you, consider [sending](https://kumardamani.net/#donate) a coffee my way! |
