name: at-record-devnet # A tranquil (isolated, deterministic) local atproto stack for testing # cross-account at-record features that depend on Constellation indexing: # adoption (adopt-or-mint), the edit-inbox. Point at-record's # SLINGSHOT_URL/CONSTELLATION_URL at this compose's slingshot/constellation # ports instead of the public services. See README.md. # # Slingshot is required even with one PDS hosting every test account: our # OAuth login resolves handles via Slingshot's bespoke resolveMiniDoc # endpoint, which a raw PDS doesn't implement (a PDS only serves the # standard com.atproto.* surface for its own repos). services: pds: image: ghcr.io/bluesky-social/pds:0.4 ports: - "2584:3000" # Also on its "native" port: PDS_HOSTNAME=localhost + PDS_PORT=3000 # get baked into each account's DID doc service endpoint # (http://localhost:3000) at creation time, and at-record's server # runs on the host (not in this compose network) — it needs # localhost:3000 to actually reach the PDS to complete OAuth. - "3000:3000" volumes: - pds-data:/pds environment: PDS_HOSTNAME: localhost PDS_PORT: "3000" # Lets the plain-http local resource URL past the https-only check, and # relaxes SSRF protection so the PDS can call other containers by # service name (jetstream, constellation) instead of a public host. PDS_DEV_MODE: "true" PDS_DATA_DIRECTORY: /pds PDS_BLOBSTORE_DISK_LOCATION: /pds/blocks PDS_BLOB_UPLOAD_LIMIT: "104857600" PDS_DID_PLC_URL: https://plc.directory PDS_BSKY_APP_VIEW_URL: https://api.bsky.app PDS_BSKY_APP_VIEW_DID: did:web:api.bsky.app PDS_REPORT_SERVICE_URL: https://mod.bsky.app PDS_REPORT_SERVICE_DID: did:plc:ar7c4by46qjdydhdevvrndac # No crawlers: jetstream below pulls straight from this PDS, so there's # no relay to notify. PDS_CRAWLERS: "" PDS_INVITE_REQUIRED: "false" PDS_RATE_LIMITS_ENABLED: "false" LOG_ENABLED: "true" PDS_JWT_SECRET: ${PDS_JWT_SECRET} PDS_ADMIN_PASSWORD: ${PDS_ADMIN_PASSWORD} PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX: ${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX} healthcheck: # com.atproto.server.describeServer is a required, unauthenticated # endpoint on every PDS — a safer bet than guessing at a health path. test: ["CMD", "node", "-e", "fetch('http://localhost:3000/xrpc/com.atproto.server.describeServer').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"] interval: 5s timeout: 5s retries: 20 # jetstream's image runs as a non-root distroless user; named volumes are # created root-owned, so this one-shot container fixes ownership before # jetstream tries to mkdir into it. jetstream-data-init: image: busybox command: ["chown", "-R", "65532:65532", "/data"] volumes: - jetstream-data:/data jetstream: build: ./jetstream depends_on: pds: condition: service_healthy jetstream-data-init: condition: service_completed_successfully ports: - "8090:8080" volumes: - jetstream-data:/data environment: # A single PDS serves listRepos/subscribeRepos/getRepo for its own # hosted accounts identically to how a relay would — no separate relay # needed for a one-PDS devnet. JETSTREAM_RELAY_URL: http://pds:3000 JETSTREAM_DATA_DIR: /data JETSTREAM_LOG_LEVEL: info constellation: build: context: ./microcosm-rs dockerfile: constellation/Dockerfile depends_on: - jetstream ports: - "6789:6789" command: - "--jetstream=ws://jetstream:8080/subscribe" - "--backend=memory" - "--bind=0.0.0.0:6789" # PDS_HOSTNAME=localhost already makes the PDS default its # serviceHandleDomains to [".test"], so it self-verifies any .test # handle it hosts — but it only serves plain HTTP internally, and atproto's # bidirectional handle check fetches https:///.well-known/atproto-did. # Caddy terminates real (locally-CA-signed) TLS for the test handles and # proxies to the PDS over plain HTTP, closing that gap without touching # real DNS or a real cert. caddy: image: caddy:2 volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy-data:/data networks: default: aliases: - alice.test - bob.test - carol.test - dave.test - erin.test # Caddy's `tls internal` CA is generated into its own data volume; export # the root cert so slingshot (below) can be told to trust it. caddy-ca-export: image: caddy:2 depends_on: - caddy volumes: - caddy-data:/data:ro - caddy-ca:/export entrypoint: ["sh", "-c"] command: - | for i in $(seq 1 30); do f=/data/caddy/pki/authorities/local/root.crt [ -f "$$f" ] && cp "$$f" /export/local-ca.crt && exit 0 sleep 1 done echo "caddy never generated its local CA" >&2 exit 1 slingshot: build: context: ./microcosm-rs dockerfile: slingshot/Dockerfile depends_on: caddy-ca-export: condition: service_completed_successfully jetstream: condition: service_started ports: - "6790:8080" volumes: - slingshot-cache:/cache - caddy-ca:/ca:ro # slingshot's image is debian-slim (has update-ca-certificates, unlike # jetstream/constellation's distroless base) — trust Caddy's local CA # before starting the actual binary. entrypoint: ["sh", "-c"] command: - | cp /ca/local-ca.crt /usr/local/share/ca-certificates/devnet-local-ca.crt update-ca-certificates exec slingshot --jetstream=ws://jetstream:8080/subscribe --cache-dir=/cache --bind=0.0.0.0:8080 volumes: pds-data: jetstream-data: slingshot-cache: caddy-data: caddy-ca: