Deploy path: pasar las variables de supervisión, o no hay panel que supervisar
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

"¿Cómo superviso los usuarios que se han creado, los que están logueados y todo eso?" — no se podía,
y la causa era de despliegue: `ADMIN_UIDS` es la ÚNICA forma de ser admin (nada en el código pone
`user.admin`), y este compose lista el entorno variable por variable, así que llegaba al host y nunca
al contenedor. Sin ella el servidor no ofrece `/api/admin/*`, `/api/me` responde `admin: false`, y la
fila "Admin dashboard" no aparece en Ajustes: el panel existe y no hay puerta.

Ahora el compose pasa las diez que faltaban: `ADMIN_UIDS`, `INVITE_ONLY`, `ALLOW_GUEST`,
`SESSION_DAYS` (los interruptores de la instancia) y `AUDIT_LOG`, `AUDIT_MAX`, `AUDIT_DAYS`,
`AUDIT_IP` (los límites del registro de actividad), más `VAPID_SUBJECT` y `REMINDER_TICK_MS`. Con los
`:-` de siempre: una instancia que no las ponga queda exactamente como estaba.

`docs/SELF_HOSTING.md` dice ahora, en el paso donde se habla de `ADMIN_UIDS`, que es la única puerta
de entrada al panel y cómo leer los ids de una instancia que ya corre (un `node -e` sobre db.json
dentro del contenedor, sin instalar nada).
This commit is contained in:
dsantillan committed 2026-09-23 19:48:36 -04:00
1 parent 91606d9c9e
commit cc257d2671
2 files changed
+28 -1

No files matched your search

+13 -1
View File
@@ -118,7 +118,19 @@ ALLOW_GUEST=0 # remove "Continue without account"
```
Register your own passkey profile first, then find your id in `./data/db.json` under `users[].id`
and put it in `ADMIN_UIDS`. You'll get an **Admin dashboard** link in Settings: who's training
and put it in `ADMIN_UIDS`.
**`ADMIN_UIDS` is the only way to become an admin** — nothing in the code ever sets `user.admin`, so
an instance that never sets this variable has no dashboard at all, and the *Admin dashboard* row does
not even appear in Settings (the app asks `/api/me`, which reports `admin: false`). On a deployment
whose compose lists the environment explicitly — `deploy/compose-build-at-deploy.yml` is one — the
variable also has to be *named* there, or it reaches the host and never the container. To read the
ids off a running instance:
```bash
docker exec <api-container> node -e \
"const d=require('/data/db.json');console.log(d.users.map(u=>u.id+' '+u.name).join('\n'))"
``` You'll get an **Admin dashboard** link in Settings: who's training
right now, each user's workout history and body weight, the ability to disable an account (signed
out and locked out everywhere until you re-enable it), and — with `INVITE_ONLY=1` — generating and
revoking invite codes. Existing accounts keep working when you switch invite-only on. Admin access