+1
.env.example
+1
.env.example
+1
-92
README.md
+1
-92
README.md
···
1
# Dockerized AT Protocol Relay
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
-
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
63
-
64
-
```bash
65
-
docker compose up -d
66
-
```
67
-
68
-
verify that it is running
69
-
70
-
```bash
71
-
curl localhost:2470
72
-
```
73
-
74
-
## PDS Crawling
75
-
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
77
-
78
-
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)
79
-
80
-
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)
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
-
```
+12
-1
conf/Caddyfile
+12
-1
conf/Caddyfile
-1
conf/postgres.conf
-1
conf/postgres.conf
···
1
-
listen_addresses = '127.0.0.1'
···
+2
-6
docker-compose.yml
+2
-6
docker-compose.yml
···
29
- caddy_data:/data
30
db:
31
env_file: .env
32
-
image: postgres:17-alpine
33
healthcheck:
34
-
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
35
-
interval: 10s
36
retries: 5
37
start_period: 30s
38
timeout: 10s
···
40
volumes:
41
- ${HOME}/postgres-data:/var/lib/postgresql/data
42
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
43
-
- ./conf/postgres.conf:/etc/postgresql/postgresql.conf
44
-
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
45
ports:
46
- "5432:5432"
47
networks:
48
- backend
49
-
50
volumes:
51
caddy_data:
52
caddy_config:
···
29
- caddy_data:/data
30
db:
31
env_file: .env
32
+
image: postgres:16-alpine
33
healthcheck:
34
+
test: ["CMD-SHELL", "pg_isready -U relay"]
35
retries: 5
36
start_period: 30s
37
timeout: 10s
···
39
volumes:
40
- ${HOME}/postgres-data:/var/lib/postgresql/data
41
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
42
ports:
43
- "5432:5432"
44
networks:
45
- backend
46
volumes:
47
caddy_data:
48
caddy_config: