diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..57e1438 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +# VPN Configuration +WIREGUARD_PRIVATE_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX= +WIREGUARD_ADDRESSES=000.000.000.000/32 +SERVER_CITIES=Anytown + +# Gluetun Configuration +GLUETUN_SUBNET=172.20.20.0/24 +GLUETUN_IP=172.20.20.2 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56d7c34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +docker-compose.yaml +data/ +config/ +.idea/ +.env \ No newline at end of file diff --git a/README.md b/README.md index a9cd928..36e2778 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ -# autopirate +# 🏴‍☠️ autopirate 🏴‍☠️ +___ +## Overview + +The complete autopirate setup! Easily monitor, download, and serve content to your home theater setup. + +## Pre-requisites + +- [Docker](https://docs.docker.com/get-docker/) +- [Docker Compose](https://docs.docker.com/compose/install/) + +## How-To + +- Clone this repo +- Copy `.env.example` to `.env` and fill in the values +- Run `source ~/.env` +- Run `./patch_compose.sh` to patch the compose file with your local user ID and group ID +- Run `docker-compose up -d` to start the stack + + +## Credentials + +1. Deluge: + - Username: `admin` +2. Prowlarr: + - Username: `admin` + - Password: `admin` + +## Future Improvements + +Would be good to add [tdarr]() to the stack so that we can automatically re-encode content to more efficient +containers/codecs (e.g. HEVC). This would be a good way to reduce the size of the library and save space on the +NAS / server. + +Would be good to add [tautulli]() to the stack so that we can monitor the Plex server \ No newline at end of file diff --git a/docker-compose.yaml.tmpl b/docker-compose.yaml.tmpl new file mode 100644 index 0000000..2a5dc53 --- /dev/null +++ b/docker-compose.yaml.tmpl @@ -0,0 +1,205 @@ +version: "3.9" + +networks: + htpc: + ipam: + driver: default + config: + - subnet: {{GLUETUN_SUBNET}} + +services: + gluetun: + image: qmcgaw/gluetun + networks: + htpc: + ipv4_address: {{GLUETUN_IP}} + cap_add: + - NET_ADMIN + devices: + - /dev/net/tun:/dev/net/tun + ports: + - 8888:8888/tcp # HTTP proxy + - 8388:8388/tcp # Shadowsocks + - 8388:8388/udp # Shadowsocks + - 8989:8989/tcp # Sonarr + - 7878:7878/tcp # Radarr + - 8787:8787/tcp # Readarr + - 9696:9696/tcp # Prowlarr + - 8080:8080/tcp # SABnzbd + - 8112:8112/tcp # Deluge + - 32400:32400/tcp # Plex + - 5055:5055/tcp # Overseerr + volumes: + - ${PWD}/config/gluetun:/gluetun + environment: + # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup + - VPN_SERVICE_PROVIDER=mullvad + - VPN_TYPE=wireguard + - WIREGUARD_PRIVATE_KEY={{WIREGUARD_PRIVATE_KEY}} + - WIREGUARD_ADDRESSES={{WIREGUARD_ADDRESSES}} + - SERVER_CITIES={{SERVER_CITIES}} + - PUID=501 + - PGID=20 + - TZ=America/Halifax + - UPDATER_PERIOD=24h + + sonarr: + image: linuxserver/sonarr:latest + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/sonarr + target: /config + - type: bind + source: ${PWD}/data/downloads + target: /downloads + - type: bind + source: ${PWD}/data/media/tv + target: /media/tv + restart: unless-stopped + + radarr: + image: linuxserver/radarr:latest + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/radarr + target: /config + - type: bind + source: ${PWD}/data/downloads + target: /downloads + - type: bind + source: ${PWD}/data/media/movies + target: /media/movies + restart: unless-stopped + + readarr_audiobooks: + image: lscr.io/linuxserver/readarr:develop + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/readarr_audiobooks + target: /config + - type: bind + source: ${PWD}/data/downloads + target: /downloads + - type: bind + source: ${PWD}/data/media/audiobooks + target: /media/audiobooks + restart: unless-stopped + +# TODO: Find out how to map multiple readarr instances using gluetun... not obvious b/c they use the same port +# readarr_books: +# image: lscr.io/linuxserver/readarr:develop +# network_mode: "service:gluetun" +# environment: +# - PUID={{PUID}} +# - PGID={{PGID}} +# - TZ=America/Halifax +# volumes: +# - type: bind +# source: ${PWD}/config/readarr_books +# target: /config +# - type: bind +# source: ${PWD}/data/downloads +# target: /downloads +# - type: bind +# source: ${PWD}/data/media/books +# target: /media/books +# restart: unless-stopped + + prowlarr: + image: lscr.io/linuxserver/prowlarr:latest + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/prowlarr + target: /config + restart: unless-stopped + + overseer: + image: lscr.io/linuxserver/overseerr:latest + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/overseer + target: /config + restart: unless-stopped + + sabnzbd: + image: linuxserver/sabnzbd:latest + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/sabnzbd + target: /config + - type: bind + source: ${PWD}/data/downloads + target: /downloads + restart: unless-stopped + + deluge: + image: linuxserver/deluge:latest + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + volumes: + - type: bind + source: ${PWD}/config/deluge + target: /config + - type: bind + source: ${PWD}/data/downloads + target: /downloads + restart: unless-stopped + + plex: + image: 'lscr.io/linuxserver/plex:latest' + network_mode: "service:gluetun" + environment: + - PUID={{PUID}} + - PGID={{PGID}} + - TZ=America/Halifax + - VERSION=latest +# Uncomment the following lines if you want to use hardware transcoding (Intel QuickSync) +# devices: +# - '/dev/dri:/dev/dri' + volumes: + - type: bind + source: ${PWD}/config/plex/config + target: /config + - type: bind + source: ${PWD}/config/plex/tmp + target: /tmp + - type: bind + source: ${PWD}/config/plex/transcode + target: /transcode + - type: bind + source: ${PWD}/data/media + target: /media + restart: unless-stopped diff --git a/patch_compose.sh b/patch_compose.sh new file mode 100755 index 0000000..3b1dc89 --- /dev/null +++ b/patch_compose.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +if [ ! -f .env ]; then + echo "Please create a .env file" + exit 1 +fi +source .env + +# User / Group ID will be determined automagically +id_output=$(id) +PUID=$(echo "$id_output" | awk -F'[=|(]' '{print $2}') +PGID=$(echo "$id_output" | awk -F'[=|(]' '{print $4}') + +# Create the necessary folders +mkdir -p data/downloads/{complete,incomplete,sonarr,radarr,readarr_audio,readarr_book,torrents} +mkdir -p data/media/{tv,movies,books,audiobooks} +mkdir -p config/{deluge,gluetun,overseer,prowlarr,radarr,readarr_audiobooks,readarr_books,sabnzbd,sonarr} +mkdir -p config/plex/{tmp,config,transcode} + +if [[ "$OSTYPE" == "linux-gnu" ]]; then + SED="sed" +elif [[ "$OSTYPE" == "darwin"* ]]; then + SED="sed -i ''" +else + echo "Unsupported operating system" + exit 1 +fi + +cp docker-compose.yaml.tmpl docker-compose.yaml + +eval "$SED \"s/{{PUID}}/$PUID/g\" docker-compose.yaml" +eval "$SED \"s/{{PGID}}/$PGID/g\" docker-compose.yaml" +eval "$SED \"s/{{WIREGUARD_PRIVATE_KEY}}/$WIREGUARD_PRIVATE_KEY/g\" docker-compose.yaml" +WIREGUARD_ADDRESSES_ESC=$(echo "$WIREGUARD_ADDRESSES" | sed 's/\//\\\//g') +eval "$SED \"s/{{WIREGUARD_ADDRESSES}}/$WIREGUARD_ADDRESSES_ESC/g\" docker-compose.yaml" +eval "$SED \"s/{{SERVER_CITIES}}/$SERVER_CITIES/g\" docker-compose.yaml" +GLUETUN_SUBNET_ESC=$(echo "$GLUETUN_SUBNET" | sed 's/\//\\\//g') +eval "$SED \"s/{{GLUETUN_SUBNET}}/$GLUETUN_SUBNET_ESC/g\" docker-compose.yaml" +eval "$SED \"s/{{GLUETUN_IP}}/$GLUETUN_IP/g\" docker-compose.yaml"