Skip to content

Admin Deployment & Operations

This document covers deployment methods, operations, and troubleshooting for the Admin service.

Use the admin-server service in docker-compose.yml:

admin-server:
build:
context: .
dockerfile: Dockerfile
container_name: rtc-full-admin-server
command: ["./rtc-agent", "admin", "serve"]
env_file:
- .env
environment:
DEBUG__ENABLED: "true"
ports:
- "28081:8081"
volumes:
- ./etc/admin.docker.yaml:/app/etc/admin.yaml:ro
- full-admin-server-keys:/app/etc/keys
depends_on:
migrate:
condition: service_completed_successfully
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped

Key Dependencies:

  • migrate: Database migration must complete before Admin starts
  • postgres: Shared database
  • redis: Required for rate limiting, login protection, OTP storage, policy sync
终端窗口
# 1. Generate JWT key pair
rtc-agent admin keygen
# 2. Create configuration file
cp etc/admin.example.yaml etc/admin.yaml
# Edit etc/admin.yaml for database, Redis, SMTP, etc.
# 3. Run database migration (if not already done)
rtc-agent migrate
# 4. Start Admin service
rtc-agent admin serve
ConfigDescriptionDefault
server.hostListen address0.0.0.0
server.portListen port8081
server.envRuntime environment (development/production)development
ConfigDescription
database.dsnPostgreSQL connection string
ConfigDescriptionDefault
redis.addrRedis addresslocalhost:6379
redis.passwordRedis passwordEmpty
redis.dbRedis database number0

Note: Redis is optional, but required for:

  • JWKS caching
  • Distributed rate limiting
  • Login protection
  • OTP storage
  • Policy sync (multi-instance deployment)
ConfigDescriptionDefault
jwt.algorithmSigning algorithm (RS256/ES256/EdDSA)RS256
jwt.issuerToken issuerhttp://localhost:8081
jwt.audienceToken audience (RTC Server URL)http://localhost:8888
jwt.private_key_pathPrivate key pathetc/keys/admin-private.pem
jwt.public_key_pathPublic key pathetc/keys/admin-public.pem
jwt.access_token_ttlAccess Token TTL (seconds)3600
jwt.refresh_token_ttlRefresh Token TTL (seconds)604800
ConfigDescriptionDefault
security.rate_limit_per_minuteMax requests per minute100
security.login_max_attemptsMax failed login attempts5
security.login_lock_durationAccount lockout duration (seconds)900
security.cookie_secureCookie Secure flag (enable for HTTPS)true
ConfigDescriptionExample
email.smtp_hostSMTP serversmtp.qq.com
email.smtp_portSMTP port587
email.smtp_userSMTP usernameSet via env var EMAIL__SMTP_USER
email.smtp_passwordSMTP passwordSet via env var EMAIL__SMTP_PASSWORD
email.from_addressSender emailadmin@example.com
email.from_nameSender nameRTC Agent
ConfigDescriptionDefault
otp.ttlVerification code TTL (seconds)300
otp.lengthCode length (digits)6
otp.send_cooldownSend cooldown (seconds)60
otp.max_send_per_ipMax sends per IP per minute5
otp.max_verify_attemptsMax verification attempts5
otp.lock_durationLockout duration (seconds)900
ConfigDescriptionDefault
features.permission_systemEnable Casbin RBAC permission systemtrue
features.password_enabledEnable password login (disable in production)false
ConfigDescription
prometheus_urlPrometheus URL
grafana_urlGrafana URL
jaeger_urlJaeger URL
pyroscope_urlPyroscope URL
终端窗口
# Generate default RS256 keys
rtc-agent admin keygen
# Generate ES256 keys
rtc-agent admin keygen --algorithm ES256
# Generate to specific directory
rtc-agent admin keygen --output-dir /app/etc/keys
# Force overwrite existing keys
rtc-agent admin keygen --force

Key Files:

  • admin-private.pem: Private key (must be kept secret)
  • admin-public.pem: Public key (for token verification)

After initial deployment, you need to create an admin account to log in to the Admin UI.

终端窗口
# Basic usage
rtc-agent admin account create --email admin@example.com --password your-password
# With display name
rtc-agent admin account create --email admin@example.com --password your-password --name "Admin"
# Create with role binding
rtc-agent admin account create --email admin@example.com --password your-password --name "Admin" --role admin

Parameters:

ParameterRequiredDescription
--emailYesAdmin email
--passwordYesLogin password
--nameNoDisplay name
--roleNoRole to bind (admin/operator/viewer)

Example Output:

✅ Admin user created successfully!
Email: admin@example.com
Name: Admin
ID: 550e8400-e29b-41d4-a716-446655440000
Binding role: admin
✅ Role bound successfully: admin
Please restart the server to reload permissions.

Note: After binding a role, restart the Admin Server to load new permissions.

If you didn’t specify a role during creation, or need to add roles later:

终端窗口
rtc-agent admin account bind-role --email admin@example.com --role admin

Available Roles:

RolePermissions
adminAll permissions (full control)
operatorOperations permissions (user management, config modification)
viewerRead-only permissions (view monitoring, logs)

Example Output:

✅ Found admin user: admin@example.com (ID: 550e8400-e29b-41d4-a716-446655440000)
✅ Found role: admin (ID: role-uuid)
✅ Created admin_user_role record
✅ Added Casbin grouping policy
Success! Admin user admin@example.com now has role: admin
Please restart the server to reload permissions.
终端窗口
# Execute inside admin-server container
docker compose exec admin-server ./rtc-agent admin account create \
--email admin@example.com \
--password your-password \
--name "Admin" \
--role admin
终端窗口
# Check service status
curl http://localhost:28081/ready
# Normal response
{"status":"ready"}
# Degraded mode
{"status":"degraded","error":"bootstrap failed — default roles may be missing"}
终端窗口
# Docker environment
docker logs rtc-full-admin-server
# Real-time logs
docker logs -f rtc-full-admin-server
终端窗口
# Docker environment
docker restart rtc-full-admin-server
# Check status
docker ps | grep admin-server

The Admin service supports multi-instance deployment, but requires Redis:

environment:
INSTANCE_COUNT: "2" # Number of instances

Redis-dependent features for multi-instance:

  • Distributed rate limiting
  • Login protection sync
  • OTP storage sync
  • Casbin policy sync

Warning: Without Redis in multi-instance deployment, these features fall back to per-instance memory mode with inconsistent data across replicas.

ProblemPossible CauseSolution
database connection failedDatabase not running or misconfiguredCheck database.dsn
redis unreachableRedis not runningCheck redis.addr; Redis is optional
jwt signer init failedKey files missingRun rtc-agent admin keygen
bootstrap failedDatabase migration incompleteRun rtc-agent migrate first
ProblemPossible CauseSolution
OTP send failedSMTP misconfiguredCheck email.* config
account lockedToo many failed attemptsWait for lockout period (default 15 min)
invalid tokenJWT key mismatchVerify Admin and RTC Server use correct keys
ProblemPossible CauseSolution
permission deniedRole not assigned or policy missingCheck Casbin roles and policies
bootstrap degradedDefault roles not createdCheck startup logs, verify migration completed