dockerized atproto relay

tons of changes but it's working

besaid.zone f288fb9c 4b6ba949

verified
+1 -1
.env.example
··· 1 1 RELAY_LENIENT_SYNC_VALIDATION=true 2 - RELAY_REPLAY_WINDOW=24h 2 + RELAY_REPLAY_WINDOW=48h 3 3 RELAY_PERSIST_DIR=/data/relay/persist 4 4 RELAY_ADMIN_PASSWORD= 5 5 RELAY_TRUSTED_DOMAINS=
+2 -1
.gitignore
··· 1 1 .env 2 - indigo 2 + indigo 3 + *.txt
+37 -3
README.md
··· 28 28 29 29 ```bash 30 30 RELAY_LENIENT_SYNC_VALIDATION=true 31 - RELAY_REPLAY_WINDOW=24h 31 + RELAY_REPLAY_WINDOW=48h 32 32 RELAY_PERSIST_DIR=/data/relay/persist 33 33 RELAY_ADMIN_PASSWORD= 34 34 RELAY_TRUSTED_DOMAINS= ··· 41 41 POSTGRES_DB= 42 42 ``` 43 43 44 - start relay 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 + reverse_proxy relay:2470 51 + } 52 + ``` 53 + 54 + if you wanted to just test things out you can use something like ngrok 55 + 56 + ```bash 57 + ngrok http 2470 58 + ``` 59 + 60 + then just take whatever domain is generated for you and add it to the caddyfile 61 + 62 + start the relay 45 63 46 64 ```bash 47 65 docker compose up -d ··· 57 75 58 76 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 59 77 60 - note: im still figuring this out so i may be missing a lot of stuff 78 + 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. 79 + 80 + to use this script you'd need to [install `goat`](https://github.com/bluesky-social/indigo/tree/main/cmd/goat#install) 81 + 82 + make the script executable and run it and redirect the output to a text file 83 + 84 + ```bash 85 + chmod u+x pull-hosts.sh 86 + 87 + ./pull-hosts > hosts.txt 88 + ``` 89 + 90 + we can then use `goat` to add hosts to the relay 91 + 92 + ```bash 93 + shuf hosts.txt | parallel goat relay admin host add {} 94 + ```
+3
conf/Caddyfile
··· 1 + yourdomain.com { 2 + reverse_proxy relay:2470 3 + }
+27 -8
docker-compose.yml
··· 1 - volumes: 2 - relay: 3 - name: relay 4 - 5 1 services: 6 - server: 2 + relay: 7 3 env_file: .env 8 4 ports: 9 5 - 2470:2470 ··· 16 12 condition: service_healthy 17 13 restart: true 18 14 volumes: 19 - - relay:/data/relay/persist 15 + - ${HOME}/data/relay/persist:/data/relay/persist 16 + networks: 17 + - web 18 + caddy: 19 + image: caddy:2.10 20 + restart: unless-stopped 21 + ports: 22 + - "80:80" 23 + - "443:443" 24 + volumes: 25 + - $PWD/conf:/etc/caddy 26 + - caddy_data:/data 27 + networks: 28 + - web 20 29 db: 21 30 env_file: .env 22 - image: postgres:latest 31 + image: postgres:16 23 32 healthcheck: 24 33 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] 25 34 interval: 10s ··· 31 40 - ${HOME}/postgres-data:/var/lib/postgresql/data 32 41 - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro 33 42 ports: 34 - - "5432:5432" 43 + - "5432:5432" 44 + networks: 45 + - web 46 + 47 + volumes: 48 + caddy_data: 49 + caddy_config: 50 + 51 + networks: 52 + web: 53 + external: false
+1 -4
init.sql
··· 1 - CREATE DATABASE relay; 2 - 3 - CREATE USER relay WITH SUPERUSER PASSWORD "changeme"; 4 - GRANT ALL PRIVILEGES ON DATABASE relay TO relay; 1 + ALTER USER relay WITH SUPERUSER;
+5
pull-hosts.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + curl -s https://raw.githubusercontent.com/mary-ext/atproto-scraping/refs/heads/trunk/state.json \ 5 + | jq -r '.pdses | keys[]'