Deploying atproto-pds on Railway #
Written against a real deployment: vesuvius.pyroclastic.cloud, issuing
handles under *.dids.lol, one container, one volume, Mailgun for outbound
mail.
Substitute your own hostnames. Everything else applies as written.
What you are deploying #
One process and one writable volume. Everything durable — the accounts
database, each actor's own SQLite store, blobs, and the key store — lives
under PDS_DATA_DIRECTORY. There is no second service to run.
Dockerfile.pds at the repository root builds it. The other Dockerfile
builds the CLI tools and does not build the server; deploying that one and
expecting a PDS is the mistake this note exists to prevent.
1. Railway service #
Point the service at this repository. railway.toml names the Dockerfile,
the health check and the replica count, so there is nothing to configure by
hand there.
Volume. Attach one, mounted at /data. That path is the image's
PDS_DATA_DIRECTORY default, so no variable is needed to match them.
The Dockerfile carries no VOLUME instruction, deliberately: Railway refuses
to build one that does — "docker VOLUME at Line 40 is not supported, use
Railway Volumes" — and the instruction is unhelpful anyway. Its only effect
when no volume is supplied is to create an anonymous one, so a misconfigured
run writes a real database somewhere nobody will look for and nothing will
reattach to.
Confirm the volume is actually attached before the first deploy — Railway's service page lists it under Volumes, mounted at
/data. This matters more than it looks: withPDS_PRODUCTION=true, the server now refuses to start unless/dataalready exists, specifically so a missing or wrong-path mount fails the deploy instead of quietly succeeding. Without that check, every store here creates its own files on first use, so a missing volume did not error — it booted with a fresh, empty accounts database on the container's own throwaway filesystem, passed its health check, and looked exactly like a working server until the next deploy erased it. If the deploy log showsPDS_DATA_DIRECTORY (/data) does not exist as a directory, the volume is not attached; fix that before doing anything else.
Replicas. One. railway.toml pins this, and it is a correctness setting
rather than a capacity one: SQLite is the durable store, the volume attaches
to a single instance, and two replicas would run against separate copies of
the same repositories — both signing commits into divergent histories under
one DID.
Port. Do not set PDS_PORT. The image deliberately leaves it unset so the
binary falls back to the platform's PORT.
Check this before the first deploy. Railway's networking panel shows the port it routes to — 8080 in this deployment. If Railway does not also inject
PORT=8080, the server binds its own 4800 default, Railway routes to 8080, and the health check times out with nothing in the log to explain it. Either confirmPORTis injected, or setPORT=8080explicitly. SettingPDS_PORTinstead would appear to work and would defeat the fallback.
2. Environment #
Identity and handles #
PDS_SERVICE_DID=did:web:vesuvius.pyroclastic.cloud
PDS_HOSTNAME=vesuvius.pyroclastic.cloud
PDS_SERVICE_HANDLE_DOMAINS=dids.lol
PDS_SERVICE_HANDLE_DOMAINS may be written with or without a leading dot;
describeServer advertises the dotted form either way, which is what clients
concatenate against.
A handle domain's wildcard can be handed to Highport instead of being answered
here, which changes where every handle under it resolves from. That is
PDS_HIGHPORT_DOMAINS and the seven variables beside it; it is optional, off
by default, and §8 is the whole of it.
PLC directory #
PDS_DID_PLC_URL=https://plc.directory
Every account created against this is permanent and public. The PLC
directory is an append-only log; a DID created by a stray test cannot be
withdrawn, and its alsoKnownAs is visible to anyone. Keep invites required
from the first boot so that nobody — including you, by accident — creates one
before you mean to.
Secrets #
PDS_JWT_SECRET=<32+ bytes of randomness>
PDS_ADMIN_PASSWORD=<long random string>
PDS_PRODUCTION=true
PDS_DURABILITY_PROFILE=sql
PDS_JWT_SECRET must be at least 32 bytes; the server refuses to start
otherwise. The sentinel defaults baked into this crate — this JWT secret and
the admin password — are refused on every boot, not just a production one,
unless PDS_ALLOW_DEV_DEFAULTS=true says the deployment is unreachable by
anyone else, and that opt-in cannot be combined with PDS_PRODUCTION=true.
PDS_PRODUCTION=true additionally refuses did:web:localhost and the
in-memory durability profile — it is a guard against deploying a development
configuration by accident. It also turns on the address guard for every
request the server makes to a host somebody else named (a handle, a DID
document's endpoint, an OAuth client_id, an Atproto-Proxy target): a name
that resolves only to loopback, private, link-local or other non-public
addresses is refused, except the configured PDS_HOSTNAME, PDS_DID_PLC_URL,
PDS_BSKY_APP_VIEW_URL, PDS_REPORT_SERVICE_URL and PDS_ENTRYWAY_URL hosts.
Outside production
the guard is off, so a local PDS can reach fakes on localhost. A proxy set
with HTTPS_PROXY resolves names itself, so the guard then sees only the
proxy.
Operator-wide PLC rotation key #
Optional, and only effective before the first account: it is written into each account's genesis operation, so accounts created earlier will not carry it. It is the operator's recovery path for every identity this server issues.
PDS_PLC_ROTATION_KEY_PRIVATE=did:key:z42t…
One value, in the form key generators print. Make one with either:
goat key generate --type p256
cargo run -q --features clap,hickory-dns --bin atpdid -- key generate p256
and use the private did:key — did:key:z42t… for P-256, did:key:z3vL…
for K-256. Those are the two curves PLC accepts for a rotation key; a public
key, or any other curve, is refused at boot with a message naming this
variable.
The server logs the key's public form at startup, so a running deployment can be checked against the key you hold without the log ever carrying the secret.
Keep it offline. Nothing here can reproduce it.
Changing this later is safe; changing it to a different key is not, in the sense that accounts already created keep the key that was in force when their genesis operation was signed. Re-encoding the same key is fine.
Administration by DID #
PDS_ADMIN_DIDS=did:plc:cbkjy5n7bk3ax2wplmtjofq2
PDS_INVITE_REQUIRED=true
The DID above is @ngerakines.me. It needs no account on this server. With
it set, that identity can mint invite codes by signing a service-auth token
with the #atproto key in its own DID document — see §5.
Blobs in object storage (optional) #
Blob bytes are stored in each actor's SQLite file by default, which is what
the volume above is sized for. To keep them in a bucket instead, build the
image with object-storage added to its feature list:
docker build -f Dockerfile.pds \
--build-arg PDS_FEATURES=clap,smtp,metrics,hickory-dns,object-storage .
PDS_FEATURES is a build argument on Dockerfile.pds and
Dockerfile.pds-debug, defaulting to clap,smtp,metrics,hickory-dns, so the
list can be extended without editing either file. On Railway, set it under
the service's build settings; railway.toml names the Dockerfile and not the
argument. Then set:
PDS_BLOB_STORE_URL=s3://my-bucket/blobs
AWS_ACCESS_KEY_ID=…
AWS_SECRET_ACCESS_KEY=…
AWS_REGION=auto
AWS_ENDPOINT=https://<account>.r2.cloudflarestorage.com
s3://, gs://, az:// and file:/// are all accepted; AWS_ENDPOINT is
what points the S3 client at a non-AWS service.
Use the prefixed names above, not the short aliases object_store also
accepts (endpoint, region, bucket, token, …): the whole process
environment is offered to it, unfiltered, so an unrelated variable that
happens to share one of those bare names is picked up here too.
Everything except the bytes — references, the blob inventory, takedowns — stays in the per-actor SQLite, so the volume is still required and still holds the repositories.
A build without the object-storage feature refuses to boot when
PDS_BLOB_STORE_URL is set, rather than storing blobs on the volume as
though the variable were not there.
On a server that already has blobs, set PDS_BLOB_STORE_MIGRATE_LOCAL=true
for one deploy: the existing blobs move into the bucket in the background
while the server serves them from wherever they currently are. Once they have
moved, the bucket is load-bearing — a deploy without the variables refuses to
serve them.
Being crawled by the relay #
PDS_CRAWLERS=https://bsky.network
PDS_CRAWLER_ANNOUNCE_DELAY_SECS=15
Set this or your server is invisible. Nothing discovers a PDS on its own. Until a relay is told to crawl you, no AppView will ever see a record you host, including your own posts and profile.
The server announces itself to each entry at startup, so setting this is the
whole of what you have to do. It re-announces on every boot, which is harmless
— requestCrawl is idempotent.
It retries, and it needs to. The relay does not take the announcement on
trust: it tries to reach the hostname you gave it and refuses with a bare
400 if it cannot. During a deploy that is exactly the situation — the new
container is listening locally while Railway is still health-checking it and
draining the old one, so the moment the server naturally announces is the
moment it is least reachable. After PDS_CRAWLER_ANNOUNCE_DELAY_SECS,
attempts are spaced 0s, 15s, 1m, 3m and 15m apart, so they start about 0s,
15s, 1m15s, 4m15s and 19m15s in: about 19 minutes in all, plus up to 10
seconds for each attempt that times out. They stop at the first acceptance.
The delay is why the first attempt is the one that succeeds. Without it,
attempt 1 fires the moment the listener binds — while Railway is still
health-checking the new container — and the relay refuses it with a 400
saying it could not reach the host. The retry recovers a few seconds later, so
nothing breaks either way; what the delay removes is a warning on every
healthy deploy, which is the kind an operator learns to scroll past.
Set it to 0 if this server is reachable the instant it starts.
Watch for requestCrawl: announced in the logs. A refusal logs the relay's
own explanation, not just the status, and giving up entirely logs the curl
to run by hand.
Leave it unset only if you intend to stay off the public network. There is no warning when it is unset beyond a debug line, because a private PDS is a legitimate thing to run.
What it looks like when it is missing is the reason it is worth checking. The
server is completely healthy — writes commit, putRecord returns a real
commit CID, third-party tools read your records straight out of the repo — and
the AppView shows an empty profile, because it resolves your identity from
PLC independently of ever having seen your repo. Confirm from outside:
curl "https://relay1.us-west.bsky.network/xrpc/com.atproto.sync.getLatestCommit?did=<your-did>"
RepoNotFound means you have not been crawled. Announce by hand with:
curl -X POST https://bsky.network/xrpc/com.atproto.sync.requestCrawl \
-H 'Content-Type: application/json' \
-d '{"hostname":"vesuvius.pyroclastic.cloud"}'
Announcing publishes your repo to the public network. The relay will ingest it and so will anyone consuming the firehose, and records may stay cached or indexed after you delete them.
Behind Cloudflare #
PDS_TRUSTED_PROXY_HOPS=1
Railway reports "Cloudflare proxy detected" for both domains, which means
every request reaches the server from a Cloudflare address. Left at the
default 0, the rate limiter uses the TCP peer address, sees one client, and
throttles all of your users as though they were a single caller.
Set to the number of proxies you operate. 1 is right for Cloudflare in
front of Railway. Do not inflate it: the client address is taken that many
entries from the right of X-Forwarded-For, and a number larger than the real
chain lets a caller forge their own address by prepending entries.
Mail #
Use port 2525. Railway blocks outbound SMTP on the standard ports.
PDS_EMAIL_SMTP_URL=smtp://postmaster%40pyroclastic.cloud:<key>@smtp.mailgun.org:2525?tls=required
PDS_EMAIL_FROM_ADDRESS=noreply@pyroclastic.cloud
This one cost an afternoon, so it is worth stating plainly. Configured against
smtps://…:465 — which is the obvious choice, and which works from a
workstation — the deployed server sent nothing at all. Everything else checked
out: the domain verified in Mailgun, SPF and DKIM live, the credentials good,
the same URL delivering mail from a laptop, and Mailgun accepting a hand-rolled
message to the same recipient. Only the container could not reach the relay.
Cloud platforms commonly block outbound 25, 465 and 587 to stop their address space being used for spam. 2525 is the alternative port mail providers offer for exactly this reason, and it is not blocked.
Three things change together and all three are required:
smtps:// → smtp:// |
2525 is STARTTLS, not implicit TLS |
465 → 2525 |
the unblocked port |
?tls=required appended |
smtp:// with no tls parameter is plaintext, which Mailgun refuses |
Half-changing it fails, and fails the same silent way. smtps:// pointed at
2525 gives WRONG_VERSION_NUMBER; ?tls=none is not a value lettre accepts
at all.
Percent-encode the username: Mailgun's SMTP login is an email address, and the
@ in it will otherwise be read as the start of the host. And use the domain
Mailgun verified — if that is example.com, a From: on mg.example.com is
a different domain and gets rejected.
Both variables must be set. With either missing, the server logs a warning at boot and every mail-gated flow — password reset, email confirmation, account deletion — reports success and sends nothing.
Telling the three failures apart #
Every one of these looks identical from the outside, because these endpoints deliberately report success whether or not mail went — otherwise a probe could use them to discover which addresses exist. The logs are the only signal:
| log line | meaning |
|---|---|
email accepted by the relay … response=[…] |
delivered to the relay; the response carries the provider's queue id |
SMTP send failed … Connection error |
the port is blocked, or the host is unreachable |
email delivery is disabled; message not sent |
the two variables are not both reaching the container |
If the first line appears and mail still does not arrive, the problem is past the relay and the provider's own log will say so.
Confirming the address at signup (optional) #
PDS_SIGNUP_EMAIL_VERIFICATION=true
Signup then mails a link before it creates anything: the first form takes a handle, an email address and an invite code, and the link opens the rest of the form with those fixed. The account is created with its address confirmed, and createAccount over XRPC refuses a new account while the setting is on. It needs the mail settings above: in production the server refuses to start with this on and mail disabled. PDS_SIGNUP_EMAIL_HOURLY_LIMIT (default 100) caps how many links go out in an hour from everyone together. The crate README's "Signup email verification" section has the details.
Passkeys (optional) #
Passkeys let account holders sign in to the portal, and approve OAuth applications, with a passkey instead of their password. They are off until PDS_PASSKEY_RP_ID is set, because the value is permanent: a passkey works only under the RP ID it was created with.
PDS_PASSKEY_RP_ID=vesuvius.pyroclastic.cloud
Use this server's own host, or a parent domain of it if the server may later move to another host under that domain. The server refuses an RP ID that is neither, refuses to start when stored passkeys were created under a different one, and refuses the setting behind an entryway (§9), whose passkeys they are. PDS_PASSKEY_RP_NAME sets the name passkey providers show beside it; it defaults to the RP ID. Leave PDS_PASSKEY_SIGNAL_DELETIONS off: iOS 26 has been seen to delete a different account's passkey on the same RP ID when it receives the Signal API's deletion signals.
Holders add passkeys in Settings, sign in with one (a button, and the identifier's autofill), sign in with one on the authorization pages to approve an application, confirm who they are with one before a sensitive change, and may drop the password once they hold two passkeys or one that syncs. A password reset holds passkey removal and email changes for 72 hours. When a holder loses a device, atproto-pds-admin passkeys list <did> and passkeys remove <did> <credential-id> --end-sessions are the support path; the last passkey of an account with no password goes only with --send-password-reset. Before a release that touches passkeys, run tools/passkey-browser/ci.sh. The crate README's Passkeys section has the rest.
Password reset with a recovery key (optional) #
"Forgot your password?" on the sign-in page and the authorization sign-in step, and its email reset, need nothing but the mail settings above. The second way, "Use a recovery key", is off until it is turned on:
PDS_RECOVERY_KEY_RESET=true
PDS_RECOVERY_TOKEN_MAX_LIFETIME=5m
It resets a password for whoever signs a token with a rotation key on the account's did:plc that is not the operator's or this server's (never PDS_PLC_ROTATION_KEY_PRIVATE, the account's own rotation key or #atproto) and that ranks above every key this server holds. The crate README's Password reset section has the rule and why rank matters. It needs PDS_DID_PLC_URL, and is ignored with a warning without it, and behind an entryway (§9), where the entryway's setting decides. PDS_RECOVERY_TOKEN_MAX_LIFETIME is the longest a token may live; leave it at the default, 5m, unless holders need longer to get a token across from an offline machine. It takes 1 to 60 minutes, and the server refuses to start outside that whether or not the reset is on. Either kind of reset ends every session and app password, starts the 72-hour hold and mails the holder.
Ship a release with it off and smoke-test that first; the email reset and Settings' Recovery key page work either way. Then turn it on and walk one reset through with a throwaway account: generate a key with atpdid key generate k256, add its public half on the account's Recovery key page, mint a token with atpdid recovery-token --did <its DID> --aud <this server's DID> --key <file> (the forgot page prints the exact command), reset the password with it, and check the mail, the hold in Settings, and that the account's sessions and app passwords are gone. Only then tell holders. Most accounts have no key of their own until the holder adds one, so the reset helps an account only after that.
3. DNS #
Railway #
| record | name | value |
|---|---|---|
| CNAME | vesuvius.pyroclastic.cloud |
the target Railway gives you |
| CNAME | *.dids.lol |
the target Railway gives you |
The wildcard is what makes handle resolution work without a record per
account. A handle resolves either by a DNS TXT record at
_atproto.<handle> or by an HTTPS GET /.well-known/atproto-did against the
handle's own hostname — and the PDS answers the latter for any Host it is
asked about. With *.dids.lol routed here, atproto-com-lexicons.dids.lol
resolves the moment the account exists, with no DNS change.
If the base is delegated to Highport (§8) that wildcard points at
go.highport.space instead, and this server stops answering for names under it
at all: a handle then resolves because Highport holds a reservation for it.
Mailgun #
Mailgun will give you its own records for the sending domain. All of them matter, and for different reasons:
- TXT (SPF) and TXT (DKIM) — without these your confirmation and password-reset mail is spam-filtered, which looks exactly like the server failing to send.
- MX — only needed if you want to receive at the domain.
- CNAME (tracking) — optional.
Verify the domain in Mailgun before relying on it. A domain in Mailgun's "unverified" state accepts SMTP submissions and delivers nothing.
4. First boot #
curl https://vesuvius.pyroclastic.cloud/
should answer in plain text with the host, DID and version. The version ends
in +<commit>: on a deploy triggered from GitHub, the commit Railway built.
+unknown means the build was given none, which is what a railway up
deploy gets unless BUILD_REV is set as a service variable; the PDS README's
container section has the recipe. Then:
curl https://vesuvius.pyroclastic.cloud/xrpc/_health
curl https://vesuvius.pyroclastic.cloud/xrpc/com.atproto.server.describeServer
describeServer should report did:web:vesuvius.pyroclastic.cloud,
availableUserDomains: [".dids.lol"] and inviteCodeRequired: true. If the
DID is wrong here, stop and fix it before creating anything: it is baked into
every account this server issues.
5. Minting the first invite #
There is no account on the server yet, so there is no session to authenticate
with. createInviteCode also accepts the admin password directly (the same
PDS_ADMIN_PASSWORD from §2), which is the simplest path for a first code —
either the CLI:
atproto-pds-admin --base-url https://vesuvius.pyroclastic.cloud \
--admin-password "$PDS_ADMIN_PASSWORD" \
invite create --count 1
or the equivalent HTTP Basic auth call directly:
curl -X POST https://vesuvius.pyroclastic.cloud/xrpc/com.atproto.server.createInviteCode \
-u "admin:$PDS_ADMIN_PASSWORD" \
-H 'content-type: application/json' \
-d '{"useCount":1}'
atproto-pds-admin is not in Dockerfile.pds. Dockerfile.pds-debug and
crates/atproto-pds/Dockerfile carry it, at /usr/local/bin/atproto-pds-admin,
or build it locally: cargo build --features clap --bin atproto-pds-admin is
all it needs (the crate README's "Building" section builds it alongside pds
with the image's full feature set). Run it from wherever you have it, pointed
at the deployed origin with --base-url.
If you would rather not hand the admin password to whoever mints codes,
PDS_ADMIN_DIDS is the alternative: from a machine holding
@ngerakines.me's credentials, ask its PDS for a service-auth token scoped to
this server and this one method:
com.atproto.server.getServiceAuth
aud = did:web:vesuvius.pyroclastic.cloud
lxm = com.atproto.server.createInviteCode
exp = <a few minutes out>
Then present it here:
curl -X POST https://vesuvius.pyroclastic.cloud/xrpc/com.atproto.server.createInviteCode \
-H 'authorization: Bearer <that token>' \
-H 'content-type: application/json' \
-d '{"useCount":1}'
The token proves which identity asked, is good for one method, and expires in minutes — none of which a shared admin password can claim.
Either way, an administrator with no account here mints a code attributed to nobody. That is intended.
6. Creating the identity #
Open https://vesuvius.pyroclastic.cloud/account/signup.
Fill in the handle (atproto-com-lexicons), an email address, a password, and
the invite code from §5.
Bringing your own keys #
Expand Advanced — bring your own keys. Both fields are optional and independent.
Generate them with goat key generate, which prints a did:key:z42t…
string. The bare multibase form is accepted too.
Signing key becomes the account's #atproto verification method. This
server signs your commits with it, so it must be a private key; a public one
is refused with an error saying so. Leave it empty and one is generated.
Rotation key is listed ahead of this server's own. PLC gives earlier
rotation keys authority over later ones, so yours outranks the server's: you
can move or recover this identity without its cooperation. Only the public
half is used and it is never stored, so pasting the private key — which is
what goat gives you — costs you nothing. The server still adds its own key
after yours, so it can keep operating the account normally.
Keep both keys. The rotation key especially: it is the one thing this server cannot reproduce for you, and it is what makes the identity yours rather than the server's.
Afterwards, confirm the document says what you expect:
curl https://plc.directory/<did>/data
rotationKeys[0] should be the public form of the key you supplied, with the
server's after it, and verificationMethods.atproto should be the public form
of your signing key.
7. Signing in to Bluesky #
At bsky.app, choose to sign in with a custom hosting provider and give
vesuvius.pyroclastic.cloud. Sign in with the handle and password.
That flow uses OAuth: the client fetches this server's authorization metadata,
pushes an authorization request, redirects you to /oauth/authorize here to
approve, and exchanges the code for a DPoP-bound token. If it fails, the
server's log names the reason — the OAuth surface reports specific errors
rather than a generic refusal.
8. Highport domain delegation #
Optional, and off unless PDS_HIGHPORT_DOMAINS is set. It changes who answers
for the handles this server issues, not which handles it will issue.
Without it, *.dids.lol points here and this server answers
/.well-known/atproto-did for every name under it (§3). Delegation points that
wildcard at Highport instead. Highport answers the well-known from a
reservation row, so after the cutover a name under the base resolves only if
this server has reserved it there — for the right DID, for as long as it
should resolve. The PDS reserves at signup, moves the reservation on a rename,
and releases it when the account stops being publicly readable. What it buys is
that the base's names become Highport's to serve: one hostname is both a handle
and somewhere its holder can publish a site.
Everything below is about keeping the reservations and the account table in agreement, because nothing else makes a handle resolve.
Prerequisites #
A controller account hosted on this server. Not the server's own
did:web — Highport refuses owner-scoped calls from anyone who has not
accepted its policies, accepting them is a repo-backed act, and the server's
did:web document publishes no verification method to sign with. So it is an
ordinary account here, signed in to the Highport hub once to accept the
policies. It must stay active, and the #atproto key its DID document
publishes must be the key this server signs with: Highport verifies against the
published one, so a key rotated anywhere else turns every call into a refusal.
The base registered and verified there by that account. register the
domain, publish the _bard.dids.lol TXT record it returns, then verify until
the status is verified.
Wildcard certificate mode, before any backfill. A reservation answers the
well-known as soon as its row commits, but HTTPS still needs a certificate.
Under a stored wildcard the name is covered as soon as the activation sweep
lifts the hold; under per-name every reserved name waits for a slot in a
40-a-week budget, which is a backfill that appears to work and then stalls at
about forty names.
Get the CAA records right before asking for the grant. A base gets one
wildcard grant per BARD_CONTROL_CERT_GRANT_COOLDOWN_HOURS (24 by default),
and a new grant is refused outright while a previous wildcard is retiring — so
a grant ended to fix a CAA mistake costs a day. Read the zone's existing CAA
records first, add issuewild pinned to Highport's ACME account while keeping
what is already there, then call setCertificateMode with mode: wildcard and
acknowledgeCertificateGrant: true, publish the _acme-challenge.dids.lol
CNAME it returns exactly as given — DNS-only, not proxied — and wait until
getDomain reports delegation.wildcardObservedAt. Issuance is DNS-01, so
none of this needs traffic routed to Highport yet.
maxNames above the account count, with headroom. It is the base's ceiling
on live reservations, it is raised on the Highport side
(BARD_CONTROL_DELEGATION_MAX_NAMES), and a base sized exactly to its accounts
cannot rename anybody — see the sharp edges below.
A clean zone beneath the base. Any DNS record at or beneath a name that
should be reserved takes that name out of the wildcard's reach. The usual
culprits are the _atproto.<name>.dids.lol TXT records that were how handles
resolved before, and they are worth hunting down: the name keeps resolving
until the cutover and then quietly stops, with nothing in this server's log to
say why. Check over DNS-over-HTTPS rather than local dig, which caches:
curl -s -H 'accept: application/dns-json' \
'https://cloudflare-dns.com/dns-query?name=_atproto.alice.dids.lol&type=TXT'
Configuration #
Eight variables, all read once at startup.
| Variable | Default | What it does |
|---|---|---|
PDS_HIGHPORT_DOMAINS |
empty — off | Comma-separated delegated bases. Each must also appear in PDS_SERVICE_HANDLE_DOMAINS; a leading dot is stripped and the value lowercased. |
PDS_HIGHPORT_CONTROLLER_DID |
none, required once a base is set | The account here that registered the bases. Its signing key signs every call. |
PDS_HIGHPORT_SERVICE_URL |
https://highport.space |
Highport's origin. Calls are built as <url>/xrpc/<nsid>, so it takes no path, query or fragment. |
PDS_HIGHPORT_SERVICE_AUD |
did:web:highport.space#bard_control |
The aud claim of every token. Compared exactly on the far side, so a wrong value refuses every call rather than some of them. |
PDS_HIGHPORT_ON_FAILURE |
refuse |
What a signup does when its reservation fails for a reason that is not a conflict over the name. refuse fails the request, leaving no account and no PLC operation; defer creates the account anyway and accepts a handle that does not resolve until reconcile repairs it. A name already held by another subject refuses under both — it will still be held on the retry. |
PDS_HIGHPORT_SEND_GENESIS_OP |
true |
Send the signed PLC genesis operation with a fresh signup's reservation, so Highport can check offline that the DID and the handle belong together. |
PDS_HIGHPORT_DRY_RUN |
false |
Log every write instead of sending it. Reads still happen, so a dry-run deployment still reports what it would change, and no signup is blocked by a write that was not sent — whatever PDS_HIGHPORT_ON_FAILURE says. |
PDS_HIGHPORT_TIMEOUT_MS |
5000 (100–60000) |
Total budget for one call. The reserve at signup is inline, on a request a client is waiting on, so this is a share of signup latency rather than a background allowance. |
Two of those defaults are worth the reasoning behind them.
PDS_HIGHPORT_SERVICE_URL is https://highport.space because that is where
bard mounts /xrpc, in its control role — the one that also serves the Hub and
the public site. go.highport.space is a different role on a different
hostname, the edge that serves customer sites by Host header, which is what a
delegated wildcard points at rather than an API origin.
PDS_HIGHPORT_ON_FAILURE ships as refuse because defer creates accounts
whose handles do not resolve until reconcile runs, and a handle that does not
resolve reads as broken both to the account holder and to the AppViews looking
them up; a refusal is a clear 503 with Retry-After. Either is one variable to
change.
A configuration that could not work is refused at boot with every complaint at
once: a base missing from PDS_SERVICE_HANDLE_DOMAINS — this server would
never issue a handle under it, so nothing would ever be reserved — a base
nested under another base, a missing or unparseable controller DID, a service
URL that is not a bare origin or is not https under PDS_PRODUCTION, an
audience that is not a DID.
Then, once the accounts database is open, the server checks that the controller
account exists here, is active, and that its signing key loads; it refuses to
start if not, because under refuse such a server would turn away every signup
while looking perfectly configured. It also resolves the controller's DID
document and compares the published #atproto key with the local one — a
mismatch is fatal under PDS_PRODUCTION=true and a warning otherwise, and a
document it could not fetch is neither, because a PLC directory being briefly
unreachable is not a reason to refuse a restart.
Each base is then read back from Highport in the background, and the four WARNs
it can log are worth knowing by sight: the base is not verified or active;
delegation is not enabled; the certificate mode is not wildcard; Highport
has not observed a wildcard certificate yet — the last of which is names that
answer over HTTP and fail the TLS handshake. None of them blocks startup, and
all four are fixed at Highport rather than here.
Cutover #
Existing handles are unresolvable for part of this no matter what, because Highport will not accept reservations until its probe has seen the wildcard and the wildcard is what stops this server answering. The order below keeps that window to the probe interval plus the backfill.
Before the cutover, with no user impact:
- Finish everything under Prerequisites — registration, verification, the
CAA records, the wildcard grant,
maxNames, the zone cleanup. - Deploy with
PDS_HIGHPORT_DOMAINS=dids.lol, the controller DID,PDS_HIGHPORT_ON_FAILURE=deferandPDS_HIGHPORT_DRY_RUN=true. The boot checks should pass except for the delegation state, which is not enabled yet.atproto-pds-admin highport reconcile --dry-runshould list every existing account asmissingand nothing else.
The cutover itself, during which handles are briefly unresolvable:
- Close signups — invite-only, with no outstanding codes.
enableDelegationfor the domain with themaxNamesyou settled on.- Flip DNS:
*.dids.lol CNAME go.highport.space, TTL 300. This replaces the wildcard record pointing here. - Poll
getDomainuntildelegation.stateisenabled. The probe runs about once a minute. - Backfill: set
PDS_HIGHPORT_DRY_RUN=false, restart, and runatproto-pds-admin highport reconcile --apply. Writes are paced at four a second, so a thousand accounts take about four minutes. - Verify.
curl -s https://<handle>/.well-known/atproto-didfor a sample,reconcile --dry-runreporting no drift, and a few handles resolved through a public resolver.
Afterwards:
- Set
PDS_HIGHPORT_ON_FAILURE=refuse, restart, and re-open signups. - Create a test account under the base. The well-known should answer within a minute and an AppView should show the handle as valid.
- Install the hourly reconcile and the two alerts, below.
The hourly reconcile is not optional #
Install this, or the deployment is not finished:
17 * * * * atproto-pds-admin highport reconcile --apply --json >> /var/log/highport-reconcile.log 2>&1
It is an ordinary HTTP client over Basic auth, so it runs anywhere that can
reach the server; give it PDS_ADMIN_BASE_URL and PDS_ADMIN_PASSWORD from
the job's environment file rather than writing the password into the crontab.
atproto-pds-admin is not in Dockerfile.pds; Dockerfile.pds-debug and
crates/atproto-pds/Dockerfile carry it, and the debug image is temporary by
design, so build it (cargo build --features clap --bin atproto-pds-admin)
wherever this cron actually runs, which does not have to be, and for a
single-replica Railway deployment is not, the same place as the server. Its
--base-url/PDS_ADMIN_BASE_URL defaults to http://127.0.0.1:4800, which
only resolves to something when the job shares a container with pds; set it
to the public origin (https://vesuvius.pyroclastic.cloud here) instead.
Only the reserve at signup and the reserve half of a rename are inline. Every
other call — a takedown's release, a rename's release of the old name, a
deletion, a handle adopted by refreshIdentity, the release that tidies up
after a signup that failed past its reservation — is spawned, logged if it
fails, and never retried. There is no queue and no retry worker; that was a
deliberate trade, and it is only a safe one if something sweeps up afterwards.
A dropped call stays dropped until reconcile runs.
reconcile reads Highport's reservations, reads the accounts here, and reports
the difference: missing (an account wants a name nobody reserved) and
orphan (a name reserved for an account that should no longer hold it) are
repaired by --apply; mismatch (reserved for a different DID than the one
holding the handle here) and foreign (reserved for a DID with no account
here) are reported and left alone, because either would take a working name off
somebody. Clear those by hand with atproto-pds-admin highport release --hostname <name>, which looks the name up and prints whose it is before
asking.
Two more rows come from the hosted-here check, which asks the DID document where an identity lives before acting on a row that may have outlived its stay here. elsewhere is a name whose DID another server now hosts — an account that migrated away — and is left to that server; it is not drift. unresolved is an orphan whose DID could not be looked up, so it is not released this run. A run of them means the PLC directory is not answering.
Reservations younger than ten minutes are skipped, so a signup between its
reserve and its account insert is not raced. --dry-run writes nothing at all
and is therefore the status command too; it also prints each base's delegation
state, certificate mode and reservation count against maxNames, which is
where you find out the base is nearly full.
The command exits non-zero only on a hard failure — a base that could not be read, a write that did not land, a run that stopped on a systemic refusal. Drift alone does not fail it, deliberately: an hourly job that exited non-zero over a name that is meant to be there would page somebody every hour. Read the count of rows needing attention, not the exit status, for drift.
Two alerts #
Dockerfile.pds builds the metrics feature by default, so these work on a
stock image; you only need to set PDS_METRICS_BIND. If you built with a
custom PDS_FEATURES that drops metrics, setting PDS_METRICS_BIND makes
the server refuse to boot, naming the missing feature — so put it back.
With the metrics feature on and PDS_METRICS_BIND set (127.0.0.1:9090
for a scraper on the host, 0.0.0.0:9090 for one on the network), the
exporter listens there — not on the main port — and exports
atproto_pds_highport_calls_total{method,caller,outcome} and
atproto_pds_highport_requests_total{kind,result}. Two conditions are worth
waking somebody for:
- any
result="refused_unavailable"in the last ten minutes — signups are being turned away because Highport cannot be reached or will not answer; - any
outcome="DelegationQuotaExceeded"oroutcome="DelegationNotVerified"at all — the base has issued every name it is allowed to, or its delegation has lapsed. Neither clears without a person.
Everything else — backlog, quota headroom, drift by kind — comes out of the hourly reconcile, which is why there are two counter families and no gauges.
Sharp edges #
A rename briefly needs one spare reservation. It reserves the new name
before releasing the old, so an account moving within the base holds two for as
long as the spawned release takes. A base whose maxNames exactly equals its
account count cannot rename anybody: the reserve comes back
DelegationQuotaExceeded and the rename fails with the old handle intact.
A rename takes the account's site down with the old name. Releasing the old name is what frees it, and at Highport a release also stops whatever the account published there. A site record is keyed by its hostname, so nothing can carry it across: the account's existing record still names the old hostname, the site at that address stops serving as soon as the release lands, and getting a site back means publishing a new record under the new name. The freed name is immediately claimable by anybody, including another account on this server, and the old record is inert from that moment. An account that renames casually — the way a handle change usually is — loses its site by doing so. This is accepted behaviour, confirmed 2026-09-17, not an oversight: the alternative is holding names for accounts that no longer answer to them. Tell people who publish sites under a delegated base to treat a handle change as a move.
A name handed from one account to another is probable, not ordered. The
second account is refused with DomainTaken until the first's release lands —
usually the same second, but nothing sequences the two. A retry succeeds, and
reconcile clears the case where the release was lost rather than merely late.
A takedown or a suspension releases the name. So does a deletion; a
deactivation does not, because a deactivated account's handle still answers.
Releasing is not only "the handle stops resolving": at Highport the reservation
is the claim on the name, so it also stops any site the subject published
there and clears the reservation's takenUpAt timestamp. That is the point of
releasing: bard serves a site from its own snapshots rather than live from this
server, so a takedown that did not release would leave the account's published
site serving after the account was taken down. Lifting the takedown reserves the
name again and the handle resolves within seconds, but the taken-up timestamp
starts over and the site stays dark until bard's daily reconcile walks the record
or the subject republishes.
Reconcile never releases a name it cannot attribute to an account here. A
reservation for a DID this server hosts nothing for is reported as foreign and
left, because the operator may be holding names under the base for a deployment
elsewhere. Clearing one is highport release, by hand, on purpose.
An account that migrated away keeps its name. Its row here is left deactivated and later deleted, and neither that delete, a takedown of the row, nor reconcile releases a name whose DID document now names another server. The check needs PDS_DID_PLC_URL; without it this server cannot tell, and releases as it always did.
A DNS record at or beneath a reserved name takes it out of the wildcard's
reach, and that is how a name silently stops resolving long after the
cutover. Anything published under <name>.dids.lol is a candidate.
The two admin methods are this server's own. highport reconcile and
highport release call com.atproto.admin.reconcileHighport and
com.atproto.admin.releaseHighportName, methods this server defines for
itself without a lexicon. Use the CLI rather than the endpoints.
Rollback #
Two levers, and they are independent.
Stop calling Highport: unset PDS_HIGHPORT_DOMAINS and restart. Signups
proceed without reservations. The existing reservations stay where they are.
Stop routing handles to Highport: point *.dids.lol back at this server,
which answers the well-known again immediately. Highport's reservations stop
receiving traffic; after seven days of failed probes the base goes
routing-lapsed and the names are suspended there. Nothing else happens.
To re-enable later: repoint the wildcard, wait for the probe, and run
reconcile --apply.
9. Behind an entryway (optional) #
A PDS can instead run as a member of a cluster behind an entryway, which then owns its accounts' sign-in, sessions, OAuth, handles and PLC rotation key. deploy-entryway.md deploys the entryway and pairs PDSes with it. On this service it comes to five variables from entryway keys show (PDS_ENTRYWAY_URL, PDS_ENTRYWAY_DID, PDS_ENTRYWAY_JWT_VERIFY_KEY_K256_PUBLIC_KEY_HEX, PDS_ENTRYWAY_PLC_ROTATION_KEY, PDS_ENTRYWAY_PLC_RECOVERY_KEY), plus a peer secret file shared with the entryway as PDS_ENTRYWAY_PEER_SECRET_FILE. The crate README lists what changes.
Three things from the sections above stop applying. §8's Highport settings move to the entryway, and the server refuses PDS_HIGHPORT_DOMAINS in this mode. §5's invites are minted at the entryway; here the invite methods answer that the entryway manages them. §2's password reset is the entryway's: the forgot pages redirect there, and PDS_RECOVERY_KEY_RESET is ignored with a warning in favour of ENTRYWAY_RECOVERY_KEY_RESET.
Switching an existing PDS is not a restart. Its accounts' HS256 sessions and OAuth grants stop working. Their passwords and DIDs have to move to the entryway first, through an export, an import and a PLC update per account (deploy-entryway.md §9). Plan that as a migration with a maintenance window, not a configuration change. Passkeys made here do not move: holders sign in at the entryway with their password and re-create them there, so tell them to make sure they know it first.
Upgrades and rollback #
Back up before every upgrade. Rolling back means restoring that backup — redeploying the previous image does not work.
That is not caution, it is the mechanism. Migrations are append-only and have no down step, nothing in this crate sets sqlx's ignore_missing, and sqlx's default is to refuse a database whose _sqlx_migrations records a version the binary does not carry (MigrateError::VersionMissing). The accounts DB is migrated at startup, inside AccountDirectory::open, before the router exists — so an older binary against a newer accounts DB does not start. It has already happened here once: the header of migrations/accounts/20260828000001_remove_actor_auth.sql records the outage.
The procedure #
- Stop the server. A copy of
/datataken while it is running can catch a torn SQLite write — see §"Operational notes". - Copy
/data. WithPDS_BLOB_STORE_URLset, also snapshot or version the bucket: the volume no longer holds blob bytes. - Deploy the new image.
- Watch the first boot. Accounts migrations run there, and a failure is a boot failure with the sqlx error in the log.
- To roll back: stop, restore
/data(and the bucket) from step 2, redeploy the old image.
Two databases, two failure modes #
The accounts DB and the per-actor databases do not migrate at the same time, and this surprises people.
| Accounts DB | Per-actor DBs | |
|---|---|---|
| When | At startup, in AccountDirectory::open |
When each actor's store is first opened, which is a request path |
| Failure | The process does not start | One account's request fails; the rest of the server is fine |
| After an upgrade | Done once, immediately | Keeps happening for as long as new actors are touched |
So a clean boot is not proof that an upgrade landed. An actor whose database fails to migrate shows up later, as a 500 on that account alone. The background sweeps do not migrate — SqlActorStore::open_for_sweep skips it deliberately — so they will not surface it either.
Migrations that drop data #
No rollback recovers what these dropped, restoring a backup aside. tests/integration/operator_docs.rs fails if a migration containing DROP TABLE, DROP COLUMN or DELETE FROM is added without a row here.
| Migration | What goes |
|---|---|
20260506000001_drop_dead_schema.sql |
Drops oauth_session and plc_op_token. Its header says neither was ever written to. |
20260809000001_primary_password_unique.sql |
DELETE FROM app_password for superseded __primary__ rows. This deletes live credential rows, keeping the newest per account. |
20260826000001_signing_key_reservation.sql |
Rebuilds signing_key through a copy, so no column is lost — but the old table is dropped, and with it a REFERENCES account(did) ON DELETE CASCADE. |
20260828000001_remove_actor_auth.sql |
Drops the actor_auth_issuance table and account_delegation.scope. Both on purpose; the feature is gone. Applies to the Postgres schema too. |
20260916000001_space_read_write_access.sql |
Drops space.mint_policy and space.managing_app, after backfilling their replacements in the same migration. Behaviour is preserved; the old columns are not. |
20260919000001_drop_outbox.sql |
Drops the outbox table and its index. Nothing has written to it since 20260728000001_stream_event.sql. |
20261001000005_space_notify_registration.sql |
Per actor. Replaces space_credential_recipient with space_notify_registration, carrying over only live whole-space registrations that have an expiry. Per-repo registrations, which the 2026-10-01 spaces alpha retired, and the non-expiring rows getSpaceCredential used to write for every credential consumer are dropped. A syncer that relied on either has to registerNotify with a service. |
20261001000004_drop_space_received_op.sql |
Per actor. Drops space_received_op, the per-notification receipts the writer set used to be read from. The binary copies each writer's latest receipt into the new space_writer table first, between this and 20261001000003_space_writer.sql, so listRepos loses nothing; the older receipts, which no query read, are gone. |
20261001000002_notify_attempt_mint_at_delivery.sql |
Drops notify_attempt.auth_token, the service-auth token a queued notification used to carry; the notifier now mints one per attempt. A row still pending with a token is marked failed (superseded: …) first, because the issuer and audience it needs are inside the token. Applies to the Postgres schema too. |
20261001000001_space_access_log_kid.sql |
Per actor. Deletes the space access log rows, and the blocks, that name a reader by a DPoP thumbprint (jkt:…): since 0016 bound credentials with HTTP Message Signatures no credential can present one again. Attested readers and their blocks are kept. |
20261006000003_optional_password.sql |
Rebuilds account through a copy so password_hash may be NULL, for passwordless accounts. No column or row is lost. It runs outside the migrator's transaction with foreign keys off, so dropping the old table cascades into nothing; the ten tables that reference account keep every row. Rolling back to a binary from before it fails on the first passwordless account, whose NULL the older code cannot read; the Postgres mirror only drops NOT NULL. |
20261018000001_reset_code_origin.sql |
Adds email_token.origin and origin_kid, and drops recovery_reset_ticket, the two-page recovery-key reset's tickets, which createPasswordResetToken replaced with a reset code. A ticket outstanding at the upgrade is gone, and its holder mints a new token; a rollback finds no such table. Applies to the Postgres schema too. |
20261018000301_no_recovery_key_codes.sql |
Deletes outstanding reset codes issued for a recovery token, which createPasswordResetToken issued until a recovery token went to resetPassword directly. Such a code lived 15 minutes; its holder resets with a new token instead. A rollback finds them gone. Applies to the Postgres schema too. |
20261022000001_space_issued_credential_anonymous.sql |
Per actor. Rebuilds space_issued_credential through a copy so member_did may be NULL, for the credentials a public space issues to a getSpaceCredential request without a delegation token. No column or row is lost: the old table is dropped after its rows are copied, and its indexes are made again under the same names. An older binary reading an anonymous credential's NULL fails, which is one more reason a rollback is a restore. |
20261029000002_space_drop_simplespace_config.sql |
Per actor. Drops the five simplespace columns of space (read_policy, read_managing_app, write_policy, write_managing_app, app_access). The binary first converts each owned, live space's configuration into a space_policy row (20261029000001_space_policy.sql): a side whose policy was managing-app with an app named makes a managedspace, read side's app first, and drops that space's member list; anything else becomes a memberspace with publicRead and publicWrite from the public sides and allowedApps from an allow list. An app column under any other policy is ignored as stale. Every space loses the authority's own member row. Each lossy case is logged at warn with the account's DID. Back up and survey the stores before deploying; a rollback is a restore. |
How far back is "back" #
Since 0.15.0-rc.4 (650d646) twenty-eight accounts migrations, fifteen per-actor migrations and twenty-eight Postgres twins have been added, and none of the existing ones were edited or removed. An rc.4 binary pointed at a current accounts database fails on the first of them.
20261022000101_account_kem_key.sql adds account.kem_key_ref for each account's #atproto_kem key and drops nothing. The first boot after it generates a key for every account that has none, in the background once the server is serving, and logs KEM keys generated for the accounts that had none; none published with the count. The keys are written to /data/keys and published nowhere; the crate README's "Upgrading: per-account KEM keys" says what publishes them.
Two of the 2026-10-22 migrations rename a column and drop nothing: the 2026-10-22 spaces alpha calls a space commit's digest data rather than hash, and the value is unchanged. 20261022000201_space_notification_retry_data.sql (accounts, and its Postgres twin) renames space_notification_retry.hash at boot, so a write notification queued before the upgrade is retried under the new field name. 20261022000201_space_writer_data.sql renames space_writer.hash per actor, as each store is opened. A binary from before them reads neither column, which is one more reason a rollback is a restore.
20261022000301_space_record_path_index.sql adds an index per actor, as each store is opened, on the record path (collection || '/' || rkey) that getRepo pages its STAR archive by, and drops nothing.
The newest, 20261022000401_space_deleted_notification_retry.sql (accounts, and its Postgres twin), adds space_deleted_notification_retry and drops nothing: the queue of notifySpaceDeleted notifications a deleted space still owes its registered syncers, retried until each is delivered or its registration expires. The deletion itself now erases the space's configuration, member list, writer set and registrations along with the authority's own repo in the space, keeping the tombstone; a space deleted before the upgrade keeps what the old deletion left until it is recreated, which clears it. A binary from before it neither fills nor drains the queue, and a rollback that restores the backup loses the notifications queued since.
Operational notes #
Backups. With blobs on the volume (the default), the volume is the whole
of it: a copy of /data taken while the server is stopped is a complete
backup. /data/keys is the part that matters most: it holds every account's
private keys — the #atproto signing key, the #atproto_kem key and the
PDS-managed rotation key — as one file each, and the accounts database only
names them. Nothing can rebuild them, so a backup without /data/keys cannot
restore a single account. Copying it while the server is running will usually appear to work and
can capture a torn SQLite write — the WAL is mid-flight. Stop, copy, start.
With PDS_BLOB_STORE_URL set (§"Blobs in object storage"), this is no longer
true — blob bytes live in the bucket, not on the volume — so the volume backup
above covers everything except blobs, and the bucket needs its own backup or
versioning.
Handle suggestions. The portal's sign-in page lists accounts on this
server as the holder types a handle (on by default). Every suggestion is a
handle and DID that listRepos already publishes, but the list makes browsing
the accounts easier; PDS_TYPEAHEAD=false turns it off. Display names come
from each account's own profile record: the server reads every account once
after an upgrade, so the first boot with it does one record read per account.
Never write to the database from outside the container while the server is
running. SQLite in WAL mode does not tolerate a second writer arriving through
a different mount; the symptom is disk I/O error on unrelated queries.
Upgrades are a redeploy, and they are one-way. §"Upgrades and rollback"
above is the procedure; read it before the first one. Because there is one
replica and one volume, the old container must stop before the new one
starts — overlapSeconds = 0 in railway.toml enforces that; without it the
new container cannot mount the volume and the deploy fails in a way that
reads as a build problem.
Logs. The binary already defaults to RUST_LOG=info,atproto_pds=debug
when the variable is unset — that verbose setting is what you get with no
configuration at all. Set RUST_LOG=info explicitly to quiet this crate's own
logging down to the same level as its dependencies.