2018-10-30 03:17:25 +00:00
|
|
|
# ActivityRelay
|
2018-08-10 18:36:17 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
A generic LitePub message relay.
|
2018-08-18 05:05:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Copyleft
|
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
ActivityRelay is copyrighted, but free software, licensed under the terms of the GNU
|
|
|
|
Affero General Public License version 3 (AGPLv3) license. You can find a copy of it
|
|
|
|
in this package as the `LICENSE` file.
|
2018-08-18 05:05:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
2020-12-28 10:36:12 +00:00
|
|
|
You need at least Python 3.6 (latest version of 3.x recommended) to make use of this software.
|
2018-08-18 15:55:10 +00:00
|
|
|
It simply will not run on older Python versions.
|
|
|
|
|
2021-10-16 00:28:19 +00:00
|
|
|
Download the project and install with pip (`pip3 install .`).
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
Copy `relay.yaml.example` to `relay.yaml` and edit it as appropriate:
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
$ cp relay.yaml.example relay.yaml
|
|
|
|
$ $EDITOR relay.yaml
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
Finally, you can launch the relay:
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
$ python3 -m relay
|
2018-08-18 05:05:48 +00:00
|
|
|
|
|
|
|
It is suggested to run this under some sort of supervisor, such as runit, daemontools,
|
|
|
|
s6 or systemd. Configuration of the supervisor is not covered here, as it is different
|
|
|
|
depending on which system you have available.
|
|
|
|
|
|
|
|
The bot runs a webserver, internally, on localhost at port 8080. This needs to be
|
|
|
|
forwarded by nginx or similar. The webserver is used to receive ActivityPub messages,
|
|
|
|
and needs to be secured with an SSL certificate inside nginx or similar. Configuration
|
|
|
|
of your webserver is not discussed here, but any guide explaining how to configure a
|
|
|
|
modern non-PHP web application should cover it.
|
|
|
|
|
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
## Getting Started
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
Normally, you would direct your LitePub instance software to follow the LitePub actor
|
|
|
|
found on the relay. In Pleroma this would be something like:
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
$ MIX_ENV=prod mix relay_follow https://your.relay.hostname/actor
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
Mastodon uses an entirely different relay protocol but supports LitePub relay protocol
|
|
|
|
as well when the Mastodon relay handshake is used. In these cases, Mastodon relay
|
|
|
|
clients should follow `http://your.relay.hostname/inbox` as they would with Mastodon's
|
|
|
|
own relay software.
|
2018-08-18 05:05:48 +00:00
|
|
|
|
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
## Performance
|
2018-08-18 05:05:48 +00:00
|
|
|
|
2018-10-30 03:17:25 +00:00
|
|
|
Performance is very good, with all data being stored in memory and serialized to a
|
|
|
|
JSON-LD object graph. Worker coroutines are spawned in the background to distribute
|
|
|
|
the messages in a scatter-gather pattern. Performance is comparable to, if not
|
|
|
|
superior to, the Mastodon relay software, with improved memory efficiency.
|
2018-11-18 14:43:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Management
|
|
|
|
|
|
|
|
You can perform a few management tasks such as peering or depeering other relays by
|
|
|
|
invoking the `relay.manage` module.
|
|
|
|
|
|
|
|
This will show the available management tasks:
|
|
|
|
|
|
|
|
$ python3 -m relay.manage
|
|
|
|
|
|
|
|
When following remote relays, you should use the `/actor` endpoint as you would in
|
|
|
|
Pleroma and other LitePub-compliant software.
|
2019-08-20 10:38:53 +00:00
|
|
|
|
|
|
|
## Docker
|
|
|
|
|
|
|
|
You can run ActivityRelay with docker. Edit `relay.yaml` so that the database
|
|
|
|
location is set to `./data/relay.jsonld` and then build and run the docker
|
|
|
|
image :
|
|
|
|
|
|
|
|
$ docker volume create activityrelay-data
|
|
|
|
$ docker build -t activityrelay .
|
|
|
|
$ docker run -d -p 8080:8080 -v activityrelay-data:/workdir/data activityrelay
|