Skip to content

Commit 2a05eb8

Browse files
committed
Add one-shot basic-to-advanced upgrade flow
1 parent 0e0be06 commit 2a05eb8

5 files changed

Lines changed: 352 additions & 84 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ Optional flags when running from a local clone:
9797
bash bootstrap.sh --media-dir /Volumes/T9/Media --install-dir ~/mac-media-stack-advanced --non-interactive
9898
```
9999

100+
## Upgrading From Basic
101+
102+
Already running `mac-media-stack` and want to keep your existing library/configs?
103+
104+
Use the one-shot upgrader: [UPGRADE.md](UPGRADE.md)
105+
106+
```bash
107+
bash scripts/upgrade-from-basic.sh
108+
```
109+
100110
<details>
101111
<summary>See it in action</summary>
102112
<br>
@@ -165,6 +175,8 @@ bash scripts/vpn-mode.sh nord
165175
|--------|---------|
166176
| `scripts/setup.sh` | Creates folders, generates .env, copies config templates |
167177
| `scripts/doctor.sh` | Runs preflight checks (runtime, env, compose, ports) |
178+
| `scripts/upgrade-from-basic.sh` | One-shot migration from basic stack to advanced |
179+
| `scripts/doctor.sh` | Runs preflight checks (runtime, env, compose, ports) |
168180
| `scripts/configure.sh` | Auto-configures all service connections via API |
169181
| `scripts/health-check.sh` | Full stack health diagnostic |
170182
| `scripts/install-launchd-jobs.sh` | Installs all automation as background jobs |

SETUP.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ To run from a local clone with custom paths:
2222
bash bootstrap.sh --media-dir /Volumes/T9/Media --install-dir ~/mac-media-stack-advanced
2323
```
2424

25+
Already running the basic stack and want an in-place migration? Use [UPGRADE.md](UPGRADE.md).
26+
2527
---
2628

2729
## Prerequisites
@@ -217,6 +219,7 @@ bash scripts/install-launchd-jobs.sh
217219
This installs:
218220
- Auto-healer (hourly VPN/container health check + restart)
219221
- Nightly backup (configs + databases, 14-day retention)
222+
- Log prune (daily cleanup, removes logs older than 30 days)
220223
- Download watchdog (stalled torrent auto-fix every 15 min)
221224
- Kometa scheduler (metadata refresh every 4 hours)
222225
- Log prune (daily log cleanup with 30-day retention)

UPGRADE.md

Lines changed: 55 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,101 @@
11
# Upgrade Guide: Basic -> Advanced
22

3-
This guide upgrades an existing `mac-media-stack` install to `mac-media-stack-advanced` without losing your media library or app config.
3+
This guide upgrades an existing `mac-media-stack` install to `mac-media-stack-advanced` without moving your media library.
44

5-
## Before You Start
5+
## Recommended: One-shot upgrader
66

7-
- Stop any active downloads first (recommended).
8-
- Keep your existing `MEDIA_DIR` path exactly the same.
9-
- Do not run basic and advanced at the same time.
7+
Use the built-in migration script:
108

11-
## What Carries Over
12-
13-
If you reuse the same `MEDIA_DIR`, advanced will reuse your existing:
14-
15-
- Movies/TV library files
16-
- Radarr/Sonarr/Prowlarr/qBittorrent/Bazarr/Seerr configs
17-
- API keys and existing app state inside `${MEDIA_DIR}/config`
9+
```bash
10+
cd ~/mac-media-stack-advanced
11+
bash scripts/upgrade-from-basic.sh
12+
```
1813

19-
## 1. Backup (Required)
14+
### Common flags
2015

2116
```bash
22-
# adjust if your media path is not ~/Media
23-
MEDIA_DIR=~/Media
17+
# Non-default basic repo location
18+
bash scripts/upgrade-from-basic.sh --basic-dir /path/to/mac-media-stack
2419

25-
# backup media stack config/state quickly
26-
mkdir -p ~/media-stack-upgrade-backup
27-
cp -a "$MEDIA_DIR/config" ~/media-stack-upgrade-backup/config
28-
cp -a "$MEDIA_DIR/state" ~/media-stack-upgrade-backup/state 2>/dev/null || true
29-
cp -a "$MEDIA_DIR/logs" ~/media-stack-upgrade-backup/logs 2>/dev/null || true
30-
```
20+
# Override MEDIA_DIR (if different from basic .env)
21+
bash scripts/upgrade-from-basic.sh --media-dir /Volumes/T9/Media
3122

32-
If you already use the advanced backup repo/tooling, run that instead.
23+
# Fully non-interactive run (skips Seerr sign-in prompt in configure.sh)
24+
bash scripts/upgrade-from-basic.sh --yes --non-interactive
3325

34-
## 2. Stop Basic Stack
26+
# Skip backup snapshot (not recommended)
27+
bash scripts/upgrade-from-basic.sh --yes --skip-backup
3528

36-
```bash
37-
cd ~/mac-media-stack
38-
docker compose down
29+
# Start watchtower profile after upgrade
30+
bash scripts/upgrade-from-basic.sh --enable-watchtower
3931
```
4032

41-
## 3. Clone Advanced
33+
What the upgrader does:
4234

43-
```bash
44-
cd ~
45-
git clone https://github.com/liamvibecodes/mac-media-stack-advanced.git
46-
cd mac-media-stack-advanced
47-
```
35+
1. Validates basic + advanced repo paths
36+
2. Creates a backup snapshot (env + config/state/logs)
37+
3. Migrates shared env keys from basic to advanced
38+
4. Stops basic stack
39+
5. Runs advanced setup + preflight doctor checks
40+
6. Starts advanced stack
41+
7. Runs auto-configuration
42+
8. Installs launchd automation jobs
43+
9. Runs health checks
4844

49-
## 4. Configure `.env` for Existing Media Path
45+
## Manual upgrade (step-by-step)
5046

51-
Generate a starter `.env` if needed:
47+
If you prefer full manual control:
5248

49+
1. Backup:
5350
```bash
54-
bash scripts/setup.sh
51+
MEDIA_DIR=~/Media
52+
mkdir -p ~/media-stack-upgrade-backup
53+
cp -a "$MEDIA_DIR/config" ~/media-stack-upgrade-backup/config
54+
cp -a "$MEDIA_DIR/state" ~/media-stack-upgrade-backup/state 2>/dev/null || true
55+
cp -a "$MEDIA_DIR/logs" ~/media-stack-upgrade-backup/logs 2>/dev/null || true
5556
```
56-
57-
Open `.env` and confirm:
58-
59-
- `MEDIA_DIR` points to your existing library path from basic
60-
- your VPN keys are set (`WIREGUARD_PRIVATE_KEY`, `WIREGUARD_ADDRESSES`)
61-
57+
2. Stop basic:
6258
```bash
63-
open -a TextEdit .env
59+
cd ~/mac-media-stack
60+
docker compose down
6461
```
65-
66-
## 5. Run Preflight + Start Advanced
67-
62+
3. Prepare advanced:
6863
```bash
64+
cd ~/mac-media-stack-advanced
65+
bash scripts/setup.sh
6966
bash scripts/doctor.sh
70-
docker compose up -d
7167
```
72-
73-
## 6. Run Auto-Configuration
74-
68+
4. Start and configure:
7569
```bash
70+
docker compose up -d
7671
bash scripts/configure.sh
77-
```
78-
79-
This auto-wires:
80-
81-
- qBittorrent, Radarr, Sonarr, Prowlarr, Seerr
82-
- Recyclarr API keys
83-
- Unpackerr API keys (+ Unpackerr restart)
84-
85-
## 7. Complete Advanced-Only Manual Setup
86-
87-
Still manual by design:
88-
89-
- Kometa: add `PLEX_TOKEN` + TMDB API key in `${MEDIA_DIR}/config/kometa/config.yml`
90-
- Tdarr: configure libraries/plugins in Web UI (`http://localhost:8265`)
91-
92-
## 8. Install Automation Jobs
93-
94-
```bash
9572
bash scripts/install-launchd-jobs.sh
9673
```
97-
98-
This installs auto-heal, backup, watchdog, Kometa runner, and log-prune.
99-
100-
## 9. Validate
101-
74+
5. Validate:
10275
```bash
10376
bash scripts/health-check.sh
10477
```
10578

106-
Confirm:
79+
## Advanced-only follow-up
10780

108-
- core services show `OK`
109-
- VPN shows healthy
110-
- Plex can still see your existing libraries
81+
After either upgrade path, confirm:
11182

112-
## Optional: Enable Watchtower
83+
1. `~/Media/config/kometa/config.yml` has `PLEX_TOKEN` + TMDB key
84+
2. Tdarr libraries/plugins are configured at `http://localhost:8265`
85+
3. `bash scripts/health-check.sh` reports clean results
11386

114-
```bash
115-
docker compose --profile autoupdate up -d watchtower
116-
```
87+
## Rollback
11788

118-
## Rollback (If Needed)
89+
Quick rollback:
11990

12091
```bash
121-
# stop advanced
12292
cd ~/mac-media-stack-advanced
12393
docker compose down
12494

125-
# bring basic back
12695
cd ~/mac-media-stack
12796
docker compose up -d
12897
```
12998

130-
Because both stacks use the same `MEDIA_DIR`, rollback is quick.
99+
If you used the one-shot script, backup snapshots are saved under:
100+
101+
`~/media-stack-upgrade-backup/YYYYMMDD-HHMMSS/`

scripts/install-launchd-jobs.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# - Auto-heal (hourly)
44
# - Nightly backup
55
# - Download watchdog (every 15 min)
6+
# - Log prune (daily)
67
# - VPN failover (every 2 min, optional)
78
# - Kometa (every 4 hours)
89
# Usage: bash scripts/install-launchd-jobs.sh [--help]
@@ -98,6 +99,7 @@ echo ""
9899

99100
install_plist "auto-heal" 3600 "$SCRIPT_DIR/auto-heal.sh"
100101
install_plist "backup" 86400 "$SCRIPT_DIR/backup.sh"
102+
install_plist "log-prune" 86400 "$SCRIPT_DIR/log-prune.sh"
101103
install_plist "download-watchdog" 900 "$SCRIPT_DIR/download-watchdog.py" "false"
102104

103105
# Kometa one-shot (every 4 hours = 14400s)

0 commit comments

Comments
 (0)