Mirror from bluesky-social/pds
1# Bluesky Developer Sandbox Guide
2
3Welcome to the atproto federation developer sandbox!
4
5This is a completely separate network from our production services that allows us to test out the federation architecture and wire protocol.
6
7The federation sandbox environment is an area set up for exploration and testing of the technical components of the AT Protocol distributed social network. It is intended for developers and self-hosters to test out data availability in a federated environment.
8
9To maintain a positive and productive developer experience, we've established this Code of Conduct that outlines our expectations and guidelines. This sandbox environment is initially meant to test the technical components of federation.
10
11Given that this is a testing environment, we will be defederating from any instances that do not abide by these guidelines, or that cause unnecessary trouble, and will not be providing specific justifications for these decisions.
12
13# Guidelines that must be followed
14
15Using the sandbox environment means you agree to adhere to our Guidelines. Please read the following carefully:
16
17## Post responsibly
18
19The sandbox environment is intended to test infrastructure, but user content may be created as part of this testing process. Content generation can be automated or manual.
20
21Do not post content that requires active moderation or violates the [Bluesky Community Guidelines](https://bsky.social/about/support/community-guidelines).
22
23## Keep the emphasis on testing
24
25We’re striving to maintain a sandbox environment that fosters learning and technical growth. We will defederate with instances that recruit users without making it clear that this is a test environment.
26
27## Do limit account creation
28
29We don't want any one server using a majority of the resources in the sandbox. To keep things balanced, to start, we’re only federating with Personal Data Servers (PDS) with up to 1000 accounts. However, we may change this if needed.
30
31## Don’t expect persistence or uptime
32
33We will routinely be wiping the data on our infrastructure. This is intended to reset the network state and to test sync protocols. Accounts and content should not be mirrored or migrated between the sandbox and real-world environments.
34
35## Don't advertise your service as being "Bluesky"
36
37This is a developer sandbox and is meant for technical users. Do not promote your service as being a way for non-technical users to use Bluesky.
38
39## Do not mirror sandbox did:plcs to production
40
41
42## Status and Wipes
43
44### 🐉 Beware of dragons!
45
46This hasn’t been production tested yet. It seems to work pretty well, but who knows what’s lurking under the surface — that's what this sandbox is for! Have patience with us as we prep for federation.
47
48On that note, please give us feedback either in [Issues](https://github.com/bluesky-social/atproto/issues) (actual bugs) or [Discussions](https://github.com/bluesky-social/atproto/discussions) (higher-level questions/discussions) on the [atproto repo](https://github.com/bluesky-social/atproto).
49
50### Routine wipes
51
52As part of the sandbox, we will be doing routine wipes of all network data.
53
54We expect to perform wipes on a weekly or bi-weekly basis, though we reserve the right to do a wipe at any point.
55
56When we wipe data, we will be wiping it on all services (BGS, App View, PLC). We will also mark any existing DIDs as “invalid” & will refuse to index those accounts in the next epoch of the network to discourage users from attempting to “rollover” their accounts across wipes.
57
58# Getting started
59
60For complete instructions on getting your PDS set up, check out the [README](./README.md).
61
62To access your account, you’ll log in with the client of your choice in the exact same way that you log into production Bluesky, for instance the [Bluesky web client](https://app.bsky-sandbox.dev/). When you do so, please provide the url of *your PDS* as the service that you wish to log in to.
63
64## Auto-updates
65
66We’ve included Watchtower in the PDS distribution. Every day at midnight PST, this will check our GitHub container registry to see if there is a new version of the PDS container & update it on your service.
67
68This will allow us to rapidly iterate on protocol changes, as we’ll be able to push them out to the network on a daily basis.
69
70When we do routine network wipes, we will be pushing out a database migration to participating PDS that wipes content and accounts.
71
72You are within your rights to disable Watchtower auto-updates, but we strongly encourage their use and will not be providing support if you decide not to run the most up-to-date PDS distribution.
73
74## Odds & Ends & Warnings & Reminders
75
76🧪 Experiment & have fun!
77
78🤖 Run [feed generators](https://github.com/bluesky-social/feed-generator). They should work the exact same way as production - be sure to adjust your env to listen to Sandbox BGS!
79
80🌈 Feel free to run your own AppView or BGS - although it’s a bit more involved & we’ll be providing limited support for this.
81
82✏️ Because the atproto network is a distributed system, your PDS can no longer definitively read-after-write. Updates are generally processed pretty quickly, however this discrepancy may show in certain circumstances, such as updating a profile or replying to a thread. We're working on utilities to make this easier to handle.
83
84⏱️ As a specific case of the above, because we use on-demand TLS with Caddy, your profile may not load at first - please be patient & it should load within 5-10s after account creation. Again, we'll be working to smooth over this.
85
86👤 Your PDS will provide your handle by default. Custom domain handles should work exactly the same in sandbox as they do on production Bluesky. Although you will not be able to re-use your handle from production Bluesky as you can only have one DID set per handle.
87
88⚠️ If you follow the self-hosted PDS setup instructions, you’ll have private key material in your env file - be careful about sharing that!
89
90📣 This is a sandbox version of a **public broadcast protocol** - please do not share sensitive information.
91
92🤝 Help each other out! Respond to issues & discussions, chat in [Matrix](https://matrix.to/#/%23bluesky-dev:matrix.org) or the community-run [Discord](https://discord.gg/3srmDsHSZJ), etc.
93
94# Learn more about atproto federation
95
96Check out the [high-level view of federation](https://bsky.social/about/blog/5-5-2023-federation-architecture).
97
98Dive deeper with the [atproto docs](https://atproto.com/docs).
99
100## Network Services
101
102We are running three services: PLC, BGS, Bluesky "App View"
103
104### PLC
105
106**Hostname:** `plc.bsky-sandbox.dev`
107
108**Code:** https://github.com/bluesky-social/did-method-plc
109
110PLC is the default DID provider for the network. DIDs are the root of your identity in the network. Sandbox PLC functions exactly the same as production PLC, but it is run as a separate service with a separate dataset. The DID resolution client in the self-hosted PDS package is set up to talk the correct PLC service.
111
112### BGS
113
114**Hostname:** `bgs.bsky-sandbox.dev`
115
116**Code:** https://github.com/bluesky-social/indigo/tree/main/bgs
117
118BGS (Big Graph Service) is the firehose for the entire network. It collates data from PDSs & rebroadcasts them out on one giant websocket.
119
120BGS has to find out about your server somehow, so when we do any sort of write, we ping BGS with `com.atproto.sync.requestCrawl` to notify it of new data. This is done automatically in the self-hosted PDS package.
121
122If you’re familiar with the Bluesky production firehose, you can subscribe to the BGS firehose in the exact same manner, the interface & data should be identical
123
124### Bluesky App View
125
126**Hostname:** `api.bsky-sandbox.dev`
127
128**Code:** https://github.com/bluesky-social/atproto/tree/main/packages/bsky
129
130The Bluesky App View aggregates data from across the network to service the Bluesky microblogging application. It consumes the firehose from the BGS, processing it into serviceable views of the network such as feeds, post threads, and user profiles. It functions as a fairly traditional web service.
131
132When you request a Bluesky-related view from your PDS (`getProfile` for instance), your PDS will actually proxy the request up to App View.
133
134Feel free to experiment with running your own App View if you like!
135
136# The PDS
137
138The PDS (Personal Data Server) is where users host their social data such as posts, profiles, likes, and follows. The goal of the sandbox is to federate many PDS together, so we hope you’ll run your own.
139
140We’re not actually running a Bluesky PDS in sandbox. You might see Bluesky team members' accounts in the sandbox environment, but those are self-hosted too.
141
142The PDS that you’ll be running is much of the same code that is running on the Bluesky production PDS. Notably, all of the in-pds-appview code has been torn out. You can see the actual PDS code that you’re running on the [atproto/simplify-pds](https://github.com/bluesky-social/atproto/pull/1198) branch.