Commit Graph

42 Commits

Author SHA1 Message Date
Simon Ser
ec3f0bfd96 contrib/tlstunnel: new document 2023-12-01 11:10:38 +01:00
Simon Ser
a52cd5aa43 contrib/certbot: new document 2023-12-01 10:35:01 +01:00
Simon Ser
1e5fac0e0a contrib/znc-import: leave password empty by default
No need for the "!!" hack, an empty password field means that
auth is disabled already.
2023-11-01 00:05:17 +01:00
Simon Ser
4f7b577734 database: add NewUser 2023-11-01 00:04:57 +01:00
Simon Ser
e19dd8f0da database: add NewNetwork 2023-10-31 23:51:04 +01:00
Calvin Lee
48f81f0b2d contrib/migrate-db: use explicit src/dest network
This commit makes the source and destination network distinction
explicit. This is necessary, as the source and destination network may
not have the same ID in the database, and thus associations will be broken
when migrated.
2023-10-25 16:06:48 +02:00
Calvin Lee
d137c69131 database: batch msg inserts
This commit takes insert query compilation and transaction creation out
of the critical loop for migrating message logs. I have tested with
the sqlite backend, and a speedup of approximately 40x has been achieved
for log migration.
2023-10-25 16:03:00 +02:00
Simon Ser
33a83b3b41 contrib/clients: drop mention of single-upstream mode
We no longer have multi-upstream mode, so no need to specify
explicitly the mode anymore.
2023-08-23 09:54:27 +02:00
Simon Ser
662e3f3afe contrib/systemd: add AmbientCapabilities=CAP_NET_BIND_SERVICE
soju needs to bind to port 113 for identd.
2023-04-13 12:40:12 +02:00
Дамјан Георгиевски
e510cef208 add an example systemd service file
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=
2023-03-20 18:12:31 +01:00
Simon Ser
b6c0841291 msgstore: move ZNC log functions to separate package 2023-02-17 14:35:25 +01:00
delthas
1ccc7ce6d2 Add a database store for messages
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>
2023-02-17 14:13:43 +01:00
Simon Ser
d7d9d45b45 Add a flag to disable users
Add a new flag to disable users. This can be useful to temporarily
deactivate an account without erasing data.

The user goroutine is kept alive for simplicity's sake. Most of the
infrastructure assumes that each user always has a running goroutine.
A disabled user's goroutine is responsible for sending back an error
to downstream connections, and listening for potential events to
re-enable the account.
2023-01-26 18:33:55 +01:00
Enterprisey
d74b66f240 contrib/clients: Warn about Hexchat password limit
Hexchat truncates passwords, so add a warning about that and a
workaround for Sourcehut users.
2023-01-25 00:06:40 +01:00
Simon Ser
a0e9c10bc4 contrib/clients: reference read_marker.py for Weechat 2022-11-11 11:52:24 +01:00
Simon Ser
d27880e03e config: use structs to group DB/MsgAuth 2022-09-11 13:50:34 +02:00
Simon Ser
5ef7e07061 contrib/znc-import: move to subdir
Go isn't happy when multiple scripts share the same directory.
2022-07-04 15:52:09 +02:00
gildarts
7ba3cba1e6 contrib/migrate-db: new script
This utility will migrate data between any two soju databases.
Sqlite to postgres or postgres to sqlite.
2022-07-04 15:50:35 +02:00
jesopo
804d685ab2 contrib/clients: correct comment about catgirl 2022-06-13 15:42:53 +02:00
Simon Ser
3a7dee8128 Introduce a database package 2022-05-09 15:08:04 +02:00
Frank Steinborn
2a0cc57e3a contrib/clients: Add information about irssi
Adds information about how to connect irssi to a soju instance,
single-upsteam mode is assumed.
2022-04-16 08:06:20 +02:00
Simon Ser
8efc125f51 contrib/clients: senpai now supports soju.im/bouncer-networks 2022-03-24 19:19:15 +01:00
Simon Ser
ae68c82fc0 contrib/clients: add goguma 2022-03-05 23:35:17 +01:00
Simon Ser
813c3d3de6 contrib/clients: warn about catgirl 2022-03-05 23:35:17 +01:00
Theodor Thornhill
950198a2b7 contrib/clients: Add information about emacs irc clients 2022-01-13 16:06:54 +01:00
Simon Ser
cec335ee9c contrib/clients: WeeChat 3.3 enables all IRCv3 caps by default 2021-11-18 21:05:58 +01:00
Simon Ser
7160713ea9 contrib/znc-import: use background context 2021-11-17 11:56:16 +01:00
Simon Ser
9ec1f1a5b0 Add context args to Database interface
This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.
2021-10-18 19:15:15 +02:00
Simon Ser
d646ffc9d6 contrib/clients: update IRCv3 caps for Weechat 3.3 2021-10-12 21:49:06 +02:00
Hubert Hirtz
6e06663615 PostgreSQL support 2021-10-11 15:21:04 +02:00
Simon Ser
51df11a55f contrib/clients: sort alphabetically and wrap lines 2021-07-07 10:37:18 +02:00
delthas
9814901f56 contrib/clients: Mention Hexchat 2021-07-07 10:36:02 +02:00
Simon Ser
387338e499 contrib/clients: add reference to Weechat script 2021-06-12 14:48:32 +02:00
Simon Ser
7d648f702e Allow networks to be disabled 2021-05-26 10:51:02 +02:00
Simon Ser
2d4b686af6 contrib/clients: add note about bouncer-networks 2021-05-25 18:54:16 +02:00
Drew DeVault
61b68d6dfb db: refactor into interface
This refactors the SQLite-specific bits into db_sqlite.go. A future
patch will add PostgreSQL support.
2021-05-25 16:35:39 +02:00
Simon Ser
7e6ce23dac contrib/clients: add gamja and senpai 2021-05-19 16:42:03 +02:00
Alexey Yerin
463e234ebc contrib/weechat: fix typo 2021-05-04 00:06:02 +02:00
Simon Ser
ecf5b40d65 contrib/weechat: explain how to enable IRCv3 features 2021-05-01 18:52:28 +02:00
Simon Ser
2b92e4ecd4 contrib/casemap-logs.sh: new utility script
Previous soju versions were storing log without converting the channel
and nick names to their canonical lower-case representation. This could
result in two log directories for the same channel/nick.

This script fixes old log dirs.
2021-03-26 15:31:54 +01:00
Simon Ser
fa16337d97
Switch DB API to user IDs
This commit changes the Network schema to use user IDs instead of
usernames. While at it, a new UNIQUE(user, name) constraint ensures
there is no conflict with custom network names.

Closes: https://todo.sr.ht/~emersion/soju/86
References: https://todo.sr.ht/~emersion/soju/29
2020-10-24 15:14:23 +02:00
Simon Ser
1ac895430a
contrib/znc-import: new utility
Allows populating the soju database from a ZNC config file.
2020-07-09 11:25:25 +02:00