diff options
| -rw-r--r-- | README.md | 62 | ||||
| -rw-r--r-- | playbooks/deploy.yaml | 25 |
2 files changed, 50 insertions, 37 deletions
@@ -9,23 +9,28 @@ 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/) | -| :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) | +| Status | Feature | Choice | +| ------------------ | ----------------------------------------------------- | ------------------------------------------- | +| | 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: | 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. +Ideally, I would also like to be space efficient as I currently don't have space for a proper server-rack. +I don't want it to make a lot of (any?) noise. +I don't want it to have much of an impact on my utility (power) bill, which of course also implies that it should not generate +so much heat that it requires advanced cooling. + ## Architecture  @@ -57,8 +62,8 @@ That being said, all existing roles will continue to work on Raspi OS (debian) b 3. Reboot 4. ```bash -/boot/usercfg.txt -dtoverlay=gpio-fan,gpiopin=14,temp=70000 +# 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 @@ -131,7 +136,7 @@ You can get this dashboard [here](https://grafana.com/grafana/dashboards/15980). 2. Clone you fork with `git clone` 3. Change directory to this repo `cd vps`. 4. Setup repo by running all of the following: -```sh +```bash # install dependencies for this project in a venv make install # remove my vault files @@ -150,17 +155,15 @@ cp -a group_vars/all/vault.example group_vars/all/vault 5. Modify the [vars](./group_vars/all/vars.yaml/) file per your needs. Encrypt your hosts file, and secret vars before uploading to git: -```sh +```bash ansible-vault encrypt --vault-id vaultid --output hosts.vault hosts ansible-vault encrypt --vault-id vaultid --output group_vars/all/vault group_vars/all/vault ``` ## Deploy -```sh -# run main playbook with "base" tag -make file=playbooks/deploy.yaml tags="base" +```bash # run main playbook with your apps -make file=playbooks/deploy.yaml tags="[csv list]" +make file=playbooks/deploy.yaml tags="[tag list]" # (and if applicable secondary playbook) make file=playbooks/vps.yaml ``` @@ -187,7 +190,7 @@ deploy-job: - cd vps - echo $VAULT_PASS > vaultid - make install - - make run file=playbooks/deploy.yaml tags="website" args="-v" + - make run file=playbooks/deploy.yaml tags="websites" args="-v" - echo "Application successfully deployed!" ``` > You need to have the vars `VAULT_PASS`, and `SSH_PRIVATE_KEY` set in the CI/CD settings for each such repo. @@ -198,11 +201,20 @@ deploy-job: 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/ + +echo "" +echo "------Backup started------" +echo `date` +echo "--------------------------" +rsync -avph --delete --info=progress2 /mnt/kdpool/media/media /mnt/backup/ +rsync -avph --delete --info=progress2 /mnt/kdpool/media/pics /mnt/backup/ +rsync -avph --delete --info=progress2 /mnt/kdpool/media/music /mnt/backup/ +echo "-------Backup ended-------" ``` ## Future Plans 1. Pi Hole (in progress). 2. Better docs for each role. + +## Why self-host? +You can read more about my thoughts on why we should self-host on my [website](https://kumardamani.net). diff --git a/playbooks/deploy.yaml b/playbooks/deploy.yaml index 53c315a..08af211 100644 --- a/playbooks/deploy.yaml +++ b/playbooks/deploy.yaml @@ -1,18 +1,20 @@ # Usage: -# ansible-playbook -i hosts playbooks/deploy.yaml --vault-id vaultid --tags [] +# make run file=playbooks/deploy.yaml tags="" # -# Tags: -# ddclient, wireguard, nginx, websites, samba -# nextcloud, bitwarden, searxng, monitoring (these all depend on the nginx tag) +# Dry Run: +# make dry-run file=playbooks/deploy.yaml tags="" +# +# Available tags: +# ddclient, wireguard, nginx, websites, +# samba, nextcloud, bitwarden, searxng, +# monitoring, transmission, media_downloader # # Install: -# git submodule update --remote --merge -# python3 -m venv ~/venv/ansible -# source $HOME/venv/ansible/bin/activate -# pip install --upgrade pip -# pip install 'ansible<2.10' 'jmespath' -# ansible-galaxy install -r requirements.yml -# ansible-galaxy collection install -r requirements.yml +# make install +# +# ASSUMPTIONS: +# You should already have docker installed. +# See the README.md for base image setup section. # --- @@ -76,7 +78,6 @@ samba_user_pass: '{{ vault_samba_password }}' samba_data_root: '{{ vol_media }}' - ## Docker Services ## - hosts: compute |
