diff options
| author | Kumar Damani <me@kumardamani.net> | 2022-08-23 16:02:28 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2022-09-07 20:15:37 +0000 |
| commit | c85806e3289b5e207d51d382f8dc75edad04404d (patch) | |
| tree | 244d2f1ad38320863fb60f695c88c97799be1171 /README.md | |
| parent | 4d34de2f5e757bfeae5738547aabb61d3d28a2f8 (diff) | |
switched to alpine initial commit
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 128 |
1 files changed, 112 insertions, 16 deletions
@@ -1,4 +1,4 @@ -# My VPS Setup +# My Homelab Setup **This is still very much un-stable, and very much a work-in-progress.** @@ -9,17 +9,19 @@ So I decided to migrate *most* of my remote VPS to a self-hosted private server. My requirements are as follows: -| Status | Feature | Choice | -| ------------------ | ------------------------------------------- | --------------------------------------- | -| | Email | n/a | -| :heavy_check_mark: | Hosting/Sharing files, calender, 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: | 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/) | +| Status | Feature | Choice | +| ------------------ | ------------------------------------------- | ------------------------------------------- | +| | Email | n/a | +| :heavy_check_mark: | Hosting/Sharing files, calender, 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: | 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: | 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. > You may notice more [roles](./roles) than listed here. This is due to me trying other options for that feature, eg. "seafile" for file hosting. Feel free to use that instead. @@ -36,8 +38,92 @@ Notice that this setup requires a very small VPS since we are just running a wir There are many cheap VPS providers out there. I use Racknerd now. I have used Vultr previously. Both are good in-terms of technical support. +## 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. + +### 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 +/boot/usercfg.txt +dtoverlay=gpio-fan,gpiopin=14,temp=70000 + +# 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. + +### NAS Setup +As a minimum, I recommend setting up two of the external usb 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 # +# 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 +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 +zfs get mountpoint +zfs mount -l yourpool/data +zfs mount -l yourpool/media +zfs mount -l yourpool/priv # will prompt for passphrase +``` + +At the end of this, you should at least have `/mnt/yourpool/media` and `/mnt/yourpool/data`. +These will be auto mounted at boot. +These are the volumes assumed by our Ansible playbooks as `vol_media`, and `vol_data` - see the hosts file. + ## Monitoring - +I'd like to monitor the following: +- Basic cpu, mem, disk metrics. +- Service level metrics with alerts when a service is down. +- ZFS metrics. +- CPU temp, Power consumption etc. + + You can get this dashboard [here](https://grafana.com/grafana/dashboards/15980). ## Install @@ -106,7 +192,17 @@ deploy-job: ``` > You need to have the vars `VAULT_PASS`, and `SSH_PRIVATE_KEY` set in the CI/CD settings for each such repo. +## Example backup script +```bash +#!/bin/sh + +doas mkdir -p /mnt/backup +doas chown -R 1000:1000 /mnt/backup +rsync -avph --info=progress2 /mnt/kdpool/media/media /mnt/backup/ +rsync -avph --info=progress2 /mnt/kdpool/media/pics /mnt/backup/ +rsync -avph --info=progress2 /mnt/kdpool/media/music /mnt/backup/ +``` + ## Future Plans -1. Documentation for each role. -2. Backups. -3. Redundancy. +1. Pi Hole (in progress). +2. Better docs for each role. |
