mirror of
https://github.com/apidoorman/doorman.git
synced 2026-02-08 01:58:59 -06:00
3.9 KiB
3.9 KiB
Doorman Operations Runbooks
Overview
Operational playbooks for common gateway actions with exact commands and example responses. Unless noted, endpoints require an authenticated admin session (manage_gateway or manage_auth permissions as applicable).
Authentication (Admin Session)
- Set a base URL and use a cookie jar for convenience:
export BASE=http://localhost:3001export COOKIE=/tmp/doorman.ops.cookies
- Obtain a JWT session cookie via platform login:
- Command:
- curl -i -c "$COOKIE" -X POST
-H 'Content-Type: application/json'
-d '{"email":"admin@doorman.dev","password":"<ADMIN_PASSWORD>"}'
"$BASE/platform/authorization"
- curl -i -c "$COOKIE" -X POST
- Look for a
Set-Cookie: access_token_cookie=...;header. Use this cookie in subsequent commands.
- Command:
Cache Flush
- Purpose: Clear all in-memory/redis caches (users, roles, APIs, routing, etc.) and reset rate/throttle counters.
- Endpoint: DELETE
$BASE/api/caches - Requirements: Admin user with
manage_gatewayaccess; authenticated session. - Command:
- curl -i -b "$COOKIE" -X DELETE
-H 'Content-Type: application/json'
"$BASE/api/caches"
- curl -i -b "$COOKIE" -X DELETE
- Expected response:
- Status: 200 OK
- Body: {"message":"All caches cleared"}
Revoke-All Tokens (Per User)
- Purpose: Immediately revoke all active tokens for a specific user across workers/nodes (uses durable storage when configured).
- Endpoints:
- Revoke: POST
$BASE/platform/authorization/admin/revoke/{username} - Unrevoke: POST
$BASE/platform/authorization/admin/unrevoke/{username}
- Revoke: POST
- Requirements: Admin with
manage_authaccess; authenticated session. - Revoke command:
- curl -i -b "$COOKIE" -X POST
-H 'Content-Type: application/json'
"$BASE/platform/authorization/admin/revoke/alice"
- curl -i -b "$COOKIE" -X POST
- Expected revoke response:
- Status: 200 OK
- Body: {"message":"All tokens revoked for alice"}
- Unrevoke command:
- curl -i -b "$COOKIE" -X POST
-H 'Content-Type: application/json'
"$BASE/platform/authorization/admin/unrevoke/alice"
- curl -i -b "$COOKIE" -X POST
- Expected unrevoke response:
- Status: 200 OK
- Body: {"message":"Token revocation cleared for alice"}
Hot Reload (SIGHUP)
- Purpose: Reload hot-reloadable configuration without restarting the process.
- Signal-based reload:
- Prereq: Doorman started via
python backend-services/doorman.py startto createdoorman.pid. - Command:
- kill -HUP $(cat doorman.pid)
- Expected outcome:
- Process stays up; logs include "SIGHUP received: reloading configuration..." and "Configuration reload complete".
- Log level updates if
LOG_LEVELchanged; other reloadable keys apply immediately.
- Prereq: Doorman started via
- HTTP-triggered reload (alternative to SIGHUP):
- Endpoint: POST
$BASE/platform/config/reload - Command:
- curl -i -b "$COOKIE" -X POST
-H 'Content-Type: application/json'
"$BASE/platform/config/reload"
- curl -i -b "$COOKIE" -X POST
- Expected response:
- Status: 200 OK
- Headers: may include
X-Request-ID - Body contains
{ "data": { "message": "Configuration reloaded successfully", "config": { ... }}}
- Endpoint: POST
- Inspect current config and reload hints:
- Endpoint: GET
$BASE/platform/config/current - Command:
- curl -i -b "$COOKIE"
"$BASE/platform/config/current"
- curl -i -b "$COOKIE"
- Expected response:
- Status: 200 OK
- Body includes
data.configandreload_command: "kill -HUP $(cat doorman.pid)"
- Endpoint: GET
Notes
- Request IDs: Many admin endpoints include an
X-Request-IDresponse header for traceability; some utility endpoints (e.g., cache flush) may omit it. - Permissions: Cache flush requires
manage_gateway. Revoke endpoints requiremanage_auth. Config routes requiremanage_gateway. - Cookies: Browser and curl examples rely on
access_token_cookie; alternatively, platform APIs may return anaccess_tokenfield usable in Authorization headers where supported.