atproto self-host in docker #2026
|
A fully self-hosted AT Protocol environment. While typical self-hosting only covers PDS, this setup includes the appview, relay, moderation, feed generator, and more. ArchitectureServices
Data FlowHow a post appears on the timelineCustom feed flowFederation with the official networkTo make posts from your PDS visible on the official Bluesky network, request a crawl from the official relay.
curl -X POST "https://bsky.network/xrpc/com.atproto.sync.requestCrawl" \
-H "Content-Type: application/json" \
-d '{"hostname": "example.com"}'Also set Repositories
pds, bsky, and ozone (daemon) are built from the same repository (atproto) using different Dockerfiles. Buildgit clone https://github.com/bluesky-social/atproto
git clone https://github.com/bluesky-social/indigo
git clone https://github.com/did-method-plc/did-method-plc
git clone https://github.com/bluesky-social/social-app
git clone https://github.com/bluesky-social/ozone
git clone https://github.com/bluesky-social/jetstream
git clone https://github.com/bluesky-social/feed-generatorEnvironment VariablespostgresPOSTGRES_USER=postgres
POSTGRES_PASSWORD=xxx
POSTGRES_DB=postgrespdsPDS_HOSTNAME=example.com
PDS_SERVICE_DID=did:web:example.com
PDS_DB_POSTGRES_URL=postgres://postgres:xxx@database/pds
PDS_DATA_DIRECTORY=/data
PDS_BLOBSTORE_DISK_LOCATION=/data/blobs
PDS_BSKY_APP_VIEW_DID=did:web:bsky.example.com
PDS_BSKY_APP_VIEW_URL=https://bsky.example.com
PDS_CRAWLERS=https://bgs.example.com
PDS_DID_PLC_URL=https://plc.example.com
PDS_SEQUENCER_ENABLED=true
PDS_SEQUENCER_DB_LOCATION=/data/sequencer
PDS_DEV_MODE=true
PDS_ENABLE_DID_DOC_WITH_SESSION=true
PDS_INVITE_REQUIRED=true
PDS_INVITE_INTERVAL=604800
PDS_EMAIL_FROM_ADDRESS=admin@example.com
# secrets
PDS_ADMIN_PASSWORD=xxx
PDS_JWT_SECRET=xxx
PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=xxx
PDS_REPO_SIGNING_KEY_K256_PRIVATE_KEY_HEX=xxx
PDS_EMAIL_SMTP_URL=xxxbskyBSKY_PORT=2584
BSKY_PUBLIC_URL=https://bsky.example.com
BSKY_SERVER_DID=did:web:bsky.example.com
BSKY_DB_POSTGRES_URL=postgres://postgres:xxx@database/bsky
BSKY_DID_PLC_URL=https://plc.example.com
BSKY_REPO_PROVIDER=wss://bgs.example.com
BSKY_BLOB_CACHE_LOC=/data
BSKY_DATAPLANE_URLS=http://localhost:6100
BSKY_DATAPLANE_PORT=6100
BSKY_DATAPLANE_HTTP_VERSION=1.1
BSKY_BSYNC_URL=http://localhost:6200
BSKY_BSYNC_PORT=6200
BSKY_BSYNC_HTTP_VERSION=1.1
BSKY_COURIER_URL=
MOD_SERVICE_DID=did:web:ozone.example.com
# secrets
BSKY_ADMIN_PASSWORDS=xxx
BSKY_SERVICE_SIGNING_KEY=xxxbgsDATABASE_URL=postgres://postgres:xxx@database/bgs
CARSTORE_DATABASE_URL=postgres://postgres:xxx@database/carstore
DATA_DIR=/data
ATP_PLC_HOST=https://plc.example.com
BGS_NEW_PDS_PER_DAY_LIMIT=1000
# secrets
BGS_ADMIN_KEY=xxxplcDATABASE_URL=postgres://postgres:xxx@database/plc
DB_CREDS_JSON={"username":"postgres","password":"xxx","host":"database","port":"5432","database":"plc"}
ENABLE_MIGRATIONS=true
DB_MIGRATE_CREDS_JSON={"username":"postgres","password":"xxx","host":"database","port":"5432","database":"plc"}ozoneOZONE_SERVER_DID=did:web:ozone.example.com
OZONE_PUBLIC_URL=https://ozone.example.com
OZONE_ADMIN_HANDLE=admin.example.com
OZONE_ADMIN_DIDS=did:plc:xxx
OZONE_MODERATOR_DIDS=did:plc:xxx
OZONE_DB_POSTGRES_URL=postgres://postgres:xxx@database/ozone
OZONE_DID_PLC_URL=https://plc.example.com
OZONE_APPVIEW_DID=did:web:bsky.example.com
OZONE_APPVIEW_URL=https://bsky.example.com
OZONE_APPVIEW_PUSH_EVENTS=true
OZONE_PDS_DID=did:web:example.com
OZONE_PDS_URL=https://example.com
OZONE_DEV_MODE=true
OZONE_DB_MIGRATE=true
NEXT_PUBLIC_PLC_DIRECTORY_URL=https://plc.example.com
NEXT_PUBLIC_OZONE_SERVICE_DID=did:web:ozone.example.com
NEXT_PUBLIC_SOCIAL_APP_DOMAIN=example.com
NEXT_PUBLIC_SOCIAL_APP_URL=https://example.com
# verifier (for bluecheck)
OZONE_VERIFIER_DID=did:plc:xxx
OZONE_VERIFIER_URL=https://example.com
OZONE_VERIFIER_PASSWORD=xxx
OZONE_VERIFIER_ISSUERS_TO_INDEX=did:plc:xxx
OZONE_VERIFIER_JETSTREAM_URL=wss://jetstream.example.com
# secrets
OZONE_ADMIN_PASSWORD=xxx
OZONE_SIGNING_KEY_HEX=xxxjetstreamJETSTREAM_WS_URL=ws://bgs:2470/xrpc/com.atproto.sync.subscribeRepos
JETSTREAM_DATA_DIR=/data
JETSTREAM_LISTEN_ADDR=:6008
JETSTREAM_METRICS_LISTEN_ADDR=:6009
JETSTREAM_LIVENESS_TTL=300feed-generatorFEEDGEN_PORT=3000
FEEDGEN_LISTENHOST=0.0.0.0
FEEDGEN_SQLITE_LOCATION=/data/db.sqlite
FEEDGEN_HOSTNAME=feed.example.com
FEEDGEN_PUBLISHER_DID=did:plc:xxx
FEEDGEN_SERVICE_DID=did:web:feed.example.com
FEEDGEN_JETSTREAM_URL=ws://jetstream:6008/subscribesocial-appATP_APPVIEW_HOST=bsky.example.com
EXPO_PUBLIC_BLUESKY_PROXY_DID=did:web:bsky.example.com
EXPO_PUBLIC_ENV=productionchat
PORT=3100
HOST=0.0.0.0
DB_PATH=/data/chat.db
DID_HOST=bsky.example.com
SERVICE_URL=https://bsky.example.com
CHAT_DOMAIN=bsky.chat
APPVIEW_URL=https://bsky.example.comDocker Compose Exampleservices:
database:
image: postgres
env_file: ./envs/postgres
volumes:
- database:/var/lib/postgresql/data
redis:
image: redis
plc:
build:
context: ./did-method-plc/
dockerfile: packages/server/Dockerfile
env_file: ./envs/plc
pds:
build:
context: ./atproto/
dockerfile: services/pds/Dockerfile
env_file: ./envs/pds
volumes:
- pds:/data
bsky:
build:
context: ./atproto/
dockerfile: services/bsky/Dockerfile
env_file: ./envs/bsky
volumes:
- bsky:/data
bgs:
build:
context: ./indigo/
dockerfile: cmd/relay/Dockerfile
env_file: ./envs/bgs
volumes:
- bgs:/data
ozone:
build:
context: ./atproto/
dockerfile: services/ozone/Dockerfile
env_file: ./envs/ozone
ozone-web:
build:
context: ./ozone/
env_file: ./envs/ozone
jetstream:
build:
context: ./jetstream/
env_file: ./envs/jetstream
volumes:
- jetstream:/data
feed-generator:
build:
context: ./feed-generator/
env_file: ./envs/feed-generator
volumes:
- feed-generator:/data
social-app:
build:
context: ./social-app/
env_file: ./envs/social-app
volumes:
database:
pds:
bsky:
bgs:
jetstream:
feed-generator:docker compose build
docker compose up -dLexiconsThe schema definition system for AT Protocol. In addition to standard collections ( Creating Custom Lexicons
ref |
Replies: 3 comments 4 replies
|
There is an out-of-date docker-compose file and README in the indigo repo that might be helpful: https://github.com/bluesky-social/indigo/tree/main/cmd/fakermaker Things are not in a great state for this right now. We plan to iterate on all the docs and dev support around self-hosting at the same time we open up federation, which means we aren't prioritizing updating docs on this until then. In particular, I think the pds service is probably pretty out of date compared to the sandbox PDS "distribution", and we need to get those synced back up, and that may involve breaking changes to the PDS config env vars. Also the version of the PDS that we (bluesky) runs is now behind a "gateway service", which is unnecessary complexity for most folks (but needs documentation). The relay (BGS) and PLC are pretty stable. The appview is in the middle of several large refactors, with big changes in feature branches which have not been merged yet. |
|
@syui did you succeed on self hosting with current codes? please update if you got progress. |
|
if bsky(appview) doesn't work |
There is an out-of-date docker-compose file and README in the indigo repo that might be helpful: https://github.com/bluesky-social/indigo/tree/main/cmd/fakermaker
Things are not in a great state for this right now. We plan to iterate on all the docs and dev support around self-hosting at the same time we open up federation, which means we aren't prioritizing updating docs on this until then.
In particular, I think the pds service is probably pretty out of date compared to the sandbox PDS "distribution", and we need to get those synced back up, and that may involve breaking changes to the PDS config env vars. Also the version of the PDS that we (bluesky) runs is now behind a "gateway servi…