···11+COCOON_DID="did:web:cocoon.example.com"
22+COCOON_HOSTNAME="cocoon.example.com"
33+COCOON_ROTATION_KEY_PATH="./rotation.key"
44+COCOON_JWK_PATH="./jwk.key"
55+COCOON_CONTACT_EMAIL="me@example.com"
66+COCOON_RELAYS=https://bsky.network
77+# Generate with `openssl rand -hex 16`
88+COCOON_ADMIN_PASSWORD=
99+# Generate with `openssl rand -hex 32`
1010+COCOON_SESSION_SECRET=
1111+# Optional: Change the session cookie name (default: session)
1212+# COCOON_SESSION_COOKIE_KEY=cocoon_session
1313+# Set this to the Turso database URL that they provide you. It'll be something like libsql://your-database-here.aws-eu-west-1.turso.io
1414+COCOON_DATABASE_URL=
1515+# Set this to the Turso token that you generate
1616+COCOON_TURSO_TOKEN=
1717+COCOON_DB_TYPE="turso"
1818+# Set this to the public URL for your subscribe repos service
1919+SUBSCRIBE_REPOS_SERVICE_URL="http://subscribe-repos:4455/events"
2020+PUSH_BASED_EVENTS=true
2121+# Generate with `openssl rand -hex 32` This needs to then be used across all instances
2222+COCOON_NONCE_SECRET=
+16
README.md
···4455This is a fork of the Cocoon PDS with the intention of making it a distributed PDS. You can read my thoughts on why I'm trying this POC out [here](https://willdot.leaflet.pub/3miiirzf7jc2j) and follow along the series for updates.
6677+88+To run a distributed version of this PDS you'll need to use `docker-compose.dist.yaml` as that has the relevant examples of extra config required. It is slightly different in that it only contains the main app. The other helper services (create keys and invite codes can be run manually).
99+1010+1111+There are also some extra requirements for setting this up:
1212+1313+1: You need to generate a nonce secret and set it as an environment variable `COCOON_NONCE_SECRET`. (Recommend running something like `openssl rand -hex 16`)
1414+2: You need to have a Turso cloud database. See more information [here](https://turso.tech)
1515+3: You need to generate a rotation and JWK keys using the `init-keys.sh` script. Both these keys need to be present on all of your nodes running a distributed Cocoon instance.
1616+4: You need to have an app called `subscribe-repos` running somewhere. This acts as a kinda reverse subscribe repos. Read more about it [here](https://willdot.leaflet.pub/3miu5jbrsrc2p). To run it you can use the docker-compose in it's [repo](https://tangled.org/willdot.net/subscribe-repos)
1717+5: Your reverse proxy needs to have some sort of load balancing so that it can route traffic between nodes. It also needs to reverse proxy the route `/xrpc/com.atproto.sync.subscribeRepos` to the `subscribe-repos` service, where ever you have that running.
1818+1919+Once you have those requirements done you should be able to spin up a couple of instances of the service using the `.env.example.dist` as a guide on the environment variables to set.
2020+2121+2222+723> [!WARNING]
824> I migrated and have been running my main account on this PDS for months now without issue, however, I am still not responsible if things go awry, particularly during account migration. Please use caution.
925