RAM usage, the Problems README, Recovery, Repairs, Rules Report, Security Report, Snap, Speed, Summary and Tests now open with what the feature is, links to read more, step-by-step use, how each number is computed and how it is implemented, and end with the commits that built it. Corrected from the code: the automatic board repair no longer un-binds lists (since #6515); Recovery's rule email section has Review, Resend, Mark as sent and Drop, and a section for legacy rule emails; Delete is under Settings; the Product name is in Settings / Appearance; Speed rows fold per kind of request, not per path; the RAM row detail has WeKan RSS and no load; the snap command falls back to MONGO_URL and prints the Databases section. Thanks to xet7 !
9.3 KiB
Admin Panel → Problems: snap commands
Status: Implemented · Owner: xet7 · Related: snap-src/bin/wekan-problems,
snap-src/bin/wekan-problems.mjs, snapcraft.yaml (apps: problems),
server/lib/systemStatus.js, models/lib/loginProblems.js,
models/lib/problemsOverview.js.
What it is
On the snap, the Admin Panel → Problems Status overview is also available as plain text from the server command line, so an admin who has server (snap) access can read it without being given Admin Panel access - and even when the web page does not load. It shows what migration or repair is running, which problems are detected, the login-page checks, and which copy of the data the snap is serving.
The command reads the live database directly over the MongoDB wire protocol
(MongoDB and FerretDB v1/SQLite both speak it; the snap runs one at a time on port
27019), using the bundled Node.js and mongodb driver — no mongosh needed. It
only reads; it never changes anything.
Read more
- Snap documentation - what a snap is and how
snap runworks. - WeKan in the Snap Store.
- MongoDB wire protocol - how the command talks to MongoDB and FerretDB alike.
- Load (computing) on
Wikipedia - the 1/5/15-minute load average the
cpucommand prints. - In WeKan: Problems README, Summary.md, Migrations.md, Login-Problems.md, CPU-usage.md.
How to use it
- Log in to the server that runs the WeKan snap (SSH or a console).
- Run
snap run wekan.problemsfor the whole overview. - Read In progress: if a migration or repair is listed, slow logins are expected until it finishes.
- Read Problems and the Login page checks; each line says what to change.
- Read Databases on this machine. If it says there are two copies and what
WeKan shows looks older than your work, run the
database-comparecommand it prints (it changes nothing). - For one part only, add its name:
migrations,login,broken-cardsorcpu(see the list below).
Commands
snap run wekan.problems # full Status overview (default)
snap run wekan.problems migrations # only migrations / repairs in progress
snap run wekan.problems login # only the login-page "Must be logged in" checks
snap run wekan.problems broken-cards # only the broken-cards count
snap run wekan.problems cpu # machine CPU load / core count (no DB needed)
snap run wekan.problems help
migrations and repairs are aliases for the same in-progress list. status
is the same as no argument. help (also -h, --help) prints the usage line.
How the numbers are calculated
From snap-src/bin/wekan-problems.mjs:
| Number | How it is computed |
|---|---|
| Broken cards | countDocuments of cards where boardId, swimlaneId or listId is null or ''. (The printed line also says "or bad type", but the count does not check the type.) |
| Database migration progress | collectionsDone/collectionsTotal collections while migrating, boardsDone/boardsTotal boards while repairing, from the text-migration document of text_migration_status. |
| Board data-repair progress | boardsDone/boardsTotal from the board-repair document of text_migration_status. |
| cores | os.cpus().length. |
| load average | os.loadavg(), printed with two decimals, for 1, 5 and 15 minutes. Sustained load near or above the core count means the machine is saturated. |
| uptime | os.uptime(), rounded to whole seconds. |
| Connection timeouts | 5000 ms to select a server and 5000 ms to connect; when they pass, the command prints could not read the database and exits with code 1. |
How it works in WeKan
What the overview prints
<Product name> Problems — Status
Database: mongodb://127.0.0.1:27019/wekan
In progress:
- Database migration (toFerretDB) — migrating: cards (3/30 collections)
- Board data-repair — 12/40 boards
(or) (none) No migrations or repairs are in progress.
Problems:
- [warning] Broken cards: 5 card(s) with a missing board/list/swimlane or bad type.
- [error] ROOT_URL: ROOT_URL is not set. ...
(or) (none) No problems detected.
Login page ("Must be logged in" / "Loading, please wait") checks:
[warning] Migration or repair — Logins may be slow ...
[ok] ROOT_URL — ROOT_URL=https://boards.example.com ...
...
More: wekan.problems cpu | login | migrations | broken-cards
Databases on this machine
-------------------------
Serving: ...
MongoDB files in /var/snap/wekan/common: yes
FerretDB database in /var/snap/wekan/common/files/db: yes
The heading uses the configured Product name (Admin Panel → Settings →
Appearance → Custom Product Name) when set, otherwise WeKan. (This page used
to name the pane Settings → Layout; the setting is in Appearance now.)
In progress is read from persisted status collections: the text-migration
and board-repair documents of text_migration_status, an active
recoveryStatus, running cronJobStatus jobs and a running
attachmentMigrationStatus.
Login page checks mirror models/lib/loginProblems.js: "Migration or repair" (a warning while anything is in progress), "ROOT_URL" (an error when it is not set), and the informational "LDAP is enabled" and "Running under Sandstorm" lines. A failing check is also listed under Problems.
Databases on this machine is printed by the shell wrapper
snap-src/bin/wekan-problems after the
overview (for no argument, status or databases): which database is being
served (database-role --why), whether MongoDB files and a FerretDB database
exist in $SNAP_COMMON, and, when both do, the database-compare and
database-merge commands to run. It reads only the files, so it works even
when the site is down.
Problem-specific detail: CPU
snap run wekan.problems cpu needs no database and prints the machine's core count
and 1/5/15-minute load average:
CPU usage
cores: 4 (...)
load average: 3.90 (1m) 3.40 (5m) 2.10 (15m)
uptime: ... s
Note: sustained load near or above the core count means the machine is saturated.
A migration/repair (see "wekan.problems") can push CPU up; it drops when it finishes.
If top shows the ferretdb process pegged near 100%/200% for a long time, the
FerretDB v1 (SQLite) backend is saturated under WeKan's poll load — the usual cause
of pages taking minutes, counts stuck at 0, and raw i18n keys. Mitigations: check
whether a migration/repair is still running (snap run wekan.problems migrations),
and check the reactivity mode below (snap set wekan wekan-ferretdb-oplog=false, then
migrate the text data across — see Migrations.md).
Notes
- The command connects to the database given as the second argument, else
WEKAN_PROBLEMS_URL, elseMONGO_URL, elsemongodb://127.0.0.1:27019/wekan, and always reads thewekandatabase. - "In progress" is read from persisted status collections (
text_migration_status,recoveryStatus,cronJobStatus,attachmentMigrationStatus), so it stays correct even if the WeKan server process restarts mid-migration. - The
loginchecks readROOT_URL,LDAP_ENABLEand Sandstorm from the environment. The wrapper loads the snap settings first (wekan-read-settings), sosnap set wekan root-url=...is what the check sees. - The
mongodbdriver is taken from the WeKan bundle inside the snap; when it cannot be found the command exits with a FATAL message. - The snap app is declared in snapcraft.yaml as
problems, with thenetworkandnetwork-bindplugs.
Tests
- tests/problemsStatus.test.cjs - the Status overview and the snap command agree.
- tests/snapProblemsDatabases.test.cjs - the "Databases on this machine" section.
Commits
- Revert reading the startup network file in the wrapper; MONGO_URL stays the fallback
- Use the live database URL in problem reports
- Say which copy of the data is being served
- Remove the snap database setting: the snap always uses FerretDB
- Load the snap settings so the ROOT_URL and LDAP checks see the real configuration
- Neutral check titles, so a failing check does not contradict itself
- First version of this page
- Add snap run wekan.problems and the Problems Status overview