From cc257d26716d2b9fe23b48367891d11d46f55e1a Mon Sep 17 00:00:00 2001 From: Daniel Santillan Date: Wed, 23 Sep 2026 19:48:36 -0400 Subject: [PATCH] =?UTF-8?q?Deploy=20path:=20pasar=20las=20variables=20de?= =?UTF-8?q?=20supervisi=C3=B3n,=20o=20no=20hay=20panel=20que=20supervisar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "¿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). --- deploy/compose-build-at-deploy.yml | 15 +++++++++++++++ docs/SELF_HOSTING.md | 14 +++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/deploy/compose-build-at-deploy.yml b/deploy/compose-build-at-deploy.yml index 107de16..1f3dc2d 100644 --- a/deploy/compose-build-at-deploy.yml +++ b/deploy/compose-build-at-deploy.yml @@ -118,6 +118,21 @@ services: # file, so `COACH_PROVIDER` sitting in the panel while the container never sees it is a # configuration that looks applied and does nothing. The `:-` defaults are what keep an # instance that sets none of them exactly as it was: an empty value reads as unset. + # + # ADMIN_UIDS is the one that bites hardest: it is the ONLY way to become an admin (nothing in + # the code sets `user.admin`), and without it named here an instance has no dashboard at all — + # no user list, no activity log, no invites, and the "Admin dashboard" row never appears in + # Settings. The rest of these are the instance's own switches and the activity log's bounds. + ADMIN_UIDS: ${ADMIN_UIDS:-} + INVITE_ONLY: ${INVITE_ONLY:-} + ALLOW_GUEST: ${ALLOW_GUEST:-} + SESSION_DAYS: ${SESSION_DAYS:-} + AUDIT_LOG: ${AUDIT_LOG:-} + AUDIT_MAX: ${AUDIT_MAX:-} + AUDIT_DAYS: ${AUDIT_DAYS:-} + AUDIT_IP: ${AUDIT_IP:-} + VAPID_SUBJECT: ${VAPID_SUBJECT:-} + REMINDER_TICK_MS: ${REMINDER_TICK_MS:-} COACH_PROVIDER: ${COACH_PROVIDER:-} COACH_BASE_URL: ${COACH_BASE_URL:-} COACH_MODEL: ${COACH_MODEL:-} diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.md index 17e7c44..295df96 100644 --- a/docs/SELF_HOSTING.md +++ b/docs/SELF_HOSTING.md @@ -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 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