+1
.env.example
+1
.env.example
+1
-92
README.md
+1
-92
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
-
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
-
```
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
+12
-1
conf/Caddyfile
+12
-1
conf/Caddyfile
···
1
1
yourdomain.com {
2
-
reverse_proxy relay:2470
2
+
tls {
3
+
on_demand
4
+
}
5
+
6
+
handle /xrpc/com.atproto.sync.subscribeRepos {
7
+
reverse_proxy 127.0.0.1:2470 {
8
+
header_up Origin "yourdomain.com"
9
+
}
10
+
}
11
+
12
+
reverse_proxy localhost:2470
13
+
reverse_proxy localhost:3000
3
14
}
+12
-14
docker-compose.yml
+12
-14
docker-compose.yml
···
1
1
services:
2
2
relay:
3
3
env_file: .env
4
-
ports:
5
-
- 2470:2470
4
+
network_mode: "host"
5
+
logging:
6
+
driver: "local"
7
+
options:
8
+
max-size: "100m"
9
+
max-file: "3"
6
10
build:
7
11
context: ./indigo
8
12
dockerfile: cmd/relay/Dockerfile
···
13
17
restart: true
14
18
volumes:
15
19
- ${HOME}/data/relay/persist:/data/relay/persist
16
-
networks:
17
-
- web
18
20
caddy:
19
-
image: caddy:2.10
21
+
image: caddy:2.10-alpine
20
22
restart: unless-stopped
23
+
network_mode: host
21
24
ports:
22
25
- "80:80"
23
26
- "443:443"
24
27
volumes:
25
28
- $PWD/conf:/etc/caddy
26
29
- caddy_data:/data
27
-
networks:
28
-
- web
29
30
db:
30
31
env_file: .env
31
-
image: postgres:16
32
+
image: postgres:16-alpine
32
33
healthcheck:
33
-
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
34
-
interval: 10s
34
+
test: ["CMD-SHELL", "pg_isready -U relay"]
35
35
retries: 5
36
36
start_period: 30s
37
37
timeout: 10s
···
42
42
ports:
43
43
- "5432:5432"
44
44
networks:
45
-
- web
46
-
45
+
- backend
47
46
volumes:
48
47
caddy_data:
49
48
caddy_config:
50
49
51
50
networks:
52
-
web:
53
-
external: false
51
+
backend: