-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
155 lines (150 loc) · 6.36 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# SPDX-FileCopyrightText: 2023 Ross Patterson <[email protected]>
#
# SPDX-License-Identifier: MIT
# Minimal `$ docker compose` configuration to show the requirements for running prunerr
# in containers.
services:
transmission:
image: "linuxserver/transmission:4.0.5"
container_name: "transmission"
# command:
# # From `# pgrep -fla transmission`:
# # `/usr/bin/transmission-daemon -g /config -c /watch -f`
# - "transmission-daemon"
# - "-g"
# - "/config"
# - "-c"
# - "/watch"
# - "-f"
# # Enable debug logging
# - "--log-debug"
environment:
TZ: "${TZ:-America/Los_Angeles}"
PUID: "${PUID:-1000}"
PGID: "${PGID:-100}"
USER: "${TRANSMISSION_USER:-transmission}"
PASS: "${TRANSMISSION_PASS}"
volumes:
# Replace with the correct paths for your `$ docker compose ...` project:
# Exit the container if the core `s6-overlay` service fails.
# - "./transmission/etc/s6-overlay/s6-rc.d/svc-transmission/finish\
# :/etc/s6-overlay/s6-rc.d/svc-transmission/finish"
# Support adding cron jobs from the compose project:
# - "./transmission/etc/crontabs/:/etc/crontabs/"
# Pause downloading when the `downloadDir` is getting low on space:
# - "./transmission/usr/local/bin/transmission-pause-download:\
# /usr/local/bin/transmission-pause-download"
# Shut down the container when `/config/` is running out of disk space:
# - "./transmission/usr/local/bin/transmission-config-space-shutdown:\
# /usr/local/bin/transmission-config-space-shutdown"
# Intended for use in the image
- "./transmission/config/:/config/"
# The volume on which Transmission's `download-dir` is stored:
- type: "volume"
source: "media_library"
target: "${DOWNLOAD_VOLUME:-/media/Library}"
# Transmission seems to be very poorly behaved when disk space is exhausted: items
# become corrupted, items lose track of their data/files, etc.. Guard against that,
# for example if Prunerr stops running for any reason, by shutting it down before
# disk space is exhausted. Use the `HEALTHCHECK` to exit PID 1 with 0 status code
# before that happens. The `on-failure` restart policy ensures that `# dockerd`
# won't restart the container again.
restart: "on-failure"
healthcheck:
# If the `transmission` service uses `network_mode: "service:..."`, such as a VPN,
# then it may become inaccessible on any IP other than `localhost` when the
# service whose network it uses is restarted. As such, if the `transmission`
# service should be accessible from it's IP on the LAN set the `LAN_IP=...` in the
# `./.env` so that the `HEALTHCHECK` fails and the container is restart when that
# happens.
test: >-
curl -LIs -X GET -u "${TRANSMISSION_USER:-transmission}:${TRANSMISSION_PASS}"
"http://${LAN_IP:-localhost}:9091/transmission/rpc/" |
grep '^X-Transmission-Session-Id: '
labels:
traefik.enable: true
# Un comment and set `TRANSMISSION_HOST` to proxy via Traefik
# traefik.http.routers.transmission.rule: "Host(`${TRANSMISSION_HOST}`)"
traefik.http.services.transmission.loadbalancer.server.port: 9091
traefik.http.routers.transmission.entrypoints: "webSecure"
traefik.http.routers.transmission.tls.certresolver: "letsEncrypt"
# See `./docker-compose-servarr.yml` for example Servarr configurations
## Container for use by end users:
prunerr-daemon:
image: "registry.gitlab.com/rpatterson/prunerr"
container_name: "prunerr-daemon"
depends_on:
- "transmission"
environment:
TZ: "${TZ:-Etc/UTC}"
# Make the runtime user configurable in `./.env` to match permissions inside and
# outside the container. Default to the common/standard main/first user and group
# IDs
PUID: "${PUID:-1000}"
PGID: "${PGID:-100}"
# Un-comment to get more verbose `DEBUG` logging
# DEBUG: "true"
volumes:
# Preserve user configuration, data, and caches between containers and variants:
- type: "volume"
source: "home_config"
target: "/home/prunerr/.config"
- type: "volume"
source: "home_local_share"
target: "/home/prunerr/.local/share"
- type: "volume"
source: "home_cache"
target: "/home/prunerr/.cache"
# The volume on which Transmission's `download-dir` is stored:
- type: "volume"
source: "media_library"
target: "${DOWNLOAD_VOLUME:-/media/Library}"
# Preserve shell history inside containers, requires `$ touch
# ./home/.bash_history`:
- "./home/.bash_history:/home/prunerr/.bash_history"
# Access to Transmission's data for the `$ prunerr re-add` sub-command:
- "./transmission/config/:/config/"
restart: "unless-stopped"
volumes:
# The volume on which Transmission's `download-dir` is stored:
media_library:
name: "media_library"
driver: "local"
driver_opts:
type: "none"
o: "bind"
device: "${DOWNLOAD_VOLUME:-/media/Library/}"
# When on of a container's volumes, such as application data on an SSD for fast access
# on the `/` root filesystem, is on a separate filesystem than another of a
# container's volumes, such as a large RAID5 array for storing large media files in
# `/media/Library/`, data damage and/or loss can happen when one of those is mounted
# and another is not. In such cases, it's best *not* to bind mount the already mounted
# filesystem, but instead to define the volumes in such a way that `# dockerd` will
# refuse to even start the container if a volume's filesystem device is not available:
# media_library:
# name: "media_library"
# driver: "local"
# driver_opts:
# device: "/dev/mapper/_dev_md127p1"
# type: "ext4"
home_config:
name: "${PROJECT_NAME:-prunerr}_home_config"
driver: "local"
driver_opts:
type: "none"
o: "bind"
device: "${CHECKOUT_DIR:-.}/home/.config/"
home_local_share:
name: "${PROJECT_NAME:-prunerr}_home_local_share"
driver: "local"
driver_opts:
type: "none"
o: "bind"
device: "${CHECKOUT_DIR:-.}/home/.local/share/"
home_cache:
name: "${PROJECT_NAME:-prunerr}_home_cache"
driver: "local"
driver_opts:
type: "none"
o: "bind"
device: "${CHECKOUT_DIR:-.}/home/.cache/"