media-stack/README.md

223 lines
7.6 KiB
Markdown
Raw Normal View History

2023-05-05 07:57:27 +00:00
# media-stack
A stack of self-hosted media managers and streamer along with VPN.
Stack include VPN, Radarr, Sonarr, Prowlarr, qBittorrent and Jellyfin.
2023-05-05 07:57:27 +00:00
## Requirements
- Docker version 24.0.5 and above
- Docker compose version v2.20.2 and above
2023-05-05 08:07:30 +00:00
- It may also work on some of lower versions, but its not tested.
2023-05-05 07:57:27 +00:00
## Install media stack
2022-08-09 11:36:55 +00:00
There are two ways this stack can be deployed.
2022-07-05 15:01:32 +00:00
1. With a VPN (Recommended)
2. Without a VPN
2022-08-12 09:45:01 +00:00
Before we deploy the stack, We must create docker network first
2022-08-12 09:45:01 +00:00
```bash
docker network create mynetwork
```
2023-05-05 07:57:27 +00:00
**Deploy the stack with VPN**
2022-07-05 15:01:32 +00:00
If VPN is enabled, qBittorrent and Prowlarr will be put behind VPN.
2022-08-09 14:51:31 +00:00
By default, NordVPN is configured in `docker-compose.yml` file. This can be updated to use ExpressVPN, SurfShark, Custom OpenVPN or Wireguard VPN. It uses OpenVPN type for all the providers.
2022-08-09 14:51:31 +00:00
Check respective document of your VPN provider to generate OpenVPN username and password.
2022-08-12 13:17:35 +00:00
By default, VPN is disabled in `docker-compose.yml`. We just need comment and uncomment few lines in `docker-compose.yml` file to enable and use VPN. Go through the comment messages in `docker-compose.yml` file to update them accordingly. Its very well guided in the compose file itself.
2022-08-09 14:51:31 +00:00
Update the `docker-compose.yml` file as guided in comment messsage in same file and follow below commands to deploy the stack.
2022-07-05 15:01:32 +00:00
2023-08-12 07:27:29 +00:00
To deploy the stack with VPN (with nordvpn):
2023-05-05 08:06:16 +00:00
```bash
2023-08-12 07:27:29 +00:00
VPN_SERVICE_PROVIDER=nordvpn OPENVPN_USER=openvpn-username OPENVPN_PASSWORD=openvpn-password SERVER_COUNTRIES=Switzerland docker compose --profile vpn up -d
2023-05-05 08:06:16 +00:00
# docker compose -f docker-compose-nginx.yml up -d # OPTIONAL to use Nginx as reverse proxy
2023-05-05 08:06:16 +00:00
```
**Deploy the stack without VPN**
2022-08-09 11:36:55 +00:00
To deploy the stack with without VPN (highly discouraged), Run below command.
2022-08-09 11:36:55 +00:00
```bash
docker compose up -d
# docker compose -f docker-compose-nginx.yml up -d # OPTIONAL to use Nginx as reverse proxy
```
2022-08-09 11:36:55 +00:00
## Configure qBittorrent
2022-08-09 11:36:55 +00:00
- Open qBitTorrent at http://localhost:5080. Default username:password is admin:adminadmin
- Go to Tools --> Options --> WebUI --> Change password
- Run below commands on the server
2022-08-09 11:36:55 +00:00
```bash
2022-08-09 11:36:55 +00:00
docker exec -it qbittorrent bash # Get inside qBittorrent container
2022-08-09 14:51:31 +00:00
# Above command will get you inside qBittorrent interactive terminal, Run below command in qbt terminal
2022-08-09 11:36:55 +00:00
mkdir /downloads/movies /downloads/tvshows
chown 1000:1000 /downloads/movies /downloads/tvshows
```
2023-05-05 07:57:27 +00:00
## Configure Radarr
2022-07-05 15:01:32 +00:00
- Open Radarr at http://localhost:7878
- Settings --> Media Management --> Check mark "Movies deleted from disk are automatically unmonitored in Radarr" under File management section --> Save
- Settings --> Download clients --> Transmission --> Add Host (qbittorrent) and port (5080) --> Username and password --> Test --> Save **Note: If VPN is enabled, then qbittorrent is reachable on vpn's service name**
2022-07-06 08:12:56 +00:00
- Settings --> General --> Enable advance setting --> Select AUthentication and add username and password
- Indexer will get automatically added during configuration of Prowlarr. See 'Configure Prowlarr' section.
2022-07-05 15:01:32 +00:00
2023-08-19 10:52:14 +00:00
**Add a movie** (After Prowlarr is configured)
2022-07-05 15:01:32 +00:00
- Movies --> Search for a movie --> Add Root folder (/downloads) --> Quality profile --> Add movie
- Go to qBittorrent (http://localhost:5080) and see if movie is getting downloaded.
2022-07-05 15:01:32 +00:00
2023-05-05 07:57:27 +00:00
## Configure Jellyfin
2022-07-05 15:01:32 +00:00
- Open Jellyfin at http://localhost:8096
- Configure as it asks for first time.
- Add media library folder and choose /data/movies/
2022-07-06 06:37:17 +00:00
2023-05-05 07:57:27 +00:00
## Configure Prowlarr
2022-08-09 14:51:31 +00:00
- Open Prowlarr at http://localhost:9696
- Settings --> General --> Authentications --> Select Authentication and add username and password
2022-08-09 14:51:31 +00:00
- Add Indexers, Indexers --> Add Indexer --> Search for indexer --> Choose base URL --> Test and Save
- Add application, Settings --> Apps --> Add application --> Choose Sonarr or Radarr or any apps to link --> Prowlarr server (http://localhost:9696) --> Radarr server (http://localhost:7878) --> API Key --> Test and Save
- This will add indexers in respective apps automatically.
2023-05-05 07:57:27 +00:00
## Configure Nginx
2022-07-06 06:37:17 +00:00
- Get inside Nginx container
- `cd /etc/nginx/conf.d`
2023-05-05 07:57:27 +00:00
- Add proxies for all tools.
2022-07-18 12:49:22 +00:00
`docker cp nginx.conf nginx:/etc/nginx/conf.d/default.conf && docker exec -it nginx nginx -s reload`
2022-07-06 06:37:17 +00:00
- Close ports of other tools in firewall/security groups except port 80 and 443.
2023-05-05 07:57:27 +00:00
## Apply SSL in Nginx
- Open port 80 and 443.
- Get inside Nginx container and install certbot and certbot-nginx `apk add certbot certbot-nginx`
- Add URL in server block. e.g. `server_name localhost armdev.navratangupta.in;` in /etc/nginx/conf.d/default.conf
- Run `certbot --nginx` and provide details asked.
## Radarr Nginx reverse proxy
2022-07-06 06:37:17 +00:00
- Settings --> General --> URL Base --> Add base (/radarr)
- Add below proxy in nginx configuration
```
location /radarr {
proxy_pass http://radarr:7878;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2022-07-06 08:12:56 +00:00
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
2022-07-06 06:37:17 +00:00
}
```
2022-07-06 08:12:56 +00:00
- Restart containers.
2023-05-05 07:57:27 +00:00
## Sonarr Nginx reverse proxy
2022-07-10 15:28:25 +00:00
- Settings --> General --> URL Base --> Add base (/sonarr)
- Add below proxy in nginx configuration
```
location /radarr {
proxy_pass http://sonarr:8989;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}
```
2023-05-05 07:57:27 +00:00
## Prowlarr Nginx reverse proxy
2022-08-09 14:51:31 +00:00
- Settings --> General --> URL Base --> Add base (/prowlarr)
- Add below proxy in nginx configuration
This may need to change configurations in indexers and base in URL.
```
location /prowlarr {
proxy_pass http://prowlarr:9696; # Comment this line if VPN is enabled.
# proxy_pass http://vpn:9696; # Uncomment this line if VPN is enabled.
2022-08-09 14:51:31 +00:00
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}
```
2022-07-10 15:28:25 +00:00
- Restart containers.
**Note: If VPN is enabled, then Prowlarr is reachable on vpn's service name**
2022-08-12 09:45:01 +00:00
2023-05-05 07:57:27 +00:00
## qBittorrent Nginx proxy
2022-08-09 11:36:55 +00:00
```
location /qbt/ {
proxy_pass http://qbittorrent:5080/; # Comment this line if VPN is enabled.
# proxy_pass http://vpn:5080/; # Uncomment this line if VPN is enabled.
2022-08-09 11:36:55 +00:00
proxy_http_version 1.1;
proxy_set_header Host http://qbittorrent:5080; # Comment this line if VPN is enabled.
# proxy_set_header Host http://vpn:5080; # Uncomment this line if VPN is enabled.
2022-08-09 11:36:55 +00:00
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_cookie_path / "/; Secure";
}
```
2022-08-12 09:45:01 +00:00
**Note: If VPN is enabled, then qbittorrent is reachable on vpn's service name**
2023-05-05 07:57:27 +00:00
## Jellyfin Nginx proxy
2022-07-06 08:12:56 +00:00
- Add base URL, Admin Dashboard -> Networking -> Base URL (/jellyfin)
- Add below config in Ngix config
```
location /jellyfin {
return 302 $scheme://$host/jellyfin/;
}
location /jellyfin/ {
proxy_pass http://jellyfin:8096/jellyfin/;
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
# Disable buffering when the nginx proxy gets very resource heavy upon streaming
proxy_buffering off;
}
```
2023-05-05 07:57:27 +00:00
2022-08-12 13:17:35 +00:00
- Restart containers