Install the FediBuzz relay using a virtual machine running Ubuntu Server 22.04.4 LTS. If you are familiar with NixOS/Flakes, then [installing the NixOS module](https://github.com/astro/buzzrelay?tab=readme-ov-file#build) for this is by far the easier route!
But for those of us unfamiliar with NixOS, here's another option.
# Server Configuration
My system consisted of the following:
* Router Configured to forward 80, 443 through a firewall to NGINX Proxy Manager
* NGINX Proxy Manager then directs traffic based on the incoming domain name to the appropriate server.
* A ProxMox server with an Ubuntu VM hosting the FediBuzz relay application.
## Hardware
This could be run very cheaply on your preferred hosting site, or on your own home lab.
* Ubuntu 22.04.4 LTS
* 1 Core
* 1 GB RAM
The official fedi.buzz relay traffics around 330 public instance streams for around 3,500 unique followers (some may have multiple relay requests) as of April 2024 with a similar configuration.
If you're connecting to the fedi.buzz relay and perhaps one or two others on your own relay, this should be more than enough.
One caveat here. FediBuzz has an option for individual users to utilize relays as well by "following" a relay actor, like `@tag-dogsofmastodon@relay.com`.
If you promote this alternative route and many individuals start connecting to your relay, it will cause more outgoing traffic and queue processing, therefore increasing your hardware requirements.
As with most fediverse projects, you're going to need a domain. In this particular instance, I used a subdomain of https://relay.{yourdomain}.
# NGINX Proxy Manager Config
You'll need an SSL certificate for at least the sub-domain. NGINX Proxy Manager has this built in, but you may need some additional assistance depending on your configuration.
I needed a wildcard SSL for my domain, and used the PorkBun API to make that work. Here's a [blog post about Cloudflare](https://blog.jverkamp.com/2023/03/27/wildcard-lets-encrypt-certificates-with-nginx-proxy-manager-and-cloudflare/), but the setup is very similar for PorkBun.
Websockets may not be required, but I enabled it in NGINX Proxy Manager during configuration.
# Firewall
The following ports need to be open on the server running FediRelay.
`ALTER USER relay WITH PASSWORD 'your-secure-password';`
Then create database:
`CREATE DATABASE buzzrelay;`
Then grant the relay user with full rights to the database:
```
ALTER DATABASE buzzrelay OWNER TO relay;
```
```
GRANT ALL PRIVILEGES ON DATABASE buzzrelay TO relay;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO relay;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO relay;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO relay;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO relay;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO relay;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON FUNCTIONS TO relay;
GRANT USAGE, CREATE ON SCHEMA public TO relay;
```
## Querying the database
A cheat sheet for getting to the database.
```
sudo -i -u postgres
psql
\c buzzrelay
```
# Redis
It's not necessary to install this, it is not used by the core relay. Just comment out the associated lines in the YAML file.
This was used if you are going to host the page shown at [https://fedi.buzz](https://fedi.buzz) which doesn't come with this relay configuration.
# Update config.yaml
Several items need to be updated, see below
## Streams
* Leave the fedibuzz stream as is.
* Comment out the first example.
* Change the last example to your instance's url and token.
* Add as many others as desired.
## Additional filters for streams
If you have a token for an instance that you are using to connect to a mastodon public stream, you're not limited to just the federated stream of all posts. If you want to get more granular, these streaming timelines work, too.
All of the items listed below have a /local/ version as well if you want to get REALLY granular and only pick up posts from the local instance.
> This does not work for the default fedibuzz relay stream, only for mastodon servers for which you have an access token.
**Public remote posts only - federated posts excluding local ones**
You can also pass a "only_media" parameter in the querystring and get back only posts with some type of attachment (audio, image, or video) Cool!
```http
GET /api/v1/streaming/public/remote?only_media={true|false}&access_token={yourAccessToken} HTTP/1.1
```
**Public posts with a specific hashtag**
>This one does not has the only_media parameter unfortunately.
```http
GET /api/v1/streaming/hashtag?tag={yourTag}&access_token={yourAccessToken} HTTP/1.1
```
**Watch a list for posts**
For the user with the associated token, you can create a list of accounts and pass the list_id to this query. It will return only posts from those accounts.
```http
GET /api/v1/streaming/list?list={yourListId}&access_token={yourAccessToken} HTTP/1.1
```
### Hostname
Set it to your domain. I used the sub-domain format of "relay.{yourdomain}"
### Private Key File
Generate a new RSA key pair for signing ActivityPub messages. Note using this command also sets the appropriate permissions values.