···1# Dockerized AT Protocol Relay
23-Heavily ~~copy and pasted~~ influenced by [phil's relay configurations](https://gist.github.com/futurGH/2ee18d385eff3ba98f5b35b9dcac0aed#file-docker-compose-yaml-L1) and [futur.blue's whitewind blog post](https://whtwnd.com/futur.blue/3lkubavdilf2m)
4-5-## Setup
6-7-clone this repo and change directory into it
8-9-```bash
10-git clone git@tangled.sh:dane.is.extraordinarily.cool/relay-docker
11-12-cd relay-docker
13-```
14-15-clone the indigo repo
16-17-```bash
18-git clone git@github.com:bluesky-social/indigo.git
19-```
20-21-rename the `.env.example` file to just `.env`
22-23-```bash
24-mv .env.example .env
25-```
26-27-add values for these env variables, see [configuration and operation](https://github.com/bluesky-social/indigo/blob/main/cmd/relay/README.md#configuration-and-operation) section in the indigo repo to understand what the values mean
28-29-```bash
30-RELAY_LENIENT_SYNC_VALIDATION=true
31-RELAY_REPLAY_WINDOW=48h
32-RELAY_PERSIST_DIR=/data/relay/persist
33-RELAY_ADMIN_PASSWORD=
34-RELAY_TRUSTED_DOMAINS=
35-RELAY_HOST_CONCURRENCY=4
36-37-# database env
38-DATABASE_URL=
39-POSTGRES_USER=
40-POSTGRES_PASSWORD=
41-POSTGRES_DB=
42-```
43-44-update the caddy file to point to your domain (make sure you have set up the necessary dns records)
45-46-```bash
47-// conf/Caddyfile
48-49-yourdomain.com {
50- tls {
51- on_demand
52- }
53-54- handle /xrpc/com.atproto.sync.subscribeRepos {
55- reverse_proxy 127.0.0.1:2470 {
56- header_up Origin "yourdomain.com"
57- }
58- }
59-60- reverse_proxy localhost:2470
61-}
62-```
63-64-if you wanted to just test things out you can use something like ngrok
65-66-```bash
67-ngrok http 2470
68-```
69-70-then just take whatever domain is generated for you and add it to the caddyfile
71-72-start the relay
73-74-```bash
75-docker compose up -d
76-```
77-78-verify that it is running
79-80-```bash
81-curl localhost:2470
82-```
83-84-## PDS Crawling
85-86-see [bootstrapping host list](https://github.com/bluesky-social/indigo/blob/main/cmd/relay/README.md#bootstrapping-host-list) and the [how to do it](https://whtwnd.com/futur.blue/3lkubavdilf2m) section in futur's blog post to see how to bootstrap your relay with pdses
87-88-for convenience, I've included a `pull-hosts.sh` that pulls a list of pdses based on [mary's pds scraper script](https://raw.githubusercontent.com/mary-ext/atproto-scraping/refs/heads/trunk/state.json)
89-90-you can write whatever script you want to do the requestCrawl to the pdes but the easiest way is probably [installing and using `goat`](https://github.com/bluesky-social/indigo/tree/main/cmd/goat#install)
91-92-make the script executable and run it and redirect the output to a text file
93-94-```bash
95-chmod u+x pull-hosts.sh
96-97-./pull-hosts > hosts.txt
98-```
99-100-we can then use `goat` to add hosts to the relay
101-102-```bash
103-shuf hosts.txt | RELAY_HOST=http://localhost:2470 parallel goat relay admin host add {}
104-```
···1# Dockerized AT Protocol Relay
23+see [bluesky deploy recipes repo](https://github.com/nulfrost/deploy-recipes/blob/relay-recipe/atproto-relay-docker/README.md) for guide on how to deploy this setup00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000