Skip to content

Commands

This page is for the operator who runs commands against an Adiutor server. It covers how to run one on each kind of host, what each command does, and the commands that must never run on a server.

The commands are pnpm scripts in the app. They read the same settings the server does, so they work on the same database. They need the development dependencies, so never prune them (pnpm prune --prod).

With Docker Compose, a one-off container of the app service:

Terminal window
docker compose run --rm app pnpm <command>

With docker run, giving the settings the server uses:

Terminal window
docker run --rm --env-file .env bastolen/adiutor:0.5.0 pnpm <command>

The image sets NODE_ENV=production itself. A command that touches files on disk needs the same volume as the app.

Command What it does
pnpm db:migrate Brings the database to the schema of this release
pnpm setup:platform --staff-name … --email … --name … Names the staff and creates the first Admin
pnpm jobs:run Runs one tick of the background jobs
pnpm jobs:run <name> Runs one scheduled job now
pnpm jobs:list Lists every job with its state, last and next run
pnpm jobs:retry <id> or --kind <kind> Puts failed queued jobs back in the queue
pnpm jobs:discard <id> or --kind <kind> Discards failed queued jobs
pnpm sessions:revoke-all --yes or --user <email> Signs everyone, or one user, out everywhere

pnpm db:migrate applies the migrations the release brings. Run it with every release, before the new version serves traffic. Migrations only go forward. See Upgrading.

pnpm setup:platform names the staff and creates the first staff Admin, with --staff-name, --email and --name, and optionally --default-language (such as nl-NL) and --time-zone (such as Europe/Amsterdam). It refuses once Adiutor is set up. See First run.

  • pnpm jobs:run runs one tick and prints a line for each job that ran, or “Nothing was due.” It exits with 1 when a job failed, after the others ran, and 2 for a mistake in the command.
  • pnpm jobs:run <name> runs that scheduled job now, whether it’s due or paused. If it’s already running, it says so and exits with 1. An unknown name lists the jobs.
  • pnpm jobs:list prints each scheduled job with its schedule (UTC), whether it’s waiting, paused or running, and its last and next run. Then each kind of queued job with how many wait and failed, and the IDs of failed jobs.
  • pnpm jobs:retry and pnpm jobs:discard take a failed job’s ID, or --kind <kind> for every failed job of a kind, and say how many they changed.

How to schedule the tick is on Background jobs.

  • pnpm sessions:revoke-all --user [email protected] ends all of that user’s sessions and forgets the devices they trusted, so a stolen one asks for the second step again. They get a security email at the next tick of the background jobs.
  • pnpm sessions:revoke-all --yes does it for everyone. Nobody is emailed: tell people yourself. Without --yes or --user, the command refuses.

Both print how many sessions they ended and are recorded in the audit log. See After a suspected leak.

  • pnpm db:seed deletes all data and adds accounts whose passwords and authenticator secrets are public. It refuses to run when BETTER_AUTH_URL isn’t on this computer, or when NODE_ENV is production, but don’t rely on that.
  • pnpm db:seed:attachments adds test files to a development database.
  • pnpm db:generate creates new migrations from the code. It’s for developers.
  • pnpm auth:schema regenerates the sign-in library’s database schema. It’s for developers.
  • Never set EMAIL_OUTBOX_DIR or E2E_TESTS. They exist for the tests.

Adiutor at https://adiutor.dev runs on Docker Compose. After a laptop with a trusted device goes missing, Alex Admin runs docker compose run --rm app pnpm sessions:revoke-all --user [email protected]. The command prints how many sessions it ended, and Alex gets a security email at the next tick.

  • A command exits with 0 when it succeeded, so scripts and cron can rely on the exit code.
  • The commands keep database values out of their output, like the server does. See Logs and error references.

Adiutor's code is released under the MIT License. The Adiutor name and logo aren’t covered by it; see the notice.

Set in Inter and JetBrains Mono, under the SIL Open Font License (Inter, JetBrains Mono).