Skip to content

Commit 0062095

Browse files
authored
Merge pull request #29 from jfroment/dev
Release v2 - The Swan
2 parents 9310e4b + b929a52 commit 0062095

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1421
-278
lines changed

.env.sample

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Internal settings (they will not be passed to running services)
2+
CHECK_FOR_OUTDATED_CONFIG=true
3+
14
# General Traefik (reverse proxy) settings
25
TRAEFIK_DOMAIN=mydomain.com
36
@@ -10,7 +13,11 @@ TZ="Europe/Paris"
1013
HTTP_USER=myuser
1114
HTTP_PASSWORD='mypassword_encoded' # Keep these simple quotes!
1215

13-
# Containers permissions mapping
16+
# Host paths + containers permissions mapping
17+
HOST_CONFIG_PATH="/data/config"
18+
HOST_MEDIA_PATH="/data/torrents"
19+
# Will be located in $HOST_MEDIA_PATH
20+
DOWNLOAD_SUBFOLDER="deluge"
1421
PGID=1000
1522
PUID=1000
1623

@@ -29,4 +36,11 @@ PORTAINER_ADMIN_PASSWORD=h4ckMePleAse
2936

3037
# Flood username declared in deluge rpc daemon
3138
FLOOD_PASSWORD=myfloodpassword
32-
FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON=false
39+
FLOOD_AUTOCREATE_USER_IN_DELUGE_DAEMON=false
40+
41+
# Wireguard custom endpoint
42+
WIREGUARD_ENDPOINT=<ENDPOINT>
43+
WIREGUARD_PORT=51820
44+
WIREGUARD_PUBLIC_KEY=<WIREGUARD_PUBLIC_KEY>
45+
WIREGUARD_PRIVATE_KEY=<WIREGUARD_PRIVATE_KEY>
46+
WIREGUARD_ADDRESS=<WIREGUARD_LAN_ADDRESS>

.gitignore

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
.DS_Store
22

3-
/config
43
**/tunnel-options.sh
54
**/.env
65
**/traefik/http_auth
76
backup/
87
services.conf
8+
9+
traefik/custom/dynamic*.yaml
10+
traefik/custom/custom-*.yaml
11+
samples/custom*/*.yaml
12+
13+
config.yaml
14+
services/custom/*.yaml
15+
services/custom/*.yml
16+
services/generated/*.yaml

README.md

+63-59
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
1-
# Seedbox
2-
3-
A collection of Dockerfiles and a docker-compose configuration to set up a
4-
seedbox and personal media server.
5-
6-
## Included Applications
1+
<h1 align="center">Seedbox</h1>
2+
<p align="center">
3+
An extensive and hackable collection of containerized services to set up a seedbox and personal media server.
4+
</p>
5+
<br>
6+
7+
## ✨ Features
8+
9+
* Easy to configure personal media server without needing too much technical skills
10+
* Compatible with multiple systems (Linux servers, desktops, Synology NAS...)
11+
* Automatic HTTPS ceritificates management and renewal
12+
* Support for HTTP only too if required for your use-case
13+
* Everything is hackable
14+
* Add your own services
15+
* Disable the ones you do not want
16+
* Customize or add your own routing rules to integrate with existing services
17+
* Tweak any service to your need by using custom file parameter on any service
18+
* VPN support with multiple providers
19+
* Hide the service(s) of your choice behind a VPN tunnel
20+
* Non mandatory
21+
* Declarative configuration
22+
* Persistent data for your media
23+
* Install & update using the same script
24+
* Start with the [Configuration Guide](doc/configuration.md)
25+
26+
## ⚠️ News
27+
28+
Version 2 is released, please make sure you read [this V2 Migration Guide](doc/UPGRADE_V2.md) as there are breaking changes!
29+
30+
## 📦 Included Applications
731

832
| Application | Web Interface | Docker image | Version (image tag) | Notes |
933
-----------------------|----------------------------|------------------------------------------------------------------------|-------------------------|---------------------|
@@ -14,6 +38,9 @@ seedbox and personal media server.
1438
| Radarr | radarr.yourdomain.com | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | *develop* | Movies monitor |
1539
| Bazarr | bazarr.yourdomain.com | [linuxserver/bazarr](https://hub.docker.com/r/linuxserver/bazarr) | *latest* | Subtitles monitor |
1640
| Lidarr | lidarr.yourdomain.com | [linuxserver/lidarr](https://hub.docker.com/r/linuxserver/lidarr) | *develop* | Music monitor |
41+
| Readarr | readarr.yourdomain.com | [linuxserver/readarr](https://hub.docker.com/r/linuxserver/readarr) | *nightly* | Ebook and comic monitor |
42+
| Komga | komga.yourdomain.com | [gotson/komga](https://hub.docker.com/r/gotson/komga) | *latest* | Comic Book Manager |
43+
| Kavita | Kavita.yourdomain.com | [gotson/komga](https://hub.docker.com/r/gotson/komga) | *latest* | Comic Book Manager |
1744
| Ombi | ombi.yourdomain.com | [linuxserver/ombi](https://hub.docker.com/r/linuxserver/ombi) | *latest* | Plex content requests |
1845
| Overseerr | overseerr.yourdomain.com | [linuxserver/overseerr](https://hub.docker.com/r/linuxserver/overseerr) | *latest* | Plex content requests |
1946
| Jackett | jackett.yourdomain.com | [linuxserver/jackett](https://hub.docker.com/r/linuxserver/jackett) | *latest* | Tracker indexer |
@@ -22,58 +49,41 @@ seedbox and personal media server.
2249
| Tautulli (plexPy) | tautulli.yourdomain.com | [linuxserver/tautulli](https://hub.docker.com/r/linuxserver/tautulli) | *latest* | Plex stats and admin|
2350
| Tdarr | tdarr.yourdomain.com | [haveagitgat/tdarr](https://hub.docker.com/r/haveagitgat/tdarr) | *latest* | Re-encode files |
2451
| NextCloud | nextcloud.yourdomain.com | [linuxserver/nextcloud](https://hub.docker.com/r/linuxserver/nextcloud) | *latest* | Files management |
25-
| NextCloud-db (MariaDB) | not reachable | [mariadb](https://hub.docker.com/r/_/mariadb) | *10* | DB for Nextcloud |
52+
| NextCloud-db (MariaDB) | *not reachable* | [mariadb](https://hub.docker.com/r/_/mariadb) | *10* | DB for Nextcloud |
2653
| Portainer | portainer.yourdomain.com | [portainer/portainer](https://hub.docker.com/r/portainer/portainer) | *latest* | Container management|
2754
| Netdata | netdata.yourdomain.com | [netdata/netdata](https://hub.docker.com/r/netdata/netdata) | *latest* | Server monitoring |
2855
| Duplicati | duplicati.yourdomain.com | [linuxserver/duplicati](https://hub.docker.com/r/linuxserver/duplicati)| *latest* | Backups |
56+
| Heimdall | yourdomain.com | [linuxserver/heimdall](https://hub.docker.com/r/linuxserver/heimdall)| *latest* | Main dashboard |
57+
| Syncthing | syncthing.yourdomain.com | [linuxserver/syncthing](https://hub.docker.com/r/linuxserver/syncthing) | *latest* | P2P files sharing |
58+
| Traefik | traefik.yourdomain.com | [traefik](https://hub.docker.com/_/traefik) | *latest* | Traefik reverse proxy (access to admin dashboard) |
59+
| Gluetun | - | [qmcgaw/gluetun](https://hub.docker.com/r/qmcgaw/gluetun)| *latest* | VPN client |
60+
| *Any application you want!* | *whatever.yourdomain.com* | *Any image* | *Any tag* | *Any service - See the [Configuration Guide](doc/configuration.md)* |
2961

30-
The front-end reverse proxy (Traefik - **check the next section if you have already the seedbox with Traefik v1**) routes based on the lowest level subdomain
31-
(e.g. `deluge.example.com` would route to deluge). Since this is how the router
32-
works, it is recommended for you to get a top level domain. If you do not have
33-
one, you can edit your domains locally by changing your hosts file or use a
34-
browser plugin that changes the host header.
35-
36-
Traefik takes care of valid Let's Encrypt certificates and auto-renewal.
37-
38-
Note: Plex is also available directly through the `32400` port without going
39-
through the reverse proxy.
62+
## 🌐 Traefik
4063

41-
## September 2020 - Upgrade to Traefik v2 instructions
64+
The front-end reverse proxy (Traefik - **check [this guide](doc/traefik_v2.md) if you still have the seedbox with Traefik v1**) routes based on the lowest level subdomain (e.g. `deluge.example.com` would route to deluge). Since this is how the router works, it is recommended for you to get a top level domain. If you do not have one, you can edit your domains locally by changing your hosts file or use a browser plugin that changes the host header.
4265

43-
Before upgrading Traefik to version 2, please check the following:
66+
Traefik takes care of valid Let's Encrypt certificates and auto-renewal.
4467

45-
- In this repo, Traefik v2 upgrade is as seamless as possible (same environment variables than before, out-of-the-box config file...).
46-
- **First, ``git pull`` to grab the latest code.**
47-
- The ``HTTP_PASSWORD`` variable now must be simple-quoted in the .env file. See the updated ``.env.sample`` file (which has also been reorganized)
48-
- Run ``init.sh`` in order to create required Docker objects (network name has changed).
49-
- You can update your acme.json to a Traefik v2-compliant one by doing the following (before launching Traefik v2):
68+
Note: Plex is also available directly through the `32400` port without going through the reverse proxy.
5069

51-
```sh
52-
mkdir -p /tmp/migration
53-
cd /tmp/migration
54-
sudo cp /opt/traefik/acme.json .
55-
sudo chmod 775 /tmp/migration/acme.json
56-
# Do *NOT* forget the --resolver at the end! (le = Let's Encrypt resolver, see traefik/traefik.yml)
57-
docker run --rm -v ${PWD}:/data -w /data containous/traefik-migration-tool acme -i acme.json -o acme2.json --resolver le
58-
mkdir -p /data/config/traefik
59-
sudo cp acme2.json /data/config/traefik/acme.json
60-
sudo chmod 600 /data/config/traefik/acme.json
61-
# When you already have a backup!
62-
sudo rm -rf /opt/traefik /tmp/migration
63-
```
70+
You can also add your own Traefik rules to integrate with other services (deployed wihthin docker or somewhere else on your LAN, or even on the Internet).
71+
Check the [Configuration Guide](doc/configuration.md).
6472

65-
- As from Traefik v2, as Http Authentication is now possible on the Traefik console, the latter is enabled at ``traefik.yourdomain.com``.
66-
- After all this, you can simply do: ``./update-all.sh``! Voilà!
73+
## ⚙️ Installation
6774

68-
## Dependencies
75+
### Dependencies
6976

7077
- [Docker](https://github.com/docker/docker) >= 20.10
71-
- [Docker Compose](https://github.com/docker/compose) >= 1.28.0
72-
- [local-persist Docker plugin](https://github.com/MatchbookLab/local-persist): installed directly on host (not in container). This is a volume plugin that extends the default local driver’s functionality by allowing you specify a mountpoint anywhere on the host, which enables the files to always persist, even if the volume is removed via `docker volume rm`. Use *systemd* install for Ubuntu 16.04.
78+
- [Docker Compose](https://github.com/docker/compose) >= 2.2
79+
- [local-persist Docker plugin](https://github.com/MatchbookLab/local-persist): installed directly on host (not in container). This is a volume plugin that extends the default local driver’s functionality by allowing you specify a mountpoint anywhere on the host, which enables the files to always persist, even if the volume is removed via `docker volume rm`. Use *systemd* install for Ubuntu.
80+
- [jq](https://stedolan.github.io/jq/download/) >= 1.5
81+
- [yq](https://github.com/mikefarah/yq/releases) >= 4
7382

74-
## Configuration
83+
### Prepare your host
7584

7685
Before running, please create the volumes which will be statically mapped to the ones on the host:
86+
For example:
7787

7888
```sh
7989
sudo su -c "mkdir /data && mkdir /data/config && mkdir /data/torrents"
@@ -83,29 +93,23 @@ sudo su -c "mkdir /data && mkdir /data/config && mkdir /data/torrents"
8393
Edit the `.env` file and change the variables as desired.
8494
The variables are all self-explanatory.
8595

86-
**NEW**
87-
You can also disable a service if you do not need it by editing the ``services.conf`` file.
88-
Simply change the "*enable*" key with the "*disable*" one for the service you want to disable.
89-
If you remove a line in this file, it will be considered as "enabled" as all services are enabled by default.
96+
### Review the configuration
9097

91-
## Running & updating
98+
The configuration lives in the ``config.yaml`` file.
9299

93-
```sh
94-
./update-all.sh
95-
```
100+
All you need to know is located in the [Configuration Guide](doc/configuration.md).
96101

97-
docker-compose should manage all the volumes and network setup for you. If it
98-
does not, verify that your docker and docker-compose version is updated.
102+
### Running & updating
99103

100-
Make sure you install the dependencies and finish configuration before doing
101-
this.
104+
```sh
105+
./run-seedbox.sh
106+
```
102107

103-
## PlexPass
108+
All services and synamic configuration will be automatically created without further action from your part.
104109

105-
Just set the `VERSION` environment variable to `latest` on the Plex service (enabled by default).
106-
See https://hub.docker.com/r/linuxserver/plex.
110+
Make sure you install the dependencies and finish configuration before doing this.
107111

108-
## Where is my data?
112+
### Where is my data?
109113

110114
All data is saved in the docker volumes `seedbox_config` or
111115
`seedbox_torrents`.

config-updater.sh

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
set -e
3+
################################################################################
4+
### === config-updater.sh === ###
5+
### Script which takes as input the old format config file (services.conf) ###
6+
### and transforms it in the new format in yaml, using jq and yq ###
7+
################################################################################
8+
9+
cleanup_on_exit() {
10+
rm -f tmp.json config.json
11+
}
12+
trap cleanup_on_exit EXIT
13+
14+
# Load common functions
15+
source config/tools.sh
16+
17+
# Check that required tools are installed
18+
check_utilities
19+
20+
if [[ ! -f services.conf ]]; then
21+
echo "[$0] ERROR. Could nof find services.conf. Exiting."
22+
exit 1
23+
fi
24+
25+
jq -n '{"services": []}' > config.json
26+
27+
# First, add Traefik as it was not explicitely set by default in old config file (services.conf)
28+
if ! grep -q "traefik" services.conf; then
29+
jq -r '.services[.services| length] |= . +
30+
{
31+
"name": "traefik",
32+
"enabled": true,
33+
"traefik": {
34+
"enabled": true,
35+
"rules": [
36+
{
37+
"host": "traefik.'$(echo '${TRAEFIK_DOMAIN}')'",
38+
"service": "api@internal",
39+
"httpAuth": true,
40+
}
41+
]
42+
}
43+
}' config.json > tmp.json
44+
rm -f config.json
45+
mv tmp.json config.json
46+
fi
47+
48+
cat services.conf | while read line || [[ -n $line ]]; do
49+
key=$(echo $line | sed -r "s/^(.*):.*$/\1/")
50+
enabled="true"
51+
if grep -q "disable" <<< $line; then
52+
enabled="false"
53+
fi
54+
55+
# Compatibility for services.conf already on dev (with temporary syntax -vpn)
56+
if grep -q "\-vpn" <<< $line; then continue; fi
57+
58+
enableVpn="false"
59+
# If this service is disabled AND another one in the file is enabled with VPN mode, keep that information
60+
if grep -q "$key-vpn: enable" services.conf; then
61+
if [[ enabled="false" ]]; then
62+
#echo "[$0] $key => another service detected enabled with vpn..."
63+
enableVpn="true"
64+
enabled="true"
65+
fi
66+
fi
67+
68+
if grep -q "\-hardware-transcoding" <<< $line; then continue; fi
69+
70+
# Define if Traefik should be enabled on the service
71+
case $key in
72+
flaresolverr|gluetun)
73+
enableTraefik="false"
74+
rules=$(jq -n '[]')
75+
;;
76+
*)
77+
enableTraefik="true"
78+
# If Traefik enabled => define if http auth Traefik middleware must be set by default
79+
case $key in
80+
kavita|komga|nextcloud|ombi|overseerr|plex|portainer|tautulli)
81+
defaultHttpAuth="false"
82+
;;
83+
*)
84+
defaultHttpAuth="true"
85+
;;
86+
esac
87+
# Define scheme // For nextcloud, scheme must be https
88+
internalScheme="http"
89+
[[ $key == "nextcloud" ]] && internalScheme="https"
90+
91+
# Define service default port from bundled config file
92+
internalPort=$(cat config/ports | { grep $key || true; } | sed -r "s/^${key}: (.*)$/\1/")
93+
rules=$(jq -n '[
94+
{
95+
"host": "'"$key"'.'$(echo '${TRAEFIK_DOMAIN}')'",
96+
"httpAuth": '"${defaultHttpAuth}"',
97+
"internalPort": '"${internalPort}"',
98+
"internalScheme": "'"${internalScheme}"'"
99+
}
100+
]')
101+
;;
102+
esac
103+
104+
jq -r --argjson RULES "$rules" '.services[.services| length] |= . +
105+
{
106+
"name": "'"$key"'",
107+
"enabled": '"${enabled}"',
108+
"vpn": '"${enableVpn}"',
109+
"traefik": {
110+
"enabled": '"${enableTraefik}"',
111+
"rules": $RULES
112+
}
113+
}' config.json > tmp.json
114+
rm -f config.json
115+
mv tmp.json config.json
116+
117+
done
118+
119+
# Transform json into yaml, easier to manipulate for the user
120+
cat config.json | yq e -P - > config.yaml

0 commit comments

Comments
 (0)