Skip to content

Commit de16398

Browse files
committed
docs & code: fix all 43 findings from code review & align E2E test suite
1 parent b5615e5 commit de16398

8 files changed

Lines changed: 876 additions & 143 deletions

File tree

.env.example

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
# TORBOX_API_KEY="your-key" TORBOX_MEDIA_SERVER="plex" ./setup.sh --yes
77

88
# ── Required ────────────────────────────────────────────────────
9-
10-
9+
# Paste your TorBox API key here (get it from https://torbox.app/settings)
10+
TORBOX_API_KEY=""
1111

1212
# ── Optional ────────────────────────────────────────────────────
13+
# Docker Compose profiles: "plex" or "jellyfin" (matches your media server selection)
14+
# COMPOSE_PROFILES="plex"
15+
16+
# Configurable Prowlarr default indexer URL (default: https://1337x.to)
17+
# TORBOX_INDEXER_URL="https://1337x.to"
1318
# Media server: "plex" (default) or "jellyfin"
1419
# TORBOX_MEDIA_SERVER="plex"
1520

.github/workflows/lint.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,34 @@ jobs:
5757

5858
- name: Extract and validate manage.sh
5959
run: |
60-
# Extract the heredoc content that generates manage.sh from setup.sh
61-
# Strip the first and last lines of each heredoc block (cat/EOF wrappers)
62-
# so bash -n checks the actual script content, not the heredoc container.
63-
sed -n '/^cat > "${INSTALL_DIR}\/manage.sh" << .MANAGE_EOF.$/,/^MANAGE_EOF$/p' setup.sh | sed '1d;$d' > /tmp/manage_extracted.sh
64-
sed -n '/^cat >> "${INSTALL_DIR}\/manage.sh" << .MANAGE_INLINE.$/,/^MANAGE_INLINE$/p' setup.sh | sed '1d;$d' >> /tmp/manage_extracted.sh
65-
bash -n /tmp/manage_extracted.sh && echo "manage.sh syntax OK" || { echo "manage.sh has syntax errors"; exit 1; }
60+
# Extract the heredoc content that generates manage.sh from setup.sh.
61+
# Track heredoc delimiters per opening `cat ... manage.sh <<'TAG'` line so
62+
# that nested heredocs (or same-named delimiters in a single file) are
63+
# captured correctly. Strip the cat/EOF wrapper lines from the output.
64+
awk '
65+
/^cat >+"\${INSTALL_DIR}\/manage.sh" <</ {
66+
match($0, /<<'\''(MANAGE_[A-Z_]+)'\''$/, m)
67+
tag = m[1]
68+
print "### " NR ": " $0
69+
capturing = 1
70+
next
71+
}
72+
capturing && $0 == tag {
73+
print "### " NR ": " $0
74+
capturing = 0
75+
tag = ""
76+
next
77+
}
78+
capturing { print }
79+
' setup.sh > /tmp/manage_extracted.sh
80+
if [[ ! -s /tmp/manage_extracted.sh ]]; then
81+
echo "::error::manage.sh extraction failed: no content captured from setup.sh heredocs"
82+
exit 1
83+
fi
84+
bash -n /tmp/manage_extracted.sh && echo "manage.sh syntax OK" || {
85+
echo "::error::manage.sh has syntax errors"
86+
exit 1
87+
}
6688
6789
- name: Validate uninstall.sh syntax
6890
run: bash -n uninstall.sh && echo "uninstall.sh syntax OK"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
.env
33
.env.local
44
.env.*
5+
!.env.example
6+
docker-compose.override.yml
7+
docker-compose.override.yaml
58

69
# Logs and temp files
710
*.log

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ cd torbox-media-server/
336336
./manage.sh keys # Show API keys (use with care)
337337
./manage.sh enable # Enable auto-start on boot
338338
./manage.sh disable # Disable auto-start on boot
339+
./manage.sh backup # Backup configuration and credentials
340+
./manage.sh restore # Restore configuration from a backup
341+
./manage.sh health # Run health checks on all services
342+
./manage.sh shell svc # Open a shell inside a container (e.g. radarr)
339343
```
340344

341345
> **Auto-start on boot:** The setup script installs a systemd service (`torbox-media-server`) that automatically handles mount propagation and starts all containers when your computer boots. You don't need to do anything — just turn on your computer and everything will be running.
@@ -344,7 +348,7 @@ cd torbox-media-server/
344348

345349
```
346350
torbox-media-server/
347-
├── docker-compose.yml # Auto-generated Docker Compose
351+
├── docker-compose.yml # Version-controlled Docker Compose
348352
├── .env # API keys, user IDs, timezone, mount paths
349353
├── manage.sh # Management script (start/stop/logs/etc.)
350354
├── configs/
@@ -436,8 +440,8 @@ chmod +x uninstall.sh
436440
The script will:
437441
1. Stop and remove all Docker containers and the network
438442
2. Remove the systemd auto-start service
439-
3. Remove the installation directory (configs, data, docker-compose, .env)
440-
4. Unmount and remove the mount point
443+
3. Unmount and remove the mount point
444+
4. Remove the installation directory (configs, data, docker-compose, .env)
441445
5. Optionally remove Docker images to free ~5–8 GB of disk space
442446

443447
You'll be asked to confirm before anything is removed. Your TorBox account and cloud-stored media are not affected.

docker-compose.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
cap_add:
4141
- SYS_ADMIN
4242
healthcheck:
43-
test: ["CMD", "curl", "-sf", "http://localhost:8282"]
43+
test: ["CMD-SHELL", "curl -sf http://localhost:8282 || wget -qO- http://localhost:8282 || exit 1"]
4444
interval: 30s
4545
timeout: 10s
4646
retries: 3
@@ -53,6 +53,10 @@ services:
5353
security_opt:
5454
# Harmless on systems without AppArmor (e.g. CachyOS)
5555
- apparmor:unconfined
56+
deploy:
57+
resources:
58+
limits:
59+
memory: 1g
5660

5761
# ── Prowlarr ───────────────────────────────────────────────────
5862
# Indexer manager - feeds search results to Radarr & Sonarr.
@@ -84,6 +88,10 @@ services:
8488
start_period: 30s
8589
volumes:
8690
- "${CONFIG_DIR}/prowlarr:/config"
91+
deploy:
92+
resources:
93+
limits:
94+
memory: 512m
8795

8896
# ── Byparr ────────────────────────────────────────────────────
8997
# Cloudflare bypass proxy (Byparr - drop-in FlareSolverr replacement).
@@ -110,6 +118,10 @@ services:
110118
timeout: 10s
111119
retries: 3
112120
start_period: 30s
121+
deploy:
122+
resources:
123+
limits:
124+
memory: 1g
113125

114126
# ── Radarr ─────────────────────────────────────────────────────
115127
# Movie management - searches, grabs, and organizes movies.
@@ -144,6 +156,10 @@ services:
144156
- "${CONFIG_DIR}/radarr:/config"
145157
- "${DATA_DIR}:/data"
146158
- "${MOUNT_DIR}:/mnt/remote:rslave"
159+
deploy:
160+
resources:
161+
limits:
162+
memory: 1g
147163

148164
# ── Sonarr ─────────────────────────────────────────────────────
149165
# TV show management - searches, grabs, and organizes series.
@@ -178,6 +194,10 @@ services:
178194
- "${CONFIG_DIR}/sonarr:/config"
179195
- "${DATA_DIR}:/data"
180196
- "${MOUNT_DIR}:/mnt/remote:rslave"
197+
deploy:
198+
resources:
199+
limits:
200+
memory: 1g
181201

182202
# ── Seerr ───────────────────────────────────────────────────────
183203
# Media request & discovery frontend.
@@ -210,6 +230,10 @@ services:
210230
start_period: 60s
211231
volumes:
212232
- "${CONFIG_DIR}/seerr:/app/config"
233+
deploy:
234+
resources:
235+
limits:
236+
memory: 1g
213237

214238
# ── Plex ───────────────────────────────────────────────────────
215239
# Media server option 1 - streams your library to any device.
@@ -244,6 +268,10 @@ services:
244268
options:
245269
max-size: "10m"
246270
max-file: "3"
271+
deploy:
272+
resources:
273+
limits:
274+
memory: 4g
247275

248276
# ── Jellyfin ───────────────────────────────────────────────────
249277
# Media server option 2 (open-source) - streams your library.
@@ -281,3 +309,7 @@ services:
281309
options:
282310
max-size: "10m"
283311
max-file: "3"
312+
deploy:
313+
resources:
314+
limits:
315+
memory: 4g

0 commit comments

Comments
 (0)