Edgeweir
Operations

Maintenance

Key rotation, database size and retention, background jobs, health checks, logs, monitoring, certificate rotation, disk usage, and account recovery.

Routine checks

CheckCommand or locationHealthy
Consolecurl -s http://127.0.0.1:3000/healthz; docker compose ps"status":"ok"; console is healthy
Error logdocker compose logs --since 24h console | grep -E '"level":"(warn|error)"'No recurring error
Needs attention"Needs attention" on the OverviewNot shown (nothing pending); see needs attention
NodesClusters & nodesNodes "Online" and "In sync", none "Data plane unhealthy", "Certificate expired", or "Upgrade required"
CertificatesCertificatesNone "Issuance failed"
AlertsAlertsThe latest delivery of each alert channel succeeded; see Alerts
BackupsThe backup directory or the platform's backup pageTime and size of the latest backup look right; see backup and recovery
Database and diskSee database and disk and resourcesGrowth matches the retention settings
VersionGitHub ReleasesThe running version is not behind a stable with security fixes

Master key rotation

Replaces EDGEWEIR_MASTER_KEY (for example when it may have leaked). Encrypted data in the database is re-encrypted with the new key at startup.

  1. Back up the database and .env; see backup and recovery.

  2. In .env, move the old value to EDGEWEIR_MASTER_KEY_PREVIOUS and set EDGEWEIR_MASTER_KEY to a new value:

    openssl rand -base64 32

    With files, use EDGEWEIR_MASTER_KEY_PREVIOUS_FILE and EDGEWEIR_MASTER_KEY_FILE.

  3. Recreate the console: docker compose up -d (./deploy.sh restart for deploy.sh deployments).

  4. Check the result:

    docker compose logs console | grep -E 'master key rotation|EDGEWEIR_MASTER_KEY_PREVIOUS'
    LogMeaningAction
    no envelope uses EDGEWEIR_MASTER_KEY_PREVIOUS any more: remove it and restart the consoleEvery ciphertext uses the new keyGo to step 5
    envelopes still use EDGEWEIR_MASTER_KEY_PREVIOUS: keep it setSome ciphertexts still use the old keyKeep the old key; investigate the cannot re-seal an envelope of the previous master key lines and restart
    envelopes sealed with neither master key cannot be openedSome ciphertexts were sealed by neither the new nor the old keyCheck that EDGEWEIR_MASTER_KEY_PREVIOUS is the key from before the rotation
  5. Remove EDGEWEIR_MASTER_KEY_PREVIOUS and recreate the console again.

  6. Store the new key offline; keep the old key until every backup from before the rotation has expired.

ItemDescription
ValidationStartup is refused when EDGEWEIR_MASTER_KEY_PREVIOUS equals EDGEWEIR_MASTER_KEY; both must be base64 of 32 or more bytes
Sessions and two-factorUnaffected: without BETTER_AUTH_SECRET, the session secret derived from the old key is stored in the database, sealed with the new key, and still used after EDGEWEIR_MASTER_KEY_PREVIOUS is removed
NodesNo action; the configuration receipts nodes keep are issued again under the new key with their next configuration fetch
Several console instancesRecreate every instance with the same variables
Backups from before the rotationStill sealed with the old key: set it as EDGEWEIR_MASTER_KEY_PREVIOUS when restoring
deploy.sh backupsDo not contain EDGEWEIR_MASTER_KEY_PREVIOUS

Session secret

BETTER_AUTH_SECRET signs session cookies and encrypts TOTP secrets and backup codes.

CaseResult
UnsetDerived from the master key; the session secret log line has source master_key, or stored after a master key rotation
Set to a new valueStartup warns BETTER_AUTH_SECRET changed: every session ends and enabled two-factor authentication can no longer be verified; turn it off on the server and enable it again; see account recovery
Removed from an existing deploymentStartup is refused: BETTER_AUTH_SECRET is not set, but this database was used with another secret; restore the original value
Master key leakedRotate the master key and set a new BETTER_AUTH_SECRET (openssl rand -base64 32, at least 32 characters)

Database

Size

docker compose exec -T postgres psql -U edgeweir -d edgeweir -c \
  "select pg_size_pretty(pg_database_size('edgeweir'))"
docker compose exec -T postgres psql -U edgeweir -d edgeweir -c \
  "select schemaname, relname, pg_size_pretty(pg_total_relation_size(relid)) from pg_statio_user_tables order by pg_total_relation_size(relid) desc limit 15"
Growth sourceControl
Access logs (EDGEWEIR_ANALYTICS=lite)Retention and the sites' sample rates; for high volume use ClickHouse; see access logs
Node logsRetention days and entries per node; see node log retention
Statistics, usage, security eventsRetention in the table below
Audit logNever deleted automatically

PostgreSQL autovacuum reclaims the rows the cleanup jobs delete; partitioned tables are cleaned by dropping partitions.

Retention

The worker runs the cleanup (ROLE all or worker); without a worker nothing is deleted.

DataKeptSetting
Access logsDefault 7 days; PostgreSQL 1–30 days, ClickHouse 1–90 days"Access logs" in System settings; see access logs
Node logsDefault 7 days (1–30), at most 10000 entries per node (1000–100000)"Node log retention" in System settings; see node log retention
Security eventsDefault 30 days (7–365)"Security event retention (days)" in Protection settings; see protection
UsageDefault 100 days (35–400)"Usage" in System settings; see usage
Traffic statisticsMinute buckets 7 days, hour buckets 90 days, day buckets 365 daysFixed
Configuration revisionsLatest 200 per cluster; the latest revision and the canary's stable and candidate revisions are always keptFixed
DNS revisionsLatest 200 per cluster; desired, applied, and held-back revisions are always keptFixed
Purge and preload tasks90 days after creationFixed
Expired bans1 hour after expiryFixed
Node enrollment tokens7 days after expiry or useFixed
API idempotency keys24 hoursFixed
Expired origin client certificates7 days after expiryFixed
Audit logNever deleted—

Background jobs

The worker uses pg-boss; its tables are in the database's pgboss schema. Cron times are UTC.

QueueSchedulePurpose
alerts.sweepEvery minuteAlert evaluation and delivery
mitigation.evaluateEvery minuteStarting and ending automatic mitigation
rollouts.evaluateEvery minuteAdvancing configuration canaries
dns.reconcileEvery minuteDNS record sync; drops replaced CNAME prefixes after 24 hours
traffic.rollupEvery minuteStatistics rollup and cleanup, usage and usage protection, access log partitions and retention, expiry of node upgrade tasks
certificates.sweepEvery minuteCertificate issuance and renewal
maintenance.recompileEvery startConfiguration recompile after an upgrade
maintenance.check-certificatesEvery startMarks uploaded certificates nodes cannot load
maintenance.link-acme-accountsEvery startLinks ACME certificates and accounts
maintenance.prune-bansEvery 10 minutesDeletes expired bans
maintenance.prune-node-logsEvery start and every 10 minutesDeletes node logs beyond retention or count, and old debug log pulls
maintenance.expire-enrollment-tokensEvery 30 minutesDeletes stale enrollment tokens
maintenance.rotate-challenge-keysMinute 11 of every hourRotates challenge keys older than 1 day
maintenance.rotate-session-ticket-keysMinute 13 of every hourRotates TLS session ticket keys older than 12 hours
maintenance.prune-revisionsMinute 17 of every hourPrunes configuration and DNS revisions
maintenance.rotate-origin-client-certificatesMinute 19 of every hourReplaces origin client certificates 30 days before expiry
maintenance.prune-idempotency-keysMinute 29 of every hourDeletes expired idempotency keys
maintenance.prune-security-eventsMinute 37 of every hourDeletes security events beyond retention
maintenance.expire-cache-tasksMinute 43 of every hourExpires undelivered purge and preload tasks and deletes old ones
maintenance.prune-oauthMinute 47 of every hourDeletes expired MCP access and refresh tokens, and clients nobody authorized within 30 days

Scheduling (probe reachability and scheduling rules) is evaluated every 10 seconds by an in-process timer; a lease lets one console process evaluate at a time.

Job states:

docker compose exec -T postgres psql -U edgeweir -d edgeweir -c \
  "select name, state, count(*) from pgboss.job group by 1, 2 order by 1, 2"

When the failed count grows, search the console log for errors of that queue. Do not delete tables in the pgboss schema by hand.

Health checks

CheckBehavior
GET /healthzReturns {"status":"ok","version":"<version>"}; only shows that the HTTP server runs, checks neither database nor worker; no sign-in needed
Container HEALTHCHECKedgeweir-healthcheck: interval 10 s, timeout 3 s, start period 30 s, 5 retries; succeeds at once with ROLE=worker, other roles request http://127.0.0.1:${PORT}/healthz with a 2-second timeout
Platform health checksPath /healthz
DatabaseNot covered by /healthz; a lost connection logs database connection lost
NodesHeartbeat every 15 seconds; "Online" with a heartbeat within 45 seconds

Logs

ItemDescription
FormatOne JSON object per line: time, level, msg, and fields; info and debug go to stdout, warn and error to stderr
LevelLOG_LEVEL: debug, info (default), warn, error
Viewingdocker compose logs -f console; ./deploy.sh logs console for deploy.sh deployments
RotationDone by the container runtime: Docker's json-file driver has no size limit by default; set log-opts in /etc/docker/daemon.json (for example "max-size": "50m", "max-file": "5")
Node logsLogs reported by nodes are viewed in the console; see node logs

Monitoring

ObjectMethod
Offline nodes, certificates, DNSAlert rules and alert channels; see Alerts
External reachabilityRegional probes check the nodes from each region; see regional probes
The console itselfExternal monitoring of https://<console>/healthz; alerts are sent by the console and stop when it stops
AuditManagement actions are written to the audit log

Automatic certificate and key rotation

ObjectLifetimeRotation
Site certificates (ACME)Set by the CAcertificates.sweep renews them per the renewal rules; failures show "Issuance failed" and are retried
Uploaded certificatesSet by the certificateNot renewed; upload a new certificate before expiry
Node channel server certificate90 daysChecked hourly; reissued with less than 30 days left or when its names change; log node channel certificate rotated
Node client certificates30 daysRenewed by the node; node details show "Expires soon" with less than 10 days left
Origin client certificates—Replaced 30 days before expiry
Challenge keys1 dayChecked hourly
TLS session ticket keys12 hoursChecked hourly
Node channel CA—Not rotated
Origin CA, origin client CA—Not rotated automatically; manual rotation in rotating the CAs

Disk and resources

ObjectCheckAction
Docker usagedocker system dfRemove old console images no longer used: docker image rm ghcr.io/marvinli001/edgeweir:<old tag>; keep the current and the previous version for a downgrade
PostgreSQL volumedocker system df -v | grep postgres-dataSee database
ClickHouse volumedocker system df -v | grep clickhouse-dataShorten access log retention
Backup directorydu -sh backupsdeploy.sh keeps EDGEWEIR_BACKUP_KEEP backups; cron backups are cleaned as in scheduled backups
Memory and CPUdocker stats --no-streamRequirements in the deployment overview; splitting web and worker in process roles

docker compose down -v and docker volume prune delete volumes such as postgres-data: all data.

Account recovery

When sign-in is impossible (forgotten password, lost two-factor device, login IP allow list without the current address), run on the console's server:

docker compose exec console node dist/server/recover.js --reset-password --disable-two-factor

The options --reset-password, --disable-two-factor, and --clear-login-allowlist can be combined. Steps in account recovery; options, output, and exit codes in the command line reference.

Edit on GitHub

On this page