-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml
More file actions
208 lines (188 loc) · 7.55 KB
/
config.yaml
File metadata and controls
208 lines (188 loc) · 7.55 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# ==============================================================================
# Aldertech Dynamic Resource Governor (ADRG) — Configuration Template
#
# Copy this file to /etc/adrg/config.yaml and edit for your environment.
# Sensitive values (API keys, tokens, passwords) can be provided as
# environment variables using ${VAR_NAME} placeholders, which are expanded
# at startup. Set them in /etc/adrg/adrg.env (installed by setup.sh).
# ==============================================================================
general:
poll_interval_seconds: 5
state_file: /run/adrg/state.json
log_file: /var/log/adrg/adrg.log
log_max_bytes: 10485760 # 10 MB
log_backup_count: 3
# HTTP server for /status and /trigger endpoints.
# Bind to 127.0.0.1 (default) for local access only.
# Set host: "0.0.0.0" only in trusted private networks.
http_server:
enabled: true
host: "127.0.0.1"
port: 8765
# ==============================================================================
# Container Tiers
# ==============================================================================
#
# Tier 0 — Core infrastructure : Maximum priority. Never throttled.
# Tier 1 — Interactive services : High priority. Protected during pressure.
# Tier 2 — Background tasks : Throttled during media playback.
# Tier 3 — Bulk / batch tasks : Paused during media playback.
# Restarted during memory emergencies.
#
# NOTE: All container names shown in this file are EXAMPLES of successfully
# tested configurations. You must add your own container names or glob
# patterns (e.g. "tdarr*") to these lists to manage them with ADRG.
#
tiers:
0:
name: "Core Infra"
containers: []
cpu_weight: 1000
io_weight: 1000
# No memory limits for Tier 0
1:
name: "Interactive"
containers: []
cpu_weight: 800
io_weight: 800
memory_high: "3G"
memory_max: "4G"
2:
name: "Background"
containers: []
cpu_weight: 100
io_weight: 100
memory_high: "1.5G"
memory_max: "2G"
3:
name: "Bulk"
containers: []
cpu_weight: 10
io_weight: 10
memory_high: "2G"
memory_max: "3G"
# ==============================================================================
# Protected Containers
# ==============================================================================
#
# ADRG will NEVER pause, throttle, or restart these containers, regardless
# of thermal, memory, or I/O pressure. Use this to safeguard DNS, reverse
# proxies, and other critical infrastructure.
#
protected_containers: []
# - pihole
# - nginx-proxy-manager
# - homeassistant
# ==============================================================================
# Media Mode
# ==============================================================================
#
# When active media streams are detected, Tier 3 containers are paused and
# Tier 2 containers have their CPU and I/O capped to preserve playback quality.
# A cooldown period applies before restoring containers after streams end.
#
# provider: jellyfin — Poll the Jellyfin /Sessions API
# plex — Poll the Plex /status/sessions API
# webhook — Controlled externally via POST /trigger
# none — Disable media mode entirely
#
# TIP: Use internal Docker service names for 'url' (e.g. http://jellyfin:8096)
# rather than external hostnames to avoid reverse proxy dependencies.
#
media_mode:
enabled: false
provider: jellyfin # jellyfin | plex | webhook | none
url: "http://jellyfin:8096"
api_key: "${ADRG_MEDIA_API_KEY}"
tier2_cpu_max_percent: 20
tier2_io_max_read_mb_per_sec: 10
tier2_io_max_write_mb_per_sec: 5
cooldown_seconds: 60
# Optional: throttle a download client when media is playing.
# The limit is removed automatically when media mode deactivates.
download_throttle:
enabled: false
provider: qbittorrent
url: "http://qbittorrent:8080"
username: "admin"
password: "${ADRG_QB_PASSWORD}"
limit_mb_per_sec: 5 # Download speed cap while media is active
# ==============================================================================
# Thermal Protection
# ==============================================================================
#
# Reads the maximum temperature across all thermal zones. Applies two
# escalating stages with hysteresis on recovery to prevent oscillation.
#
thermal:
enabled: true
warn_temp_c: 70 # Log warning only
stage1_temp_c: 75 # Pause Tier 3
stage2_temp_c: 80 # Pause Tier 2 + 3
recovery_temp_c: 65 # Must reach this temp before restoring
recovery_hold_seconds: 30 # Must hold below recovery_temp_c for this long
# ==============================================================================
# Memory Pressure
# ==============================================================================
#
# Uses Linux PSI (Pressure Stall Information) for accurate memory pressure
# detection. Applies three escalating stages:
# Stage 1: Squeeze memory.high on Tier 3 containers
# Stage 2: Restart the highest-RSS Tier 3 container (critical sustained pressure)
# Stage 3: Emergency restart (immediate, escalates to Tier 2 if Tier 3 exhausted)
#
# Requires PSI support in the kernel (/proc/pressure/memory).
#
memory_pressure:
enabled: true
some_avg10_threshold: 50 # % — triggers Stage 1 (PSI "some" 10s avg, squeeze memory.high)
critical_avg60_threshold: 40 # % — triggers Stage 2 (restart Tier 3)
emergency_full_avg10_threshold: 25 # % — triggers Stage 3 (emergency restart)
restart_cooldown_seconds: 300 # Min seconds between restarts per container
memory_high_reduction_factor: 0.75 # Multiply current RSS by this for new limit
# ==============================================================================
# I/O Pressure
# ==============================================================================
#
# Caps Tier 3 disk I/O when system-wide I/O pressure is high, using PSI.
# Recovery uses hysteresis: pressure must drop below recovery threshold
# and hold there for recovery_hold_seconds before caps are removed.
#
# Requires PSI support in the kernel (/proc/pressure/io).
#
io_pressure:
enabled: true
trigger_avg10_threshold: 60 # % — apply io.max caps to Tier 3
recovery_avg10_threshold: 20 # % — begin recovery countdown
recovery_hold_seconds: 30
tier3_io_max_read_mb_per_sec: 5
tier3_io_max_write_mb_per_sec: 2
# ==============================================================================
# Notifications
# ==============================================================================
#
# All backends are optional — leave empty or omit to disable.
# Multiple backends can be active simultaneously.
#
# notify_on controls which events trigger notifications.
# Remove events from the list to suppress those alerts.
#
notifications:
notify_on:
- daemon_start
- daemon_stop
- media_mode_activated
- media_mode_deactivated
- thermal_stage1
- thermal_stage2
- memory_critical_restart
- memory_emergency_restart
# Discord webhook
discord_webhook_url: "${ADRG_DISCORD_WEBHOOK_URL}"
# NTFY — self-hosted (https://github.com/binwiederhier/ntfy) or ntfy.sh
# Set ntfy_url to the full topic URL, e.g. https://ntfy.sh/my-adrg-topic
ntfy_url: "${ADRG_NTFY_URL}"
ntfy_token: "${ADRG_NTFY_TOKEN}" # Optional: bearer token for private topics
# Gotify — self-hosted push notifications (https://gotify.net)
gotify_url: "${ADRG_GOTIFY_URL}" # e.g. http://gotify.local
gotify_token: "${ADRG_GOTIFY_TOKEN}" # Application token from the Gotify UI