Configuration
The environment fixes the service identity, storage, and who the first admins are. It does not define boundaries. You manage those in the admin interface after the service starts.
Stratos reads its configuration from environment variables at startup. An invalid value stops the service and prints the variable name. Only STRATOS_SERVICE_DID has no default.
This page explains each group of settings. Every variable, with its default, is in Environment variables.
Service identity
STRATOS_SERVICE_DID="did:web:stratos.example.com"
STRATOS_PUBLIC_URL="https://stratos.example.com"
STRATOS_PORT=3100
STRATOS_SERVICE_FRAGMENT="atproto_pns"STRATOS_PUBLIC_URL defaults to http://localhost:3100. Set it in every real deployment. Stratos derives its OAuth client ID and both OAuth redirect URIs from it.
Keep the service DID stable. Every boundary identifier starts with it.
Enrollment modes
| Mode | Description | Use case |
|---|---|---|
open | Any AT Protocol user can enroll | Public services, testing |
allowlist | Only approved users or PDS hosts | Community deployments |
allowlist is the default.
Allowlist configuration
Allow specific users by DID:
STRATOS_ALLOWED_DIDS="did:plc:user1,did:plc:user2"Allow every user of specific PDS hosts:
STRATOS_ALLOWED_PDS_ENDPOINTS="https://community-pds.example.com"A user is allowed when they match either list.
External allow list
Stratos can also read an allow list from a URL. Set STRATOS_ALLOW_LIST_URI to enable it. STRATOS_ALLOW_LIST_BOOTSTRAP_NAME names the bootstrap entry, and the provider uses STRATOS_VALKEY_URL when it is set.
Boundaries
Boundaries live in the service database. You create, edit, and deactivate them in the admin interface. See Manage boundaries.
These older settings seed that database on the first start only:
STRATOS_ALLOWED_DOMAINS="general,fanart"
STRATOS_AUTO_ENROLL_DOMAINS="general"
STRATOS_ROOM_CATALOG_FILE="/etc/stratos/rooms.yaml"
STRATOS_SPACE_APP_ACCESS_FILE="/etc/stratos/space-app-access.json"Names are bare. Stratos qualifies each one with the service DID, so fanart becomes did:web:stratos.example.com/fanart. Clients send the qualified form.
When STRATOS_AUTO_ENROLL_DOMAINS is empty at the first start, the seed marks every allowed boundary for automatic enrollment. Later restarts ignore these settings. Remove them after you check the imported boundaries.
Reserved boundary
STRATOS_RESERVED_DOMAIN names the all-members boundary. It defaults to general. Every enrollment includes it, and it is always allowed. You do not need to list it in STRATOS_ALLOWED_DOMAINS.
The name must be a valid space key. Keep it stable. Startup fails when the reserved boundary is missing or inactive in the database.
One boundary per record
A record carries exactly one boundary. Stratos rejects a write with zero boundaries or more than one with InvalidDomainCount.
Service enrollments
A service enrollment gives a downstream service, such as the feed generator, read access to a set of boundaries without an OAuth flow.
# Inline JSON
STRATOS_SERVICE_ENROLLMENTS='[{"did":"did:web:feeds.stratos.example.com","boundaries":["general"]}]'
# A JSON file with the same shape
STRATOS_SERVICE_ENROLLMENTS_FILE="/etc/stratos/service-enrollments.json"Stratos merges both sources. A DID that appears twice stops startup.
[
{
"did": "did:web:feeds.stratos.example.com",
"boundaries": ["general", "fanart"]
}
]Each entry needs a unique did and at least one boundary. A boundary can be a bare name or a qualified identifier.
Configuration decides which service identities exist. On every start Stratos creates the declared identities, marks them isService = true, and removes service identities you no longer declare. User enrollments are never affected. A restart does not reactivate a declared identity that an operator deactivated. It stays inactive until zone.stratos.admin.setActive with active: true.
Configuration does not keep deciding their boundaries. The boundaries list applies when Stratos first creates the identity. After that, admins manage its membership in the admin interface, and a restart does not restore the original list.
Service identities are read-only. They cannot create records.
Admin authorization
Admin access uses OAuth only. There is no admin password.
STRATOS_ADMIN_DIDS="did:plc:operator1,did:plc:operator2"An operator opens https://stratos.example.com/admin/ and signs in with their AT Protocol account. The login requests the identity-only atproto scope. It grants Stratos no write access to the operator's repository.
A DID is an admin when it is on STRATOS_ADMIN_DIDS or an existing admin granted it in the Admins tab. DIDs on the configuration list cannot be revoked from the interface. They are your recovery path.
Set at least one DID before the first start. Only an admin can grant another admin, so an empty list with an empty database locks everyone out.
| Route | Purpose |
|---|---|
GET /admin/ | Admin interface |
GET /admin/oauth/authorize | Starts the admin login |
GET /admin/oauth/callback | Completes the login and creates the session |
GET /admin/whoami | Returns { did, isAdmin } for the session |
POST /admin/oauth/logout | Deletes the session and clears the cookie |
The session lives in the service database. The browser holds only a random key in the HttpOnly stratos_admin_session cookie. A session expires after 12 hours. Stratos checks on every request that the DID is still an admin.
Stratos rejects an admin request whose Origin or Referer is not the service's own origin.
The interface has four tabs: Health, Boundaries, Enrollments, and Admins. It is built with the service (pnpm build) and served from the same process.
Moderation services
STRATOS_MODERATION_SERVICE_DIDS is a comma-separated list of service DIDs. Stratos treats these services as moderation services.
STRATOS_MODERATION_SERVICE_DIDS="did:plc:nervmoderation"The default is empty. With an empty list, Stratos accepts no moderation service.
A moderation service authenticates with an AT Protocol service-auth JWT. Stratos checks these items:
- The audience is the DID of this service.
- The
lxmclaim names the exact method being called. Stratos rejects a token with nolxmclaim. - The token has not expired.
- The signature verifies against the DID document of the issuer.
- The issuer is on the list.
The moderation check returns the same message for every rejection. A caller cannot tell an unknown issuer from a wrong lxm claim. Stratos does not tell the caller why it rejected the request.
A record subject names the record by its URI. A takedown applies to every version of the record. Stratos refuses a record subject that carries a cid with SubjectCidNotSupported, and it stores nothing.
Reading labels with queryLabels
zone.stratos.moderation.queryLabels accepts a moderation service. It also accepts services that hold a service enrollment. A member's own enrollment does not qualify, and Stratos rejects it with a 401. To grant a service enrollment, list the service in STRATOS_SERVICE_ENROLLMENTS. Stratos creates the enrollment with the service flag on startup.
On queryLabels, service auth runs first. A moderation service with a wrong audience, an expired token, or a bad signature gets the ordinary service-auth message. It does not get the moderation message. Stratos applies the moderation check only to a token whose issuer is on the list. An issuer that is not on the list is an ordinary service, and it must hold a service enrollment.
Stratos shows each caller these labels:
- A moderation service reads every label.
- A service reads a record label only if it shares a boundary with the label.
- A service reads an account label if it shares a boundary with the member's enrollment. The enrollment can be active or not.
- A service never reads an account label when the member has no enrollment.
- A record label with no boundaries is visible only to moderation services.
- The reserved all-members boundary gives every service that holds a service enrollment the account label of every enrolled member. It also gives every record label that carries that boundary.
Reads stop serving the record at once. Stratos cannot stop a member's own PDS from serving a record to a holder of a space credential. Consumers must apply labels. The reserved-boundary statements hold while the reserved boundary is an active catalog entry.
Account takedowns and the operator hold
A moderation service can label a member's account as taken down. The subject is an accountSubject with the member's DID.
- A takedown deactivates the member's enrollment.
- A negation reactivates it only when no operator hold is set.
- Stratos rejects a DID with no enrollment as
SubjectNotFound. - Stratos rejects a service enrollment as an account subject.
- This works for members with
stratoscustody andpdscustody. - Stratos writes no record or blob marker for an account takedown.
While an account takedown stands, Stratos serves no record or blob of the member to any caller. Each read answers as it does when every record of the member is taken down:
com.atproto.repo.getRecord,zone.stratos.space.getRecordandzone.stratos.repo.hydrateRecordanswerRecordNotFound.zone.stratos.repo.hydrateRecordslists the member's URIs innotFound.com.atproto.repo.listRecords,zone.stratos.sync.listRecordPathsandzone.stratos.space.listBlobsleave out the member's records and blobs.- Both
getBlobmethods answerBlobBlocked. zone.stratos.space.listReposleaves out the member, as it does for every inactive member.com.atproto.repo.describeRepostill names the member's collections. A record takedown does not change it either.
A negation serves every record again at once. Stratos rewrites nothing. Each read asks the label log, so every Stratos process applies a takedown and its negation on its next read. An operator hold alone hides no record. It only drops the member from listRepos, which lists active members.
A pds-custody member's records are on their own PDS, which Stratos does not serve. listRepos already leaves out the inactive member, so the feed generator stops reading that PDS.
When an account label fails, the request either changes nothing or completes. Stratos changes the enrollment first, then records the label. If recording fails, Stratos sets the enrollment back from the label log and reports an error. Then the takedown or the negation has no effect. If Stratos records the label and a later step fails, the change is complete. Stratos still reports an error. Repeat the call after any error. A repeat is safe.
One limit applies. Recording the label and setting the enrollment back can both fail. Then the enrollment keeps the change until the moderation service repeats the call:
- After a failed takedown, the member is inactive and Stratos serves the records.
- After a failed negation, the member is active and Stratos hides the records.
An operator hold is separate. zone.stratos.admin.setActive with active: false sets it. active: true clears it. The two holds do not lift each other.
- While an account takedown is in force, activating the member fails with
AccountTakenDown. Nothing changes. - Members who were inactive when the hold was introduced became operator-held once.
- An inactive member who completes OAuth gets 403
EnrollmentDenied. Nothing changes. - An inactive member cannot unenroll.
POST /oauth/revokeand the XRPCzone.stratos.enrollment.unenrollboth refuse. Stratos keeps the row until the hold lifts. When a hold lands during an unenrollment that already deleted the member's enrollment record from their PDS, Stratos refuses and writes the record back through the PDS sync queue. - An inactive member cannot write.
createRecord,deleteRecord,applyWritesanduploadBlobare all refused withNotEnrolledbefore the handler runs. Updates go throughapplyWrites.
Consumers read account labels through queryLabels. A consumer that keeps copies of a member's records must drop them itself.
Takedown and the sync streams
A takedown changes what zone.stratos.sync.subscribeRecords and zone.stratos.sync.listRepoOps send. Stratos checks each record at the time it reads the frames.
- Both streams leave out the create and update ops of a record that is taken down now.
- While an account takedown stands, both streams leave out every create and update op of the member. A replay from any cursor does the same.
- Stratos skips an event that has no ops left.
- Delete ops always pass the takedown filter. The boundary scope rules still apply to them.
- A takedown never adds an event to either stream. Labels travel only through
queryLabels. - After a negation, a replay of the log serves the record again.
A takedown applies to sync frames that Stratos reads after it. A page that Stratos already read can still deliver the record once. Consumers must apply labels.
An account takedown sends nothing to a consumer that is already caught up. It must apply the account label from queryLabels to drop its copies. After the negation it reads the member again from the start of the stream. The Rust feed generator does both. A consumer that applies no labels keeps serving its copies until it reads the member again.
Deleting a taken-down record that carries a boundary sends a delete event. Subscribers in the record's boundaries receive it. This holds for a single delete and for a delete in a batch.
After a taken-down record is deleted, sync replays still leave out its create and update ops while the latest label is a takedown.
One limit applies:
- An author can delete a taken-down record and create a new one at the same URI. The new record has no takedown, so Stratos serves it. While it exists, sync replays serve it and the earlier history of that URI. If the author deletes it again, replays leave out every create and update for the URI while its latest label is a takedown. The delete op still arrives. Consumers that apply labels by URI still refuse the new record. To hide it on the host, the moderation service repeats
createLabel.
Moderation logs
Stratos writes one info entry, moderation label appended, for each label it stores. The entry has these fields:
seq: the position of the label in the label log.neg:truefor a negation,falsefor a takedown.subjectKind:recordoraccount.callerDid: the moderation service that sent the label.
The subject DID, the record URI, a CID and the ref stay out of the logs of createLabel and queryLabels. This applies to accepted and refused requests. The request log leaves out the subjects parameter of queryLabels. To find the subject of a seq, read the label log with queryLabels as a moderation service.
A refused request is logged with the message that the caller gets. If a subject is malformed, that message can quote the part that failed to parse.
Write rate limiter
Stratos throttles writes per DID to protect commit performance under bursts:
STRATOS_WRITE_RATE_MAX_WRITES=300 # writes allowed in the window
STRATOS_WRITE_RATE_WINDOW_MS=60000 # rolling window
STRATOS_WRITE_RATE_COOLDOWN_MS=10000 # cooldown after the limit
STRATOS_WRITE_RATE_COOLDOWN_JITTER_MS=1000 # spreads client retriesA throttled write returns HTTP 429 RateLimitExceeded. The limiter keeps its counters in process memory.
Signing keys
Stratos uses two kinds of key.
Service key. One secp256k1 key signs enrollment attestations, space credentials, and boundary history. Stratos creates it on the first start and keeps it in {STRATOS_DATA_DIR}/service-signing-identity.json with file mode 0600. The service publishes the public key in its DID document. No environment variable sets this key.
Rotate the service key with the offline stratos-rotate-service-key command. See Service signing key history.
Member keys. Stratos creates one P-256 key for each member whose records it hosts. That key signs the member's repository commits. Where it lives depends on the storage backend:
| Backend | Member key location |
|---|---|
sqlite | {STRATOS_DATA_DIR}/actors/{prefix}/{did}/signing_key |
postgres | The Stratos database |
A member whose own PDS hosts their records signs with their own key. See Mixed-mode custody.
Attestation lifecycle:
- Stratos signs an attestation at enrollment.
- Stratos signs a new one when the member's boundaries change.
- Unenrollment is a hard delete. Stratos removes the enrollment, the member's records and blobs, and the member key.
Database storage backend
| Backend | Description | Use case |
|---|---|---|
sqlite (default) | Per-member SQLite databases | Single node, development |
postgres | PostgreSQL with per-member schema | Production |
# SQLite (default)
STORAGE_BACKEND="sqlite"
STRATOS_DATA_DIR="/var/lib/stratos/data"
# PostgreSQL, connection URL
STORAGE_BACKEND="postgres"
STRATOS_POSTGRES_URL="postgres://user:pass@db.example.com:5432/stratos"
# PostgreSQL, individual parameters
STORAGE_BACKEND="postgres"
STRATOS_PG_HOST="db.example.com"
STRATOS_PG_PORT="5432"
STRATOS_PG_USERNAME="stratos"
STRATOS_PG_PASSWORD="secret"
STRATOS_PG_DBNAME="stratos"
STRATOS_PG_SSLMODE="require"STRATOS_POSTGRES_URL wins when both forms are set.
When Stratos builds the URL from STRATOS_PG_*, it adds sslmode=require unless you set STRATOS_PG_SSLMODE. Set STRATOS_PG_SSLMODE="disable" for a local database without TLS.
STRATOS_DATA_DIR is still required with postgres. It holds the service signing identity, local blobs, and static assets.
Pool sizes default to 200 connections for member transactions (STRATOS_PG_ACTOR_POOL_SIZE) and 3 for schema work (STRATOS_PG_ADMIN_POOL_SIZE). Keep the total below the database's max_connections.
Blob storage
| Provider | Description | Use case |
|---|---|---|
local (default) | Local filesystem | Single node, development |
s3 | S3-compatible storage | Production |
Local storage
STRATOS_BLOB_STORAGE="local"
STRATOS_DATA_DIR="/var/lib/stratos/data"{STRATOS_DATA_DIR}/blobs/{did}/{cid} # stored blobs
{STRATOS_DATA_DIR}/blobs/temp/{did}/{key} # uploads in progress
{STRATOS_DATA_DIR}/blobs/quarantine/{did}/{cid} # taken-down blobsS3-compatible storage
STRATOS_BLOB_STORAGE="s3"
STRATOS_S3_BUCKET="my-stratos-blobs"
STRATOS_S3_REGION="us-east-1"
# Static credentials. Omit both to use the instance or task role.
STRATOS_S3_ACCESS_KEY="AKIAIOSFODNN7EXAMPLE"
STRATOS_S3_SECRET_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
# MinIO or another S3-compatible service
STRATOS_S3_ENDPOINT="http://minio.local:9000"STRATOS_S3_BUCKET is required when the provider is s3.
stratos/blocks/{did}/{cid} # stored blobs
stratos/tmp/{did}/{key} # uploads in progress
stratos/quarantine/{did}/{cid} # taken-down blobsMigrating from disk to S3
Stop the Stratos service.
Sync the stored blobs:
bashaws s3 sync /var/lib/stratos/data/blobs/ s3://my-bucket/stratos/blocks/ \ --exclude "temp/*" --exclude "quarantine/*"Set
STRATOS_BLOB_STORAGE="s3"and the bucket settings.Start the service.
Valkey and the replay store
STRATOS_VALKEY_URL="redis://valkey:6379"Stratos uses Valkey, or any Redis-compatible server, for two jobs:
- Replay store. Space-credential delegation and client attestation use single-use tokens. Stratos records each token ID in Valkey. Without a replay store, those two paths refuse every request.
- Cache. Boundary lookups during hydration and the external allow list use it as a shared cache.
Ordinary OAuth record reads and writes work without Valkey. Set it for any deployment that serves a feed generator or space credentials.
OAuth client
Stratos is an OAuth client of each member's PDS. It generates and serves its own client metadata at /client-metadata.json and /.well-known/oauth-client-metadata.json. You do not host that file.
Set the consent screen with STRATOS_OAUTH_CLIENT_NAME, STRATOS_OAUTH_LOGO_URI, STRATOS_OAUTH_TOS_URI, and STRATOS_OAUTH_POLICY_URI. STRATOS_OAUTH_CLIENT_ID overrides the client ID, which defaults to {publicUrl}/client-metadata.json.
The redirect URIs are fixed: {publicUrl}/oauth/callback for enrollment and {publicUrl}/admin/oauth/callback for admin login.
STRATOS_OAUTH_CLIENT_SECRET holds a PEM private key. Without it, the client authenticates with none. With it, Stratos is a confidential client and uses private_key_jwt with ES256.
Stratos serves {STRATOS_DATA_DIR}/assets at /assets. Put a logo there and point STRATOS_OAUTH_LOGO_URI at {publicUrl}/assets/<file>.
STRATOS_ALLOWED_REDIRECT_ORIGINS lists origins the enrollment flow may redirect back to. A client that publishes its own client metadata document proves its redirect target and needs no entry. Each entry must be a valid URL, or startup fails.
DPoP authentication
Members call Stratos with the DPoP-bound access token their PDS issued.
- The client sends
Authorization: DPoP <token>and aDPoPproof header. - Stratos validates the proof: signature, method, URL, and a single-use ID.
- Stratos decodes the token and checks its expiry.
- Stratos checks that the token is bound to the proof key (
cnf.jkt). - Stratos checks that the token's subject is enrolled.
Stratos does not verify the access token's own signature. A PDS does not publish the key that signs its access tokens. The DPoP proof and the key binding carry the trust.
Stratos answers a request without a valid nonce with use_dpop_nonce and a DPoP-Nonce header. The client retries with that nonce.
PDS sync queue
Stratos publishes each member's enrollment record to the member's PDS. A PDS can be offline, so Stratos queues that write and retries it.
The worker's interval, batch size, timeout, backoff, and attempt limit are the STRATOS_PDS_SYNC_* variables. See the PDS sync queue category in Environment variables.
A boundary change succeeds locally before the PDS record catches up. Admins read the queue with zone.stratos.admin.listPdsSyncStatus. After a fault that failed many jobs at once, zone.stratos.admin.requeuePdsSync moves every failed job back to pending.
Observability
Telemetry is off until you configure it.
# Metrics over OTLP/HTTP
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="http://collector:4318/v1/metrics"
OTEL_METRIC_EXPORT_INTERVAL=15000
OTEL_RESOURCE_ATTRIBUTES="service.instance.id=stratos-1"
# Error reporting
SENTRY_DSN="https://key@sentry.example.com/1"
SENTRY_ENVIRONMENT="production"
SENTRY_RELEASE="0.3.1"The repository includes a sample collector configuration at observability/otel-collector.yml. See Operations for the metric names.
LOG_LEVEL sets log verbosity. It accepts fatal, error, warn, info, debug, trace, and silent.
Development mode
STRATOS_DEV_MODE="true"Never enable development mode in production
Development mode accepts Authorization: Bearer <did> with no proof. Any caller can act as any member.
Development mode also allows OAuth over plain HTTP and trusts loopback origins for redirects and admin requests. The value must be exactly true or false.
November upgrade
The upgrade to the November spaces contract has its own procedure. See November upgrade and rollback.
Environment variable reference
Every variable, with its default, is in Environment variables. Filter it by category, or show only the required ones.