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