Skip to content

Commit 3d86854

Browse files
Document a Homepage widget for queue stats.
GET /api/stats is enough for Homepage's custom API widget, and the field list needs to match what that endpoint returns. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0ab9e44 commit 3d86854

3 files changed

Lines changed: 133 additions & 0 deletions

File tree

‎docs/howto/homepage.md‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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+
Items with nothing to extract are left out of these counts.
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` is one object per configured Starr app, in Settings order.
114+
`starrQueues.0` is the first app. Each object has `app`, `name`, `url`,
115+
`queued`, `retrieved`, `complete`, `match`, `issues`, `downloading`,
116+
`updatedAt`, and `error`. `queued` on that object is the Starr activity
117+
queue. Unpackerr's own `queued` count is the table above.
118+
119+
```yaml
120+
- field: starrQueues.0.queued
121+
label: First app queued
122+
format: number
123+
```
124+
125+
Change the index to pick another app, and set the label to that app's name.

‎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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ const sidebars = {
1414
],
1515
},
1616
'install/web-ui',
17+
{
18+
type: 'category',
19+
label: 'How-to',
20+
collapsed: false,
21+
items: ['howto/homepage'],
22+
},
1723
'install/configuration',
1824
'unpackerr/faq',
1925
'unpackerr/troubleshooting',

0 commit comments

Comments
 (0)