Skip to content

Commit 38d1c66

Browse files
authored
Merge pull request #565 from sij411/docs/add-relay-command
Add missing `fedify relay` command documentation
2 parents 6fe8670 + dc30f03 commit 38d1c66

1 file changed

Lines changed: 134 additions & 0 deletions

File tree

docs/cli.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,140 @@ fedify nodeinfo --user-agent MyApp/1.0 mastodon.social
11141114
~~~~
11151115

11161116

1117+
`fedify relay`: Running an ephemeral ActivityPub relay server
1118+
-------------------------------------------------------------
1119+
1120+
*This command is available since Fedify 2.0.0.*
1121+
1122+
The `fedify relay` command is used to spin up an ephemeral ActivityPub relay
1123+
server that forwards activities between federated instances. The server can use
1124+
either [Mastodon] or [LitePub] compatible relay protocol.
1125+
1126+
To start a relay server, you must specify the relay protocol using the
1127+
`-p`/`--protocol` option:
1128+
1129+
~~~~ sh
1130+
fedify relay -p mastodon
1131+
~~~~
1132+
1133+
If it goes well, you will see the output like the below (without termination;
1134+
press <kbd>^C</kbd> to stop the server):
1135+
1136+
~~~~
1137+
✔ Relay server is running: https://f9285cf4974c86.lhr.life/
1138+
╭───────────────┬──────────────────────────────────────────╮
1139+
│ Actor URI: │ https://f9285cf4974c86.lhr.life/actor │
1140+
├───────────────┼──────────────────────────────────────────┤
1141+
│ Shared Inbox: │ https://f9285cf4974c86.lhr.life/inbox │
1142+
├───────────────┼──────────────────────────────────────────┤
1143+
│ Protocol: │ mastodon │
1144+
├───────────────┼──────────────────────────────────────────┤
1145+
│ Name: │ Fedify Relay │
1146+
├───────────────┼──────────────────────────────────────────┤
1147+
│ Storage: │ in-memory │
1148+
╰───────────────┴──────────────────────────────────────────╯
1149+
1150+
Press ^C to stop the relay server.
1151+
~~~~
1152+
1153+
By default, the relay server is tunneled to the public internet so that
1154+
external instances can connect to it.
1155+
1156+
[Mastodon]: https://joinmastodon.org/
1157+
[LitePub]: https://litepub.social/
1158+
1159+
### `-p`/`--protocol`: Relay protocol
1160+
1161+
The `-p`/`--protocol` option specifies which relay protocol to use.
1162+
This option is required. The available options are:
1163+
1164+
- `mastodon`: [Mastodon]-compatible relay protocol
1165+
- `litepub`: [LitePub]-compatible relay protocol
1166+
1167+
### `--persistent`: Persistent storage
1168+
1169+
The `--persistent` option specifies a path to a SQLite database file for
1170+
persistent storage. If not specified, the relay uses in-memory storage which
1171+
is lost when the server stops.
1172+
1173+
~~~~ sh
1174+
fedify relay -p mastodon --persistent relay.db
1175+
~~~~
1176+
1177+
### `-P`/`--port`: Local port
1178+
1179+
The `-P`/`--port` option specifies the local port to listen on. By default,
1180+
it listens on port 8000.
1181+
1182+
~~~~ sh
1183+
fedify relay -p mastodon -P 3000
1184+
~~~~
1185+
1186+
### `-n`/`--name`: Relay display name
1187+
1188+
The `-n`/`--name` option specifies the relay display name. By default, it is
1189+
`Fedify Relay`.
1190+
1191+
~~~~ sh
1192+
fedify relay -p mastodon -n "My Relay"
1193+
~~~~
1194+
1195+
### `-a`/`--accept-follow`: Accept follow requests
1196+
1197+
The `-a`/`--accept-follow` option specifies which actors' follow requests to
1198+
accept. The argument can be either an actor URI, a handle, or a wildcard (`*`).
1199+
This option can be specified multiple times. If a wildcard is specified, all
1200+
follow requests will be accepted.
1201+
1202+
~~~~ sh
1203+
fedify relay -p mastodon -a @john@doe.com -a @jane@doe.com
1204+
~~~~
1205+
1206+
### `-r`/`--reject-follow`: Reject follow requests
1207+
1208+
The `-r`/`--reject-follow` option specifies which actors' follow requests to
1209+
reject. The argument can be either an actor URI, a handle, or a wildcard (`*`).
1210+
This option can be specified multiple times. If a wildcard is specified, all
1211+
follow requests will be rejected.
1212+
1213+
~~~~ sh
1214+
fedify relay -p mastodon -r @spammer@example.com
1215+
~~~~
1216+
1217+
> [!NOTE]
1218+
> When both `-a`/`--accept-follow` and `-r`/`--reject-follow` are specified,
1219+
> a follow request is accepted only if the actor matches the accept list and
1220+
> does *not* match the reject list.
1221+
1222+
### `-T`/`--no-tunnel`: Local server without tunneling
1223+
1224+
The `-T`/`--no-tunnel` option disables the tunneling feature of the relay
1225+
server. By default, the relay server tunnels the local server to the public
1226+
internet for external access.
1227+
1228+
~~~~ sh
1229+
fedify relay -p mastodon --no-tunnel
1230+
~~~~
1231+
1232+
> [!NOTE]
1233+
> If you disable the tunneling feature, the relay server will be served via
1234+
> HTTP instead of HTTPS.
1235+
1236+
### `--tunnel-service`: Tunneling service
1237+
1238+
The `--tunnel-service` option specifies which tunneling service to use for
1239+
exposing the relay server to the public internet. Available services can be
1240+
found in the output of the `fedify relay --help` command. For example, to use
1241+
serveo.net as the tunneling service:
1242+
1243+
~~~~ sh
1244+
fedify relay -p mastodon --tunnel-service serveo.net
1245+
~~~~
1246+
1247+
> [!NOTE]
1248+
> This option cannot be used together with `-T`/`--no-tunnel`.
1249+
1250+
11171251
`fedify tunnel`: Exposing a local HTTP server to the public internet
11181252
--------------------------------------------------------------------
11191253

0 commit comments

Comments
 (0)