The service file will run `/usr/bin/soju --config /etc/soju/config`.
By default it'll run as a dynamically created `soju` user and group (DynamicUser=yes),
and it will run in a constrained environment[1], only having write access to
/var/lib/soju and /run/soju
If the admin creates a static `soju` user and group, those static uid/gid will be used,
with the same service constraints. This can be useful to share the static `soju` group
with other services, so they can access the soju logs and database even
if the service is not running (or before it's running).
The procedure for the initial user and database scaffold still
works normally, when run as `root`:
```
mkdir /var/lib/soju/
sojudb -config /etc/soju/config create-user myname -admin
```
NOTE: systemd will automatically change the ownership of files in /var/lib/soju/ when the service
is started.
`sojuctl` will work for root, or with `sudo -u soju`, just normally.
References:
- [1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html#DynamicUser=
We were unconditionally using the ASCII case-mapping in updateNick(),
for instance.
Introduce downstreamConn.casemap to fix this, and use it everywhere.
Some servers like snircd reject OTHER [1], because OTHER can be
used when the ident string is not stable (e.g. is an audit token
that changes each time the ident is queried).
[1]: 17c92003d3/ircd/s_auth.c (L559)
Two reasons:
- Because of [1], when mattn/go-sqlite3 is used without libsqlite3,
we need Go 1.19.
- atomic.Int64 has been introduced in Go 1.19.
[1]: https://github.com/golang/go/issues/58438
No need to re-check that a Web Push subscription is valid every
time a downstream connects. Mobile devices may reconnect pretty
frequently.
Check at most once a day.
PostgreSQL tests use pg_temp only. pg_temp is never searched for FTS
objects, so creating then altering an FTS configuration will not work
because PostgreSQL will not be able to find the FTS configuration it
just created.
Instead, we explicitly refer to the FTS objects with their full name
including their prefix, which makes PostgreSQL able to find the object.
This is only needed for tests.
See: https://stackoverflow.com/a/31095452/2347617
See: https://www.postgresql.org/message-id/15191.1208975632@sss.pgh.pa.us
This adds a new config option, `logs db`, which enables storing chat
logs in the soju database.
Regular store options, CHATHISTORY options, and SEARCH operations are
supported, like the fs logs backend.
Messages are stored in a new table, Message. In order to track the list
of targets we have messages for in an optimized manner, another database
is used: MessageTarget.
All new requests are backend by indexes so should be fast even with
hundreds of thousands of messages.
A contrib script is provided for migrating existing logs fs chat logs to
the database. It can be run with eg:
go run ./contrib/migrate-logs/ logs/ sqlite3:soju.db
Co-authored-by: Simon Ser <contact@emersion.fr>
We need to use sql.NullTime, otherwise we get errors like these:
sql: Scan error on column index 7, name "downstream_interacted_at": unsupported Scan, storing driver.Value type <nil> into type *time.Time