dockerized atproto relay

Dockerized AT Protocol Relay#

Heavily copy and pasted influenced by phil's relay configurations and futur.blue's whitewind blog post

Setup#

clone this repo and change directory into it

git clone git@tangled.sh:dane.is.extraordinarily.cool/relay-docker

cd relay-docker

clone the indigo repo

git clone git@github.com:bluesky-social/indigo.git

rename the .env.example file to just .env

mv .env.example .env

add values for these env variables, see configuration and operation section in the indigo repo to understand what the values mean

RELAY_LENIENT_SYNC_VALIDATION=true
RELAY_REPLAY_WINDOW=48h
RELAY_PERSIST_DIR=/data/relay/persist
RELAY_ADMIN_PASSWORD=
RELAY_TRUSTED_DOMAINS=
RELAY_HOST_CONCURRENCY=4

# database env
DATABASE_URL=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=

update the caddy file to point to your domain (make sure you have set up the necessary dns records)

// conf/Caddyfile

yourdomain.com {
    reverse_proxy relay:2470
}

if you wanted to just test things out you can use something like ngrok

ngrok http 2470

then just take whatever domain is generated for you and add it to the caddyfile

start the relay

docker compose up -d

verify that it is running

curl localhost:2470

PDS Crawling#

see bootstrapping host list and the how to do it section in futur's blog post to see how to bootstrap your relay with pdses

for convenience, I've included a pull-hosts.sh bash script that pretty much does the same thing described in the indigo repo. make sure the relay is not running before proceeding.

to use this script you'd need to install goat

make the script executable and run it and redirect the output to a text file

chmod u+x pull-hosts.sh

./pull-hosts > hosts.txt

we can then use goat to add hosts to the relay

shuf hosts.txt | parallel goat relay admin host add {}