···33 push:
44 branches:
55 - main
66- - pdsv2
66+ - next
77 tags:
88 - v*
99env:
+27-7
ACCOUNT_MIGRATION.md
···5566Therefore, we do not recommend migrating your primary account yet. And we specifically recommend _against_ migrating your main account if you do not understand how PLC operations work.
7788-As well, the Bluesky PDS is not currently accepting incoming migrations (it will in the future). Therefore this is currently a one-way street. If you migrate off of `bsky.social`, _you will not be able to return_. However, you will be able to migrate between other PDSs.
88+Also, the Bluesky PDS is not currently accepting incoming migrations (it will in the future). Therefore this is currently a one-way street. If you migrate off of `bsky.social`, _you will not be able to return_. However, you will be able to migrate between other PDSs.
991010
1111···20202121In order to create an account, you first need to prove to the new PDS that you're in control of the DID that you're attempting to register as.
22222323-To do so, you need a JWT signed with the signing key associated with your DID. You can obtain this through calling `com.atproto.server.getServiceAuth` from your old PDS. If you're old PDS is not willing to provide the authentication token, you will need to update your DID document to point to a signing key that you possess in order to mint an authentication token yourself.
2323+To do so, you need a JWT signed with the signing key associated with your DID. You can obtain this through calling `com.atproto.server.getServiceAuth` from your old PDS. If your old PDS is not willing to provide the authentication token, you will need to update your DID document to point to a signing key that you possess in order to mint an authentication token yourself.
24242525With this JWT set as a Bearer token, you can then create an account on the new PDS by calling `com.atproto.server.createAccount`. You'll need to fulfill any challenges that the new PDS requires - such as an invite code.
26262727-After creating an account, you'll have a signing key on the new PDS and an empty repository. You're account will be in a "deactivated" state such that it is not usable yet.
2727+After creating an account, you'll have a signing key on the new PDS and an empty repository. Your account will be in a "deactivated" state such that it is not usable yet.
28282929### Migrating data
30303131Now that you have an account on the new PDS, you can start migrating data into it. After creating your account, you will have received an access token for the new PDS and it will be required for all incoming data.
32323333-First, you can grab your entire repository in the from of a [CAR file](https://ipld.io/specs/transport/car/carv1/) by calling `com.atproto.sync.getRepo`. You can then upload those exact bytes to your new PDS through `com.atproto.repo.importRepo`. The new PDS will parse the CAR file, index all blocks and records, and sign a new commit for the repository.
3333+First, you can grab your entire repository in the form of a [CAR file](https://ipld.io/specs/transport/car/carv1/) by calling `com.atproto.sync.getRepo`. You can then upload those exact bytes to your new PDS through `com.atproto.repo.importRepo`. The new PDS will parse the CAR file, index all blocks and records, and sign a new commit for the repository.
34343535Next, you'll need to upload all relevant blobs. These can be discovered by calling `com.atproto.sync.listBlobs` on your old PDS. For each blob, you'll need to download the contents through `com.atproto.sync.getBlob` and upload them to your new PDS through `com.atproto.repo.uploadBlob`.
3636···69697070The below Typescript code gives an example of how this account migration flow may function. Please note that it is for documentation purposes only and can not be run exactly as is as there is an out-of-band step where you need to get a confirmation token from your email.
71717272-It does also not handle some of the more advanced steps such as verifying a full import, looking for missing blobs, adding your own recovery key, or validating the PLC operation itself.
7272+It also does not handle some of the more advanced steps such as verifying a full import, looking for missing blobs, adding your own recovery key, or validating the PLC operation itself.
73737474```ts
7575import AtpAgent from '@atproto/api'
7676+import { Secp256k1Keypair } from '@atproto/crypto'
7777+import * as ui8 from 'uint8arrays'
76787779const OLD_PDS_URL = 'https://bsky.social'
7880const NEW_PDS_URL = 'https://example.com'
···105107106108 const serviceJwtRes = await oldAgent.com.atproto.server.getServiceAuth({
107109 aud: newServerDid,
110110+ lxm: 'com.atproto.server.createAccount',
108111 })
109112 const serviceJwt = serviceJwtRes.data.token
110113···157160158161 // Migrate Identity
159162 // ------------------
163163+164164+ const recoveryKey = await Secp256k1Keypair.create({ exportable: true })
165165+ const privateKeyBytes = await recoveryKey.export()
166166+ const privateKey = ui8.toString(privateKeyBytes, 'hex')
160167161168 await oldAgent.com.atproto.identity.requestPlcOperationSignature()
162169163170 const getDidCredentials =
164171 await newAgent.com.atproto.identity.getRecommendedDidCredentials()
172172+ const rotationKeys = getDidCredentials.data.rotationKeys ?? []
173173+ if (!rotationKeys) {
174174+ throw new Error('No rotation key provided')
175175+ }
176176+ const credentials = {
177177+ ...getDidCredentials.data,
178178+ rotationKeys: [recoveryKey.did(), ...rotationKeys],
179179+ }
165180166181 // @NOTE, this token will need to come from the email from the previous step
167182 const TOKEN = ''
168183169184 const plcOp = await oldAgent.com.atproto.identity.signPlcOperation({
170185 token: TOKEN,
171171- ...getDidCredentials.data,
186186+ ...credentials,
172187 })
188188+189189+ console.log(
190190+ `โ Your private recovery key is: ${privateKey}. Please store this in a secure location! โ`,
191191+ )
173192174193 await newAgent.com.atproto.identity.submitPlcOperation({
175194 operation: plcOp.data.operation,
···181200 await newAgent.com.atproto.server.activateAccount()
182201 await oldAgent.com.atproto.server.deactivateAccount({})
183202}
184184-```203203+204204+```
+2-1
Dockerfile
···11FROM node:20.11-alpine3.18 as build
2233-RUN npm install -g pnpm
33+RUN corepack enable
4455# Move files into the image and install
66WORKDIR /app
77COPY ./service ./
88+RUN corepack prepare --activate
89RUN pnpm install --production --frozen-lockfile > /dev/null
9101011# Uses assets from build stage to reduce build size
+202
LICENSE-APACHE.txt
···11+22+ Apache License
33+ Version 2.0, January 2004
44+ http://www.apache.org/licenses/
55+66+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
77+88+ 1. Definitions.
99+1010+ "License" shall mean the terms and conditions for use, reproduction,
1111+ and distribution as defined by Sections 1 through 9 of this document.
1212+1313+ "Licensor" shall mean the copyright owner or entity authorized by
1414+ the copyright owner that is granting the License.
1515+1616+ "Legal Entity" shall mean the union of the acting entity and all
1717+ other entities that control, are controlled by, or are under common
1818+ control with that entity. For the purposes of this definition,
1919+ "control" means (i) the power, direct or indirect, to cause the
2020+ direction or management of such entity, whether by contract or
2121+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
2222+ outstanding shares, or (iii) beneficial ownership of such entity.
2323+2424+ "You" (or "Your") shall mean an individual or Legal Entity
2525+ exercising permissions granted by this License.
2626+2727+ "Source" form shall mean the preferred form for making modifications,
2828+ including but not limited to software source code, documentation
2929+ source, and configuration files.
3030+3131+ "Object" form shall mean any form resulting from mechanical
3232+ transformation or translation of a Source form, including but
3333+ not limited to compiled object code, generated documentation,
3434+ and conversions to other media types.
3535+3636+ "Work" shall mean the work of authorship, whether in Source or
3737+ Object form, made available under the License, as indicated by a
3838+ copyright notice that is included in or attached to the work
3939+ (an example is provided in the Appendix below).
4040+4141+ "Derivative Works" shall mean any work, whether in Source or Object
4242+ form, that is based on (or derived from) the Work and for which the
4343+ editorial revisions, annotations, elaborations, or other modifications
4444+ represent, as a whole, an original work of authorship. For the purposes
4545+ of this License, Derivative Works shall not include works that remain
4646+ separable from, or merely link (or bind by name) to the interfaces of,
4747+ the Work and Derivative Works thereof.
4848+4949+ "Contribution" shall mean any work of authorship, including
5050+ the original version of the Work and any modifications or additions
5151+ to that Work or Derivative Works thereof, that is intentionally
5252+ submitted to Licensor for inclusion in the Work by the copyright owner
5353+ or by an individual or Legal Entity authorized to submit on behalf of
5454+ the copyright owner. For the purposes of this definition, "submitted"
5555+ means any form of electronic, verbal, or written communication sent
5656+ to the Licensor or its representatives, including but not limited to
5757+ communication on electronic mailing lists, source code control systems,
5858+ and issue tracking systems that are managed by, or on behalf of, the
5959+ Licensor for the purpose of discussing and improving the Work, but
6060+ excluding communication that is conspicuously marked or otherwise
6161+ designated in writing by the copyright owner as "Not a Contribution."
6262+6363+ "Contributor" shall mean Licensor and any individual or Legal Entity
6464+ on behalf of whom a Contribution has been received by Licensor and
6565+ subsequently incorporated within the Work.
6666+6767+ 2. Grant of Copyright License. Subject to the terms and conditions of
6868+ this License, each Contributor hereby grants to You a perpetual,
6969+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
7070+ copyright license to reproduce, prepare Derivative Works of,
7171+ publicly display, publicly perform, sublicense, and distribute the
7272+ Work and such Derivative Works in Source or Object form.
7373+7474+ 3. Grant of Patent License. Subject to the terms and conditions of
7575+ this License, each Contributor hereby grants to You a perpetual,
7676+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
7777+ (except as stated in this section) patent license to make, have made,
7878+ use, offer to sell, sell, import, and otherwise transfer the Work,
7979+ where such license applies only to those patent claims licensable
8080+ by such Contributor that are necessarily infringed by their
8181+ Contribution(s) alone or by combination of their Contribution(s)
8282+ with the Work to which such Contribution(s) was submitted. If You
8383+ institute patent litigation against any entity (including a
8484+ cross-claim or counterclaim in a lawsuit) alleging that the Work
8585+ or a Contribution incorporated within the Work constitutes direct
8686+ or contributory patent infringement, then any patent licenses
8787+ granted to You under this License for that Work shall terminate
8888+ as of the date such litigation is filed.
8989+9090+ 4. Redistribution. You may reproduce and distribute copies of the
9191+ Work or Derivative Works thereof in any medium, with or without
9292+ modifications, and in Source or Object form, provided that You
9393+ meet the following conditions:
9494+9595+ (a) You must give any other recipients of the Work or
9696+ Derivative Works a copy of this License; and
9797+9898+ (b) You must cause any modified files to carry prominent notices
9999+ stating that You changed the files; and
100100+101101+ (c) You must retain, in the Source form of any Derivative Works
102102+ that You distribute, all copyright, patent, trademark, and
103103+ attribution notices from the Source form of the Work,
104104+ excluding those notices that do not pertain to any part of
105105+ the Derivative Works; and
106106+107107+ (d) If the Work includes a "NOTICE" text file as part of its
108108+ distribution, then any Derivative Works that You distribute must
109109+ include a readable copy of the attribution notices contained
110110+ within such NOTICE file, excluding those notices that do not
111111+ pertain to any part of the Derivative Works, in at least one
112112+ of the following places: within a NOTICE text file distributed
113113+ as part of the Derivative Works; within the Source form or
114114+ documentation, if provided along with the Derivative Works; or,
115115+ within a display generated by the Derivative Works, if and
116116+ wherever such third-party notices normally appear. The contents
117117+ of the NOTICE file are for informational purposes only and
118118+ do not modify the License. You may add Your own attribution
119119+ notices within Derivative Works that You distribute, alongside
120120+ or as an addendum to the NOTICE text from the Work, provided
121121+ that such additional attribution notices cannot be construed
122122+ as modifying the License.
123123+124124+ You may add Your own copyright statement to Your modifications and
125125+ may provide additional or different license terms and conditions
126126+ for use, reproduction, or distribution of Your modifications, or
127127+ for any such Derivative Works as a whole, provided Your use,
128128+ reproduction, and distribution of the Work otherwise complies with
129129+ the conditions stated in this License.
130130+131131+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132132+ any Contribution intentionally submitted for inclusion in the Work
133133+ by You to the Licensor shall be under the terms and conditions of
134134+ this License, without any additional terms or conditions.
135135+ Notwithstanding the above, nothing herein shall supersede or modify
136136+ the terms of any separate license agreement you may have executed
137137+ with Licensor regarding such Contributions.
138138+139139+ 6. Trademarks. This License does not grant permission to use the trade
140140+ names, trademarks, service marks, or product names of the Licensor,
141141+ except as required for reasonable and customary use in describing the
142142+ origin of the Work and reproducing the content of the NOTICE file.
143143+144144+ 7. Disclaimer of Warranty. Unless required by applicable law or
145145+ agreed to in writing, Licensor provides the Work (and each
146146+ Contributor provides its Contributions) on an "AS IS" BASIS,
147147+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148148+ implied, including, without limitation, any warranties or conditions
149149+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150150+ PARTICULAR PURPOSE. You are solely responsible for determining the
151151+ appropriateness of using or redistributing the Work and assume any
152152+ risks associated with Your exercise of permissions under this License.
153153+154154+ 8. Limitation of Liability. In no event and under no legal theory,
155155+ whether in tort (including negligence), contract, or otherwise,
156156+ unless required by applicable law (such as deliberate and grossly
157157+ negligent acts) or agreed to in writing, shall any Contributor be
158158+ liable to You for damages, including any direct, indirect, special,
159159+ incidental, or consequential damages of any character arising as a
160160+ result of this License or out of the use or inability to use the
161161+ Work (including but not limited to damages for loss of goodwill,
162162+ work stoppage, computer failure or malfunction, or any and all
163163+ other commercial damages or losses), even if such Contributor
164164+ has been advised of the possibility of such damages.
165165+166166+ 9. Accepting Warranty or Additional Liability. While redistributing
167167+ the Work or Derivative Works thereof, You may choose to offer,
168168+ and charge a fee for, acceptance of support, warranty, indemnity,
169169+ or other liability obligations and/or rights consistent with this
170170+ License. However, in accepting such obligations, You may act only
171171+ on Your own behalf and on Your sole responsibility, not on behalf
172172+ of any other Contributor, and only if You agree to indemnify,
173173+ defend, and hold each Contributor harmless for any liability
174174+ incurred by, or claims asserted against, such Contributor by reason
175175+ of your accepting any such warranty or additional liability.
176176+177177+ END OF TERMS AND CONDITIONS
178178+179179+ APPENDIX: How to apply the Apache License to your work.
180180+181181+ To apply the Apache License to your work, attach the following
182182+ boilerplate notice, with the fields enclosed by brackets "[]"
183183+ replaced with your own identifying information. (Don't include
184184+ the brackets!) The text should be enclosed in the appropriate
185185+ comment syntax for the file format. We also recommend that a
186186+ file or class name and description of purpose be included on the
187187+ same "printed page" as the copyright notice for easier
188188+ identification within third-party archives.
189189+190190+ Copyright [yyyy] [name of copyright owner]
191191+192192+ Licensed under the Apache License, Version 2.0 (the "License");
193193+ you may not use this file except in compliance with the License.
194194+ You may obtain a copy of the License at
195195+196196+ http://www.apache.org/licenses/LICENSE-2.0
197197+198198+ Unless required by applicable law or agreed to in writing, software
199199+ distributed under the License is distributed on an "AS IS" BASIS,
200200+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201+ See the License for the specific language governing permissions and
202202+ limitations under the License.
+19
LICENSE-MIT.txt
···11+MIT License
22+33+Permission is hereby granted, free of charge, to any person obtaining a copy
44+of this software and associated documentation files (the "Software"), to deal
55+in the Software without restriction, including without limitation the rights
66+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77+copies of the Software, and to permit persons to whom the Software is
88+furnished to do so, subject to the following conditions:
99+1010+The above copyright notice and this permission notice shall be included in all
1111+copies or substantial portions of the Software.
1212+1313+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1414+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1515+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1616+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1717+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919+SOFTWARE.
+7
LICENSE.txt
···11+Dual MIT/Apache-2.0 License
22+33+Copyright (c) 2022-2024 Bluesky PBC, and Contributors
44+55+Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
66+77+Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
+83-23
README.md
···11# PDS
2233-Welcome to the repository for the official Bluesky PDS (Personal Data Server). This repository includes container images and documentation designed to assist technical people with self-hosting a Bluesky PDS.
33+Welcome to the repository for the official Bluesky PDS (Personal Data Server). This repository includes container images and documentation designed to assist technical people with hosting a Bluesky PDS.
44+55+Head over to the [AT Protocol PDS Admins Discord](https://discord.gg/e7hpHxRfBP) to chat with other folks hosting instances and get important updates about the PDS distribution!
4657## Table of Contents
68···1315 * [What is AT Protocol?](#what-is-at-protocol)
1416 * [Where is the code?](#where-is-the-code)
1517 * [What is the current status of federation?](#what-is-the-current-status-of-federation)
1616- * [What should I know about running a PDS in the developer sandbox?](#what-should-i-know-about-running-a-pds-in-the-developer-sandbox)
1718- [Self-hosting PDS](#self-hosting-pds)
1819 * [Preparation for self-hosting PDS](#preparation-for-self-hosting-pds)
1920 * [Open your cloud firewall for HTTP and HTTPS](#open-your-cloud-firewall-for-http-and-https)
···2425 * [Creating an account using pdsadmin](#creating-an-account-using-pdsadmin)
2526 * [Creating an account using an invite code](#creating-an-account-using-an-invite-code)
2627 * [Using the Bluesky app with your PDS](#using-the-bluesky-app-with-your-pds)
2828+ * [Setting up SMTP](#setting-up-smtp)
2729 * [Updating your PDS](#updating-your-pds)
28302931<!-- tocstop -->
···44464547### Where is the code?
46484747-* [TypeScript code](https://github.com/bluesky-social/atproto)
4949+* [TypeScript code](https://github.com/bluesky-social/atproto/tree/main/packages/pds)
4850* [Go code](https://github.com/bluesky-social/indigo)
49515052### What is the current status of federation?
51535252-As of Feb, 2024, the AT Protocol data service (PDS) is now open to federation for self-hosters!
5454+As of Spring 2024, the AT Protocol network is open to federation!
53555456โ Federated domain handles (e.g. `@nytimes.com`)
5557···59616062โ Federated app views (API service)
61636262-โ Federated data for self-hosters (PDS hosting)
6464+โ Federated data (PDS hosting)
63656464-๐ฉ Federated moderation (labeling) (coming soon)
6565-6666-๐ฉ Federated data for large service providers (coming soon)
6767-6868-### What should I know about running a PDS in the developer sandbox?
6969-7070-Developers may now run self-hosted PDS hosts on the production network!
7171-7272-Though it is still recommended to run experiments in the developer sandbox network.
7373-7474-Read the [SANDBOX.md](https://github.com/bluesky-social/pds/blob/main/SANDBOX.md) for an overview of the sandbox network.
6666+โ Federated moderation (labeling)
75677668## Self-hosting PDS
7769···9284| | |
9385| ---------------- | ------------ |
9486| Operating System | Ubuntu 22.04 |
9595-| Memory (RAM) | 2+ GB |
9696-| CPU Cores | 2+ |
9797-| Storage | 40+ GB SSD |
8787+| Memory (RAM) | 1 GB |
8888+| CPU Cores | 1 |
8989+| Storage | 20 GB SSD |
9890| Architectures | amd64, arm64 |
9999-9191+| Number of users | 1-20 |
9292+10093**Note:** It is a good security practice to restrict inbound ssh access (port 22/tcp) to your own computer's public IP address. You can check your current public IP address using [ifconfig.me](https://ifconfig.me/).
1019410295### Open your cloud firewall for HTTP and HTTPS
···159152160153### Verifying that your PDS is online and accessible
161154162162-You can check if your server is online and healthy by requesting the healthcheck endpoint.
155155+> [!TIP]
156156+> The most common problems with getting PDS content consumed in the live network are when folks substitute the provided Caddy configuration for nginx, apache, or similar reverse proxies. Getting TLS certificates, WebSockets, and virtual server names all correct can be tricky. We are not currently providing tech support for other configurations.
163157164164-You can visit `https://example.com/xrpc/_health` in your browser. You should see a JSON response with a version.
158158+You can check if your server is online and healthy by requesting the healthcheck endpoint.
165159166166-For example:
160160+You can visit `https://example.com/xrpc/_health` in your browser. You should see a JSON response with a version, like:
167161168162```
169163{"version":"0.2.2-beta.2"}
170164```
165165+166166+You'll also need to check that WebSockets are working, for the rest of the network to pick up content from your PDS. You can test by installing a tool like `wsdump` and running a command like:
167167+168168+```bash
169169+wsdump "wss://example.com/xrpc/com.atproto.sync.subscribeRepos?cursor=0"
170170+```
171171+172172+Note that there will be no events output on the WebSocket until they are created in the PDS, so the above command may continue to run with no output if things are configured successfully.
171173172174### Creating an account using pdsadmin
173175···199201200202_Note: because the subdomain TLS certificate is created on-demand, it may take 10-30s for your handle to be accessible. If you aren't seeing your first post/profile, wait 30s and try to make another post._
201203204204+### Setting up SMTP
205205+206206+To be able to verify users' email addresses and send other emails, you need to set up an SMTP server.
207207+208208+One way to do this is to use an email service. [Resend](https://resend.com/) and [SendGrid](https://sendgrid.com/) are two popular choices.
209209+210210+Create an account and API key on an email service, ensure your server allows access on the required ports, and set these variables in `/pds/pds.env` (example with Resend):
211211+212212+```
213213+PDS_EMAIL_SMTP_URL=smtps://resend:<your api key here>@smtp.resend.com:465/
214214+PDS_EMAIL_FROM_ADDRESS=admin@your.domain
215215+```
216216+217217+If you prefer to use a standard SMTP server (a local one or from your email provider), put your account's username and password in the URL:
218218+219219+```
220220+PDS_EMAIL_SMTP_URL=smtps://username:password@smtp.example.com/
221221+```
222222+223223+Alternatively, if you're running a local sendmail-compatible mail service like Postfix or Exim on the same host, you can configure the PDS to use the sendmail transport by using such URL:
224224+225225+```
226226+PDS_EMAIL_SMTP_URL=smtp:///?sendmail=true
227227+```
228228+229229+_Note: Your PDS will need to be restarted with those variables. This varies depending on your setup. If you followed this installation guide, run `systemctl restart pds`. You might need to restart the server or recreate the container, depending on what you are using._
230230+231231+### Logging
232232+233233+By default, logs from the PDS are printed to `stdout` and end up in Docker's log. You can browse them by running:
234234+235235+```
236236+[sudo] docker logs pds
237237+```
238238+239239+Note: these logs are not persisted, so they will be lost after server reboot.
240240+241241+Alternatively, you can configure the logs to be printed to a file by setting `LOG_DESTINATION`:
242242+243243+```
244244+LOG_DESTINATION=/pds/pds.log
245245+```
246246+247247+You can also change the minimum level of logs to be printed (default: `info`):
248248+249249+```
250250+LOG_LEVEL=debug
251251+```
252252+202253### Updating your PDS
203254204255It is recommended that you keep your PDS up to date with new versions, otherwise things may break. You can use the `pdsadmin` tool to update your PDS.
···206257```bash
207258sudo pdsadmin update
208259```
260260+261261+## License
262262+263263+This project is dual-licensed under MIT and Apache 2.0 terms:
264264+265265+- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/pds/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
266266+- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/pds/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)
267267+268268+Downstream projects and end users may choose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
-168
SANDBOX.md
···11-# Bluesky Developer Sandbox Guide
22-33-Welcome to the atproto federation developer sandbox!
44-55-This is a completely separate network from our production services that allows us to test out the federation architecture and wire protocol.
66-77-The 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.
88-99-To 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.
1010-1111-Given 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.
1212-1313-<!-- markdown-toc -i SANDBOX.md -->
1414-1515-<!-- toc -->
1616-1717-- [Guidelines that must be followed](#guidelines-that-must-be-followed)
1818- * [Post responsibly](#post-responsibly)
1919- * [Keep the emphasis on testing](#keep-the-emphasis-on-testing)
2020- * [Do limit account creation](#do-limit-account-creation)
2121- * [Donโt expect persistence or uptime](#dont-expect-persistence-or-uptime)
2222- * [Don't advertise your service as being "Bluesky"](#dont-advertise-your-service-as-being-bluesky)
2323- * [Do not mirror sandbox did:plcs to production](#do-not-mirror-sandbox-didplcs-to-production)
2424- * [Status and Wipes](#status-and-wipes)
2525- + [๐ Beware of dragons!](#%F0%9F%90%89-beware-of-dragons)
2626- + [Routine wipes](#routine-wipes)
2727-- [Getting started](#getting-started)
2828- * [Auto-updates](#auto-updates)
2929- * [Odds & Ends & Warnings & Reminders](#odds--ends--warnings--reminders)
3030-- [Learn more about atproto federation](#learn-more-about-atproto-federation)
3131- * [Network Services](#network-services)
3232- + [PLC](#plc)
3333- + [BGS](#bgs)
3434- + [Bluesky App View](#bluesky-app-view)
3535-- [The PDS](#the-pds)
3636-3737-<!-- tocstop -->
3838-3939-# Guidelines that must be followed
4040-4141-Using the sandbox environment means you agree to adhere to our Guidelines. Please read the following carefully:
4242-4343-## Post responsibly
4444-4545-The 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.
4646-4747-Do not post content that requires active moderation or violates the [Bluesky Community Guidelines](https://bsky.social/about/support/community-guidelines).
4848-4949-## Keep the emphasis on testing
5050-5151-Weโ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.
5252-5353-## Do limit account creation
5454-5555-We 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.
5656-5757-## Donโt expect persistence or uptime
5858-5959-We 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.
6060-6161-## Don't advertise your service as being "Bluesky"
6262-6363-This 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.
6464-6565-## Do not mirror sandbox did:plcs to production
6666-6767-6868-## Status and Wipes
6969-7070-### ๐ย Beware of dragons!
7171-7272-This 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.
7373-7474-On 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).
7575-7676-### Routine wipes
7777-7878-As part of the sandbox, we will be doing routine wipes of all network data.
7979-8080-We expect to perform wipes on a weekly or bi-weekly basis, though we reserve the right to do a wipe at any point.
8181-8282-When 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.
8383-8484-# Getting started
8585-8686-For complete instructions on getting your PDS set up, check out the [README](./README.md).
8787-8888-To 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.
8989-9090-## Auto-updates
9191-9292-Weโ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.
9393-9494-This 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.
9595-9696-When we do routine network wipes, we will be pushing out a database migration to participating PDS that wipes content and accounts.
9797-9898-You 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.
9999-100100-## Odds & Ends & Warnings & Reminders
101101-102102-๐งช Experiment & have fun!
103103-104104-๐คย 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!
105105-106106-๐ Feel free to run your own AppView or BGS - although itโs a bit more involved & weโll be providing limited support for this.
107107-108108-โ๏ธ 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.
109109-110110-โฑ๏ธ 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.
111111-112112-๐คย 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.
113113-114114-โ ๏ธ If you follow the self-hosted PDS setup instructions, youโll have private key material in your env file - be careful about sharing that!
115115-116116-๐ฃย This is a sandbox version of a **public broadcast protocol** - please do not share sensitive information.
117117-118118-๐คย 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.
119119-120120-# Learn more about atproto federation
121121-122122-Check out the [high-level view of federation](https://bsky.social/about/blog/5-5-2023-federation-architecture).
123123-124124-Dive deeper with the [atproto docs](https://atproto.com/docs).
125125-126126-## Network Services
127127-128128-We are running three services: PLC, BGS, Bluesky "App View"
129129-130130-### PLC
131131-132132-**Hostname:** `plc.bsky-sandbox.dev`
133133-134134-**Code:** https://github.com/bluesky-social/did-method-plc
135135-136136-PLC 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.
137137-138138-### BGS
139139-140140-**Hostname:** `bgs.bsky-sandbox.dev`
141141-142142-**Code:** https://github.com/bluesky-social/indigo/tree/main/bgs
143143-144144-BGS (Big Graph Service) is the firehose for the entire network. It collates data from PDSs & rebroadcasts them out on one giant websocket.
145145-146146-BGS 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.
147147-148148-If 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
149149-150150-### Bluesky App View
151151-152152-**Hostname:** `api.bsky-sandbox.dev`
153153-154154-**Code:** https://github.com/bluesky-social/atproto/tree/main/packages/bsky
155155-156156-The 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.
157157-158158-When you request a Bluesky-related view from your PDS (`getProfile` for instance), your PDS will actually proxy the request up to App View.
159159-160160-Feel free to experiment with running your own App View if you like!
161161-162162-# The PDS
163163-164164-The 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.
165165-166166-Weโ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.
167167-168168-The 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.
···33set -o nounset
44set -o pipefail
5566-PDS_ENV_FILE="/pds/pds.env"
66+PDS_ENV_FILE=${PDS_ENV_FILE:-"/pds/pds.env"}
77source "${PDS_ENV_FILE}"
8899# curl a URL and fail if the request fails.
···2020 e.g. pdsadmin account create alice@example.com alice.example.com
2121 delete <DID>
2222 Delete an account specified by DID.
2323- e.g. pdsadmin account takedown did:plc:xyz123abc456
2323+ e.g. pdsadmin account delete did:plc:xyz123abc456
2424 takedown <DID>
2525 Takedown an account specified by DID.
2626 e.g. pdsadmin account takedown did:plc:xyz123abc456
2727 untakedown <DID>
2828- Remove a takedown an account specified by DID.
2929- e.g. pdsadmin account takedown did:plc:xyz123abc456
3030- password-reset <DID>
2828+ Remove a takedown from an account specified by DID.
2929+ e.g. pdsadmin account untakedown did:plc:xyz123abc456
3030+ reset-password <DID>
3131 Reset a password for an account specified by DID.
3232 e.g. pdsadmin account reset-password did:plc:xyz123abc456
3333