Skip to content

Commit a6f68f6

Browse files
authored
Merge pull request #59 from Unpackerr/docs/homepage-widget
Document a Homepage widget for queue stats
2 parents d331a93 + 688ef40 commit a6f68f6

7 files changed

Lines changed: 143 additions & 4 deletions

File tree

‎docs/downloaders/torrent.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ unlisted: true
55
description: Moved to Download Clients.
66
---
77

8-
This page moved to [Download Clients](/docs/unpackerr/download-clients).
8+
This page moved to [Download Clients](/docs/howto/download-clients).

‎docs/downloaders/usenet.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ unlisted: true
55
description: Moved to Download Clients.
66
---
77

8-
This page moved to [Download Clients](/docs/unpackerr/download-clients).
8+
This page moved to [Download Clients](/docs/howto/download-clients).
File renamed without changes.

‎docs/howto/homepage.md‎

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
id: homepage
3+
title: Homepage
4+
description: Show Unpackerr queue counts on a Homepage dashboard.
5+
---
6+
7+
[Homepage](https://gethomepage.dev/) can show Unpackerr queue counts with its
8+
[custom API widget](https://gethomepage.dev/widgets/services/customapi/).
9+
`GET /api/stats` returns those counts as JSON.
10+
11+
## API key
12+
13+
The widget calls Unpackerr on a timer. Give it a key from **Settings → Web
14+
server**. The header is `X-Api-Key`. `Authorization: Bearer` plus the same
15+
key also works. Details are on
16+
[API keys and metrics](/docs/install/web-ui#api-keys-and-metrics).
17+
18+
1. Under **Custom roles**, add a role named `homepage` and select
19+
`system:stats:read`.
20+
2. Under **API keys**, add a key, assign the `homepage` role, and
21+
**Generate** the secret. Save, then copy the key into `services.yaml`.
22+
23+
A key on the built-in `admin` role can read stats as well. The `homepage`
24+
role above is limited to this endpoint.
25+
26+
## services.yaml
27+
28+
Homepage fetches `url` from the Homepage process. That address has to open
29+
from the Homepage container or host. When both apps share a Docker network,
30+
use the Unpackerr service name and port `5656`. `href` is the link people
31+
click, so that one can be the public site.
32+
33+
With `urlbase` set to `/unpackerr`, the stats path is
34+
`http://unpackerr:5656/unpackerr/api/stats`.
35+
36+
```yaml
37+
- Unpackerr:
38+
icon: unpackerr
39+
href: https://unpackerr.example.com
40+
description: Automated Archive Extractions
41+
widget:
42+
type: customapi
43+
url: http://unpackerr:5656/api/stats
44+
headers:
45+
X-Api-Key: your-api-key
46+
refreshInterval: 10000
47+
display: block
48+
mappings:
49+
- field: queued
50+
label: Queued
51+
format: number
52+
- field: extracting
53+
label: Extracting
54+
format: number
55+
- field: finished
56+
label: Finished
57+
format: number
58+
- field: failed
59+
label: Failed
60+
format: number
61+
```
62+
63+
`icon: unpackerr` is the
64+
[dashboard icon](https://dashboardicons.com/icons/unpackerr).
65+
`refreshInterval` is milliseconds. `10000` is ten seconds, which matches the
66+
widget default.
67+
68+
## Fields
69+
70+
`queued`, `waiting`, `extracting`, `extracted`, `imported`, `deleted`, and
71+
`failed` are items in that state right now.
72+
73+
| Field | Meaning |
74+
| --- | --- |
75+
| `queued` | Queued for extract. |
76+
| `waiting` | Waiting, before the extract queue. |
77+
| `extracting` | Extract in progress. |
78+
| `extracted` | Extracted, waiting on import. |
79+
| `imported` | Imported by a Starr app. |
80+
| `deleted` | Deleted, or a delete still running. |
81+
| `failed` | Extract failed, or delete failed. |
82+
83+
Completed Starr downloads with no extractable files can remain in `waiting`.
84+
85+
`finished` and `retries` keep climbing for the life of the process.
86+
`finished` goes up when a deleted item ages out of history, and when you
87+
forget an item that was already deleted. `retries` goes up on each extract
88+
restart.
89+
90+
| Field | Meaning |
91+
| --- | --- |
92+
| `hookOK` | Webhook deliveries that succeeded. |
93+
| `hookFail` | Webhook deliveries that failed. |
94+
| `cmdOK` | Command-hook runs that succeeded. |
95+
| `cmdFail` | Command-hook runs that failed. |
96+
| `starrs` | Configured Starr apps. |
97+
| `folders` | Watched folders. |
98+
| `webhooks` | Webhooks. |
99+
| `cmdhooks` | Command hooks. |
100+
101+
Each internal channel is an object with `len` and `cap`. A Homepage field
102+
uses a dot, such as `stackXtractr.len`.
103+
104+
| Field | Channel |
105+
| --- | --- |
106+
| `stackXtractr` | Starr extract callbacks. |
107+
| `stackFS` | Folder-watch filesystem events. |
108+
| `stackFolder` | Folder-watch extract callbacks. |
109+
| `stackHook` | Webhook and command-hook delivery. |
110+
| `stackDel` | File deletes. |
111+
| `stackTask` | Config apply and queue actions. |
112+
113+
`starrQueues` contains one object per configured Starr app instance, ordered
114+
by app (Lidarr, Radarr, Readarr, Sonarr), then by sorted instance key.
115+
Check each entry's `app` and `name` before selecting its zero-based index.
116+
Each object has `app`, `name`, `url`,
117+
`queued`, `retrieved`, `complete`, `match`, `issues`, `downloading`,
118+
`updatedAt`, and `error`. `queued` on that object is the Starr activity
119+
queue. Unpackerr's own `queued` count is the table above.
120+
121+
```yaml
122+
- field: starrQueues.0.queued
123+
label: First app queued
124+
format: number
125+
```
126+
127+
Change the index to pick another app, and set the label to that app's name.

‎docs/install/seedbox.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ elif [ "$ARCH" = "armv7l" ]; then
4141
fi
4242

4343
# Construct the download URL.
44-
URL=$(curl -s https://api.github.com/repos/Unpackerr/unpackerr/releases/latest | grep -e "browser_download_url.*linux_$ARCH"| cut -d '"' -f 4)
44+
URL=$(curl -s https://api.github.com/repos/Unpackerr/unpackerr/releases/latest |
45+
grep -e "browser_download_url.*linux_$ARCH" |
46+
cut -d '"' -f 4)
4547

4648
# Download and extract the binary and the example config file.
4749
mkdir -p $HOME/unpackerr

‎docs/install/web-ui.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ non-proxy IP.
212212
Login uses the UI user. Prometheus and scripts use an API key
213213
(`X-Api-Key` or `Authorization: Bearer`). Create keys under **Settings → Web
214214
server**. Scrapes of `/metrics` need a key with `system:metrics:read`.
215+
`GET /api/stats` needs `system:stats:read`. A [Homepage](/docs/howto/homepage)
216+
widget reads that endpoint.
215217

216218
Need a hand? [Go Lift Discord](https://golift.io/discord) or
217219
[GitHub issues](https://github.com/Unpackerr/unpackerr/issues/new).

‎sidebars.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ const sidebars = {
1717
'install/configuration',
1818
'unpackerr/faq',
1919
'unpackerr/troubleshooting',
20-
'unpackerr/download-clients',
20+
{
21+
type: 'category',
22+
label: 'How-to',
23+
collapsed: true,
24+
items: [
25+
'howto/homepage',
26+
'howto/download-clients',
27+
],
28+
},
2129
{
2230
type: 'category',
2331
label: 'xt',

0 commit comments

Comments
 (0)