summaryrefslogtreecommitdiff
path: root/doc/snac.8
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snac.8')
-rw-r--r--doc/snac.8326
1 files changed, 326 insertions, 0 deletions
diff --git a/doc/snac.8 b/doc/snac.8
new file mode 100644
index 0000000..94afe71
--- /dev/null
+++ b/doc/snac.8
@@ -0,0 +1,326 @@
1.Dd $Mdocdate$
2.Dt SNAC 8
3.Os
4.Sh NAME
5.Nm snac
6.Nd snac administration
7.Sh DESCRIPTION
8The
9.Nm
10daemon processes messages from other servers in the Fediverse
11using the ActivityPub protocol.
12.Pp
13This is the admin manual. For user operation, see
14.Xr snac 1 .
15For file and data formats, see
16.Xr snac 5 .
17.Ss Installation
18Install the OpenSSL and urllib3 Python3 external packages, and run as root
19.Bd -literal -offset indent
20make install
21.Ed
22.Ss Database Initialization
23Once
24.Nm
25is properly installed on the system, designate a directory where
26the server and user data are to be stored. This directory
27must not exist yet.
28.Nm
29must always be run as a regular user; you can create one for
30it or use your own. To initialize the database, execute
31.Bd -literal -offset indent
32snac init $HOME/snac-data
33.Ed
34.Pp
35A small set of questions will be asked regarding the installation,
36specially the host name it will run under, the local network address
37and port
38.Nm
39will listen to, the optional path prefix and possibly other things.
40.Pp
41You can launch the
42.Nm
43process by running
44.Bd -literal -offset indent
45snac httpd $HOME/snac-data
46.Ed
47.Pp
48Use a web browser to connect to the specified address and port. You
49should see a greeting page.
50.Pp
51Log messages are sent to the standard error stream. By default, only
52relevant information is written there. You can increase the debugging
53level by editing the 'dbglevel' field in the
54.Pa server.json
55file or by setting a numeric value between 0 and 3 to the DEBUG
56environment variable, see below.
57.Pp
58If you run
59.Nm
60in an OS controlled by
61.Xr systemd 1 ,
62you can prepare a user service to start/stop the daemon. Following the
63previous example, create the file
64.Pa ~/.config/systemd/user/snac.service
65with the following content:
66.Bd -literal -offset indent
67[Unit]
68Description=snac daemon
69
70[Service]
71Type=simple
72Restart=always
73RestartSec=5
74ExecStart=/usr/local/bin/snac httpd /path/to/snac-data
75
76[Install]
77WantedBy=default.target
78.Ed
79.Pp
80And activate it by running
81.Bd -literal -offset indent
82systemctl --user enable snac.service
83systemctl --user start snac.service
84.Ed
85.Pp
86For other operating systems, please read the appropriate documentation
87on how to install a daemon as a non-root service.
88.Ss Server Setup
89.Pp
90An http server with TLS and proxying support must already be
91installed and configured.
92.Nm
93runs as a daemon and listens on a TCP/IP socket, preferrably
94on a local interface. It can serve the full domain or only
95a directory. The http server must be configured to route to the
96.Nm
97socket all related traffic and also the webfinger standard
98address. The Host header must be propagated.
99See the examples below.
100.Ss Adding Users
101.Pp
102Users must be created from the command line.
103You can do it by running
104.Bd -literal -offset indent
105snac adduser $HOME/snac-data
106.Ed
107.Pp
108All needed data will be prompted for. There is no artificial limit
109on the number of users that can be created.
110.Ss Customization
111The
112.Pa server.json
113configuration file allows some behaviour tuning:
114.Bl -tag -width tenletters
115.It Ic host
116The host name.
117.It Ic prefix
118The URL path prefix.
119.It Ic address
120The listen network address.
121.It Ic port
122The list network port.
123.It Ic dbglevel
124The debug level. An integer value, being 0 the less verbose (the default).
125.It Ic layout
126The disk storage layout version. Never touch this.
127.It Ic queue_retry_max
128Messages sent out are stored in a queue. If the posting of a messages fails,
129it's re-enqueued for later. This integer configures the maximum count of
130times the sending will be retried.
131.It Ic queue_retry_minutes
132The number of minutes to wait before the failed posting of a message is
133retried. This is not linear, but multipled by the number of retries
134already done.
135.It Ic max_timeline_entries
136This is the maximum timeline entries shown in the web interface.
137.It Ic timeline_purge_days
138Entries in the timeline older that this number of days are purged.
139.It Ic css_urls
140This is a list of URLs to CSS files that will be inserted, in this order,
141in the HTML before the user CSS. Use these files to configure the global
142site layout.
143.El
144.Pp
145You must restart the server to make effective these changes.
146.Pp
147If a file named
148.Pa greeting.html
149is present in the server base directory, it will be returned whenever
150the base URL of the server is requested. Fill it with whatever
151information about the instance you want to supply to people
152visiting the server, like sign up requirements, site policies
153and such. The special %userlist% mark in the file will cause
154the list of users in this instance to be inserted.
155.Pp
156Users can change a bit of information about themselves from the
157web interface. See
158.Xr snac 1
159for details. Further, every user has a private CSS file in their
160.Pa static/style.css
161that can be modified to suit their needs. This file contains
162a copy of the
163.Pa style.css
164file in the server root and it's inserted into the HTML output.
165It's not easily accesible from the web interface to avoid users
166shooting themselves in the foot by destroying everything.
167.Ss Old Data Purging
168The Fediverse generates big loads of data that get old and
169stale very quickly. By default,
170.Nm
171does not delete anything; you must do it explicitly by issuing a
172.Ar purge
173command periodically. A cron entry will suffice. You can add the
174following to the
175.Nm
176user's crontab:
177.Bd -literal -offset indent
178# execute a data purge on Sundays at 4 am
1790 4 * * 0 /usr/local/bin/snac purge /path/to/snac-data
180.Ed
181.Pp
182Other directories, like
183.Pa archive/ ,
184can grow very quickly if the debug level is greater than 0. These
185files must be deleted manually.
186.Pp
187The user-generated data (the local timeline) is never deleted.
188.Ss ActivityPub Support
189These are the following activities and objects that
190.Nm
191supports:
192.Bl -tag -width tenletters
193.It Vt Follow
194Complete support, on input and output.
195.It Vt Undo
196For
197.Vt Follow ,
198.Vt Like
199and
200.Vt Announce
201objects, on input and output.
202.It Vt Create
203For
204.Vt Note
205objects, on input and output.
206.It Vt Accept
207For
208.Vt Follow
209objects, on input and output.
210.It Vt Like
211For
212.Vt Note
213objects, on input and output.
214.It Vt Announce
215For
216.Vt Note
217objects, on input and output.
218.It Vt Update
219For
220.Vt Person
221objects, on input and output. Support for updating
222.Vt Note
223objects will probably be added in the future.
224.It Vt Delete
225Supported for
226.Vt Note
227and
228.Vt Tomsbtone
229objects on input, and for
230.Vt Note
231objects on output.
232.El
233.Pp
234The rest of activities and objects are dropped on input.
235.Pp
236There is partial support for
237.Vt OrderedCollection
238objects in the
239.Pa /outbox
240(with the last 20 entries of the local timeline shown). No pagination
241is supported. Intentionally, the
242.Pa /followers
243and
244.Pa /following
245paths return empty lists.
246.Ss Other Considerations
247.Nm
248stores all the messages it receives as JSON files, which are usually
249bloated and filled with redundant information. Using a filesystem with
250file compression enabled (like btrfs or zfs) will probably be a good
251choice to store the
252.Nm
253database into.
254.Sh ENVIRONMENT
255.Bl -tag -width Ds
256.It Ev DEBUG
257Overrides the debugging level from the server 'dbglevel' configuration
258variable. Set it to an integer value. The higher, the deeper in meaningless
259verbiage you'll find yourself into.
260.El
261.Sh EXAMPLES
262You want to install the
263.Nm
264Fediverse daemon in the host example.com, that is correctly configured
265with a valid TLS certificate and running the nginx httpd server.
266The service will be installed under the
267.Pa fedi
268location. Two users, walter and jessie, will be hosted in the system.
269Their Fediverse presence addresses will be https://example.com/fedi/walter
270and https://example.com/fedi/jesse, respectively. They will be known
271in the Fediverse as @walter@example.com and @jesse@example.com. The
272.Nm
273daemon will run as the user snacusr in the system and listen to the
274localhost:8001 network socket. All data will be stored in the
275.Pa /home/snacusr/fedidata
276directory.
277.Pp
278Log into the system as snacusr and execute:
279.Bd -literal -offset indent
280snac init /home/snacusr/fedidata
281.Ed
282.Pp
283Answer "example.com" to the host name question, "/fedi" to the path
284prefix question, "localhost" to the address and "8001" to the port.
285.Pp
286Create the users
287.Bd -literal -offset indent
288snac adduser /home/snacusr/fedidata walter
289snac adduser /home/snacusr/fedidata jesse
290.Ed
291.Pp
292Answer the questions with reasonable values.
293.Pp
294Execute the server:
295.Bd -literal -offset indent
296snac httpd /home/snacusr/fedidata
297.Ed
298.Pp
299Edit the nginx configuration and add the following snippet to the
300example.com server section:
301.Bd -literal -offset indent
302location /.well-known/webfinger {
303 proxy_pass http://localhost:8001;
304 proxy_set_header Host $http_host;
305}
306
307location /fedi {
308 proxy_pass http://localhost:8001;
309 proxy_set_header Host $http_host;
310}
311.Ed
312.Pp
313Restart the nginx daemon and connect to https://example.com/fedi/walter.
314The empty, default screen will be shown. Enter the admin section with the
315credentials defined for this user. Search people, start following
316them, engage in arid discussions and generally enjoy the frustrating
317experience of Social Media.
318.Sh SEE ALSO
319.Xr snac 1 ,
320.Xr snac 5
321.Sh AUTHORS
322.An grunfink
323.Sh LICENSE
324See the LICENSE file for details.
325.Sh CAVEATS
326JSON files are fragile when modified by hand. Take care.