dockerized atproto relay

Compare changes

Choose any two refs to compare.

+1 -102
README.md
··· 1 1 # Dockerized AT Protocol Relay 2 2 3 - 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 - ``` 3 + 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 setup
-4
conf/grafana.ini
··· 1 - [security] 2 - 3 - admin_user = admin 4 - admin_password = password1 # CHANGE THIS IF USING GRAFANA
-26
docker-compose.yml
··· 27 27 volumes: 28 28 - $PWD/conf:/etc/caddy 29 29 - caddy_data:/data 30 - # Uncomment grafana and prometheus before building container if you want to use these 31 - # grafana: 32 - # env_file: .env 33 - # image: grafana/grafana-oss 34 - # container_name: grafana 35 - # restart: unless-stopped 36 - # depends_on: 37 - # - prometheus 38 - # ports: 39 - # - "3000:3000" 40 - # networks: 41 - # - backend 42 - # volumes: 43 - # - ./conf/grafana.ini:/etc/grafana/grafana.ini 44 - # - ${HOME}/grafana-storage:/var/lib/grafana 45 - # prometheus: 46 - # image: prom/prometheus:latest 47 - # networks: 48 - # - backend 49 - # ports: 50 - # - "9090:9090" 51 - # volumes: 52 - # - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro 53 - # depends_on: 54 - # - relay 55 30 db: 56 31 env_file: .env 57 32 image: postgres:16-alpine ··· 71 46 volumes: 72 47 caddy_data: 73 48 caddy_config: 74 - grafana-storage: {} 75 49 76 50 networks: 77 51 backend:
-4
prometheus.yml
··· 1 - scrape_configs: 2 - - job_name: "relay" 3 - static_configs: 4 - - targets: ["relay:2471"]