Skip to content

About

Overkill media server setup

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Latest commit

 

History

216 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Media Server with Docker Compose

Caution

Due to a recent update you must use the .internal suffix for internal serviec name routing, such as http://vpn.internal:8888 - if you do not do this then they will not be able to connect! This needs to happen on all web-apps for all connections, and can safely be done before updating!

Important

This uses Cloudflare for incoming connections, NordVPN for outgoing, and Google Auth for logging in. If you cannot figure those out with help from google then this might not be the setup for you!

Warning

I do not use all of these services, so not everything is guaranteed to work.

Note

This is the barebones setup for a media server, it does not include any config (although over time I may add more documentation and templates explaining what to do).

image

Concept

Every service uses a similar folder layout, this includes having a config folder inside the service folder for easier backup and configuration.

When one service depends on another it should only be started first (with a couple of exceptions that require them to be healthy first).

There are some included scripts for use within various services directly - you do not need to install python or have anything more than bash available on the server.

Network

This has two networks defined in compose.yaml.

  • The internal network does not have internet access, and is used for inter-service communication. All routing into the stack should come through traefik which acts as a bridge between the two.

    [!IMPORTANT] You must use the .internal suffix to service names to route the connections over the internal network, without that they will not connect!

  • The external network allows for a service to contact the internet directly. (Ideally services should be using the http://vpn.internal:8888 service as an http(s) proxy instead.)

Installation

Run ./manage.sh for a menu that does most of this for you. It will install Docker if needed, make your .env and compose.override.yaml files, ask for the basic settings, and let you choose services from a grid (use the arrow keys and space to turn them on or off, and ? to see what a service does). Run ./manage.sh help to see the commands it has.

It is advised to use VSCode or similar that does syntax highlighting (ie, colors) for the files you edit!

To do it by hand instead:

Duplicate the .env.example file as .env, all configuration needs to go in here.

Create an empty compose.override.yaml file, and copy the commented block of include: services into it, then to enable a service you can simply uncomment that line. For some services have a look for included template files that want copying into theit config/ folders and renaming.

If you start things with docker compose up -d yourself, run ./manage.sh secrets first, and again after changing a secret in .env. Anything that is a password, key or token is passed to its container as a file rather than an environment variable, and these .secret.<NAME>.txt files (named after the .env value) are written into this folder from .env - ./manage.sh start and ./update.sh do this for you. They are files rather than Compose reading .env directly, as Compose copies those into a container when it is created, so anything that recreates a container (like Watchtower when updating) would lose them.

Service scripts

When a service is turned on with manage.sh, any *.template files in its folder are copied into place if they don't exist, with __ meaning a folder - so config__folder__my_file.ext.template becomes config/folder/my_file.ext. Values in .env.example of "<random>" are filled with a random value, and "<insert ...>" are asked for.

Service folders can also have their own scripts, named manage.enable.sh and manage.disable.sh to run when it's turned on or off, or manage.<name>.sh for a tool that can be run with ./manage.sh run <service> <name>. A tool is only offered while its service is turned on, or add a # Show when on: sonarr radarr comment near the top of it to show it when any of those are on instead.

Setting up the *arr apps

When Sonarr, Radarr, Lidarr, Chaptarr or Whisparr is turned on, it is started once so it makes its config.xml, then stopped while its authentication method is set to External (so the login in front of it is used instead) and its API key is copied to <APP>_API in .env for the homepage widget, then started again. If homepage is running it is restarted too so it picks up the key. If Docker wasn't running at the time, or to do it again later, run:

./manage.sh run sonarr setup

Moving the *arr apps to Postgres

Sonarr, Radarr, Lidarr, Chaptarr and Whisparr use SQLite to start with. To move them to Postgres, turn on postgres and run:

./manage.sh run postgres migrate

Choose which apps to move, or name them like ./manage.sh run postgres migrate sonarr radarr. Each app is stopped and backed up to its config/pre-postgres-<date> folder, then it creates its own tables in Postgres and your data is copied in with pgloader, following the Servarr guide. It checks every table has the same number of rows, and that the app can see them, before asking you to look in your browser. If anything fails, or you say no, the app is put back on SQLite as it was. Old logs aren't copied, and the old SQLite files are kept with .sqlite-old on the end.

It's safe to run again, apps already on Postgres are skipped. Once one has moved it offers to set USE_POSTGRES=true, so the *arr apps wait for Postgres when starting.

Backing up Postgres

Turn on postgres/compose.backup.yaml and the postgres-backup container backs up everything in Postgres every day at 04:00 to postgres/backup (change these with POSTGRES_BACKUP_SCHEDULE and POSTGRES_BACKUP_PATH). That's every user with their password, and every database with its owner, settings and permissions, so a restored Postgres works for the apps without changing anything.

Each backup is one file, like 2026-11-19_040000.tar. The databases inside are compressed with zstd, so the .tar itself isn't compressed again. backups.log lists every tested backup with its checksum, which is checked before a backup is tested or restored.

Each backup is tested before it's kept: the .tar is unpacked and restored into a throwaway Postgres, and the users, databases and the row count of every table have to match. It keeps the newest backup of each of the last 7 days, 4 weeks and 6 months. When the container starts it also backs up, if there isn't a tested backup for that day yet. The container shows as unhealthy in Homepage when there hasn't been a tested backup for 26 hours, and with gatus-private turned on each backup is reported there too, under "Backup", so a failed or missing backup shows as down.

./manage.sh run postgres backup now            # Back up and test now
./manage.sh run postgres backup list           # Show the backups
./manage.sh run postgres backup test [set]     # Test a backup again
./manage.sh run postgres backup restore [set]  # Replace Postgres with a backup

Restoring moves the current data to postgres/data.before-<date>, starts an empty Postgres, restores into it and checks it matches. If anything fails the old data is put back. Restart the apps that use Postgres afterwards.

Private status page

gatus-private is a second Gatus behind tinyauth, for things that shouldn't be on the public status page. Every service with a Docker healthcheck has a compose.gatus-private.yaml that shows it under "Healthcheck", and backups show under "Backup". These go on and off by themselves with ./manage.sh: turning on a service while gatus-private is on (or turning on gatus-private) turns on its compose.gatus-private.yaml too, and turning either off turns it off. Services inside the stack report to it on http://gatus-private.internal:8080, which doesn't go through tinyauth.

When nextcloud is turned on it asks for the API key (NC-Token) that the homepage widget uses, or makes a random one, and saves it as NEXTCLOUD_API. Nextcloud has to be running to be given the key, so once it has finished its first start run this to set it there too (also to change the key later):

./manage.sh run nextcloud api-key

Riding out power cuts

ups-power watches a UPS through NUT. On battery it pauses the containers that use the most power, hibernates the server before the battery runs out, and unpauses them once the power has been back for a while. It runs on the host itself rather than in Docker. See ups-power/README.md for setting it up and a plan for testing it.

Updating

Run bash update.sh to pull the latest version. Anything new in the example files is added to your .env, .env.keep-alive and compose.override.yaml without changing what is already there, and new services are always added commented out. A .bak copy is kept of any file that gets changed.

  • -y - Don't ask: stash local changes, comment out removed services
  • -f - Run docker compose up -d before finishing

Cloudflare

Domain name

  1. Make an account if you haven't already.
  2. Buy a domain, or if you already have one you can transfer the domain servers accross.
    • Set this as the DOMAIN in .env
    • Replace the $DOMAIN in PLEX_URL with this.

Tunnel (incoming security)

  1. Sign up for Zero Trust - you can choose the personal 0-cost.
  2. Go to Networks -> Tunnels
    1. Create a Tunnel, name it for your domain
    2. Copy the "Run the following command" suggestion, paste it as CLOUDFLARED_TOKEN in .env then remove the cloudflared.exe service install prefix (including space).
    3. Create 2 public hostnames, one to your domain, and one to * at your domain
      • Both have a service of https://traefik.internal
      • Both have Advanced -> TLS -> Origin Server Name as your domain
      • Both have Advanced -> TLS -> HTTP2 connection turned on

Make subdomains accessible

  1. Go back to Account Home, then click on your domain name.
  2. Under the Domain (Zone) settings go to SSL/TLS -> Overview, and enable Full encryption.
  3. Under DNS -> Records, create a CNAME entry for * pointing at your domain.
  4. Under DNS -> Settings, enable DNSSEC.

Allow ssl certificates to be created

  1. Click on your Profile in the top right, go to your profile, then click on API Tokens on the left.
  2. Create a Token using the Edit zone DNS template
  3. Allow it access to your domain under Zone Resources
  4. Copy the token to CLOUDFLARE_API in .env

VPN

This uses gluetun as the VPN layer. Whichever VPN provider you use must supply Wireguard access, then you only need to set VPN_SERVICE_PROVIDER and VPN_WIREGUARD_PRIVATE_KEY to enable it. Accessing it from within the service stack is via vpn.internal:8888 as an http(s) proxy.

Media Paths

  1. Make sure you set PATH_DOWNLOADS to a good download folder, this will be used by multiple services as a consistent location.
  2. Place all of your media paths in the PATH_XYZ variables in .env - add more as needed.

Plex

  1. Use these instructions to get PLEX_TOKEN in .env - https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
  2. Ensure you have all the correct paths for Plex from the Media Paths section above. Internally we're going to map them all under the /data/ folder.
  3. In your current Plex server go to Settings -> Library, and disable (and save) the "Empty trash automatically after every scan" option!
  4. Stop Plex Media Server!
  5. Copy (move is risky, but it's your library) the Plex Config folder starting at Library into plex/config/ - so there is a folder in there called Library.

Services

This is a list of all services, and the profiles they are started with. Note that only the core profiles are included in the compose.yaml file, everything else needs to be manually added.

Where "SUBDOMAIN" is a tick it uses the same as the service name.

NAME PROFILE DESCRIPTION INTERNAL PORT SUBDOMAIN
cloudflared core Cloudflare tunnel n/a ❌
deunhealth core Bring unhealthy containers back up n/a ❌
error-pages core Error pages 8080 ✔️
socket-proxy core Secure access to the docker socket 2375 ❌
tinyauth core OAuth via Google 3000 ✔️
traefik core HTTP routing 8080 ✔️
vpn core VPN + HTTP Proxy + Socks5 Proxy 8000 ❌
watchtower core Auto-update containers 8080 ✔️
adguardhome network Ads & trackers blocking DNS server 80 ✔️
audiobookshelf library Audiobooks library 80 ✔️
bazarr media Subtitles 6767 ✔️
beszel information System information 8090 ✔️
chaptarr media Books / Audiobooks 8789 ✔️
cleanuparr download Bad download handling 11011 ✔️
crunchy-downloader download Crunchyroll (anime) downloader 3000 ✔️
docker-discord-alerts tools Notify Discord when docker containers change n/a ❌
dozzle information Docker status 8080 ✔️
duc tools Disk usage 80 ✔️
emby library Media library 8096 ✔️
flaresolverr network Cloudflare captcha bypasss 8191 ❌
foundryvtt games Foundry Virtual Tabletop for RPGs 30000 rpg
gatus information Status and uptime monitoring 8080 status
gatus-private information Private status monitoring, behind tinyauth 8080 status-private
glances information Operating system status 61208 ✔️
handbrake media Video Transcoder 5800 ✔️
homepage information Dashboard 3000 (root)
i2p network I2P Client 7657 ✔️
imagemaid quality Cleanup Plex image cache n/a ❌
jellyfin library Open source media library 8096 ✔️
kapowarr library Comics 5656 ✔️
kometa quality Poster overlays, collections, playlists for Plex n/a ❌
komga library Comic library 25600 ✔️
libretranslate tools Translation 5000 translate
lidarr media Music 8686 ✔️
lingarr quality Subtitle translation 8080 ✔️
lldap network LDAP server 17170 / 3890 ✔️
manyfold library 3d models library 3214 ✔️
minecraft games Minecraft 8080 ✔️
mylar media Comics 8090 ✔️
neutarr download Missing media search 9705 ✔️
nextcloud tools Personal cloud storage 80 ✔️
notifiarr tools System notifications 5454 ✔️
nutcase information Network UPS Tools 9995 ✔️
onlyfans download Download all subscriptions n/a ❌
openspeedtest network Bandwidth test to server 3000 ✔️
open-webui tools AI chat with bundled Ollama 8080 ✔️
owntone library iTunes media server 3689 ✔️
peanut information Network UPS Tools 8080 ✔️
pgadmin tools Database admin 80 ✔️
plex library Media library 32400 ✔️
plex-find-mismatch quality Finds mismatches between tvdb/tmdb/imdb and Plex n/a ❌
pocket-id tools Passkey authentication server 1411 auth
portainer information Container management 9000 ✔️
postfix tools Internal SMTP email relay 587 ❌
postgres tools Database n/a ❌
posterizarr tools Automated poster maker 8000 ✔️
prowlarr download Torrent / NNTP search proxy 9696 ✔️
qbittorrent download Torrent downloader 8080 ✔️
radarr media Movies 7878 ✔️
sabnzbd download NNTP downloader 8085 ✔️
scrutiny information S.M.A.R.T. information 8080 ✔️
seerr information Media requests and issue tracking 5055 ask
sonarr media TV Shows 8989 ✔️
sonarr_youtubedl disabled Download from Youtube n/a ❌
speedtest-tracker information Speedtest with history 80 ✔️
stash tools Porn database 9999 ✔️
subgen quality Audio transription n/a ❌
syncthing download Remote data synchronisation 8384 ✔️
tautulli information Plex stats 8181 ✔️
tdarr quality Transcoding / format shifting / audio normalisation 8265 ✔️
tdarr_inform quality Notifications from sonarr / radarr / etc to tdarr 5004 ✔️
tdarr-node quality Transcoding node for tdarr n/a ❌
titlecardmaker quality Episode thumbnails for Plex 4242 ✔️
tracearr library Plex & Emby monitoring 3000 ✔️
ubooquity media Comics 2202 ✔️
uptime-kuma information Status and uptime monitoring 3001 status
watchstate tools Sync media library watch state 8080 ✔️
webtop desktop Linux desktop 3000 ✔️
whisparr media Porn 6969 ✔️
whoami network Who... Am... I...? 80 ✔️
windows desktop Windows desktop 8006 ✔️
zfdash information ZFS administration 5001 ✔️
zfs-discord-alerts tools Notify Discord when there are zfs problems 8080 ❌

Note

The core PROFILE services are enabled in the compose.yaml file, you must add any others you wish to a compose.override.yaml file instead (you may copy the commented-out section from the compose.yaml file and uncomment individual lines):

include:
  - whoami/compose.yaml # Use the name of the service above followed by "/compose.yaml"

Authentication

This includes tinyauth as the authentication layer, you may use it with any oauth layer.

Include your email address in the TINYAUTH_WHITELIST in .env (this is a global setting that allows a comma separated list).

  • If you include the supplied tinyauth/compose.github.yaml you can login via github: https://tinyauth.app/docs/guides/github-oauth/ - but set the TINYAUTH_GITHUB_CLIENT_ID and TINYAUTH_GITHUB_CLIENT_SECRET in the .env file.
  • If you include the supplied tinyauth/compose.google.yaml you can login via google: https://tinyauth.app/docs/guides/google-oauth/ - but set the TINYAUTH_GOOGLE_CLIENT_ID and TINYAUTH_GOOGLE_CLIENT_SECRET in the .env file.
  • If you include the supplied tinyauth/compose.oauth.yaml you can login via a custom oauth provider - set the TINYAUTH_OAUTH_* variables in the .env file.

Additionally you may use local authentication with lldap (user + password), pocket-id (passkey), or both (configure users in lldap). The user is admin by default, but edit your .env first to set these things.

  • If you include the supplied lldap/compose.tinyauth.yaml then this allows tinyauth to login with a user + password supplied by lldap.
  • If you include the supplied pocket-id/compose.tinyauth.yaml then this allows tinyauth to login with a passkey supplied by pocket-id.

Note

If you are using both together then you will need to generate a one-time token for an admin user with docker compose exec pocket-id /app/pocket-id one-time-access-token <user name or email>.

Bootstrap

Important

The Plex library must have finished copying before you do this, and you must not run the old one again (unless you decide not to go ahead with this).

  1. Run docker compose pull - disable any services that you don't have permission for.
  2. Just before running go to https://account.plex.tv/claim and copy the token to PLEX_CLAIM in .env
  3. Run docker compose up -d and wait for everything to come up.
  4. Go to https://dozzle.<domain> and wait for all the red dots to turn green.
  5. Optional: Run docker compose down followed by docker compose up -d dozzle plex - this reduces load and lets you setup things one at a time.
  6. Go to Plex and tell it to rescan everything - every entry should get re-found as Plex uses file hashes for identification.

About

Overkill media server setup

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages