···110110111111The relay admin interface has flexibility for many situations, but in some operational incidents it may be necessary to run SQL commands to do cleanups. This should be done when the relay is not actively operating. It is also recommended to run SQL commands in a transaction that can be rolled back in case of a typo or mistake.
112112113113+On the public web, you should probably run the relay behind a load-balancer or reverse proxy like `haproxy` or `caddy`, which manages TLS and can have various HTTP limits and behaviors configured. Remember that WebSocket support is required.
114114+115115+The relay does not resolve atproto handles, but it does do DNS resolutions for hostnames, and may do a burst of resolutions at startup. Note that the go runtime may have an internal DNS implementation enabled (this is the default for the Dockerfile). The relay *will* do a large number of DID resolutions, particularly calls to the PLC directory, and particularly after a process restart when the in-process identity cache is warming up.
116116+113117### PostgreSQL
114118115119PostgreSQL is recommended for any non-trival relay deployments. Database configuration is passed via the `DATABASE_URL` environment variable, or the corresponding CLI arg.
···127131128132The relay is relatively easy to build and operate as as simple executable, but there is also Dockerfile in this directory. It can be used to build customized/patched versions of the relay as a container, republish them, run locally, deploy to servers, deploy to an orchestrated cluster, etc.
129133130130-We strongly recommend running docker in "host networking" mode when operating a full-network relay.
134134+Relays process a lot of packets, so we strongly recommend running docker in "host networking" mode when operating a full-network relay. You may also want to use something other than default docker log management (eg, `svlogd`), to handle large log volumes.
131135132136### Bootstrapping Host List
133137138138+Before bulk-adding hosts, you should probably increase the "new-hosts-per-day" limit, at least temporarily.
139139+134140The relay comes with a helper command to pull a list of hosts from an existing relay. You should shut the relay down first and run this as a separate command:
135141136142 ./relay pull-hosts
143143+144144+An alternative method, using `goat` and `parallel`, which is more gentle and may be better for small servers:
145145+146146+ # dump a host list using goat
147147+ # 'rg' is ripgrep
148148+ RELAY_HOST=https://relay1.us-west.bsky.network goat relay host list | rg '\tactive' | cut -f1 > hosts.txt
149149+150150+ # assuming that .env contains local relay configuration and admin credential
151151+ shuf hosts.txt | parallel goat relay admin host add {}