Skip to content

Commit 9e61528

Browse files
authored
update documentation for persistent history (#2368)
1 parent 2a114dc commit 9e61528

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test:
4141
python3 ./gencapdefs.py | diff - ${capdef_file}
4242
go test -tags "$(full_tags)" ./...
4343
go vet -tags "$(full_tags)" ./...
44-
go test ./...
44+
go test -tags "" ./...
4545
go vet -tags "" ./...
4646
./.check-gofmt.sh
4747

default.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,6 @@ datastore:
876876
#conn-max-lifetime: 180s
877877

878878
# connection information for PostgreSQL (currently only used for persistent history)
879-
# PostgreSQL support is compiled out by default: you may need to recompile with
880-
# `make build_full`
881879
postgresql:
882880
enabled: false
883881
host: "localhost"
@@ -905,8 +903,6 @@ datastore:
905903
#connect-timeout: 10s
906904

907905
# connection information for SQLite (currently only used for persistent history)
908-
# SQLite support is compiled out by default: you may need to recompile with
909-
# `make build_full`
910906
sqlite:
911907
enabled: false
912908
# path to the SQLite database file

docs/MANUAL.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ _Copyright © Daniel Oaks <daniel@danieloaks.net>, Shivaram Lingamneni <slingamn
4141
- [Language](#language)
4242
- [Multiclient ("Bouncer")](#multiclient-bouncer)
4343
- [History](#history)
44-
- [Persistent history with MySQL](#persistent-history-with-mysql)
44+
- [Persistent history](#persistent-history)
4545
- [IP cloaking](#ip-cloaking)
4646
- [Moderation](#moderation)
4747
- [Push notifications](#push-notifications)
@@ -429,9 +429,32 @@ Unfortunately, client support for history playback is still patchy. In descendin
429429
1. You can autoreplay a fixed number of lines (e.g., 25) each time you join a channel using `/msg NickServ set autoreplay-lines 25`.
430430

431431

432-
## Persistent history with MySQL
432+
## Persistent history
433433

434-
On most Linux and POSIX systems, it's straightforward to set up MySQL (or MariaDB) as a backend for persistent history. This increases the amount of history that can be stored, and ensures that message data will be retained on server restart (you can still use the configuration options to set a time limit for retention). Here's a quick start guide for Ubuntu based on [Digital Ocean's documentation](https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04):
434+
Persistent history means storing chat history (messages, but also events like JOINs and PARTs) on disk. This increases the amount of history that can be stored, and also ensures that message data will be retained on server restart (you can still use the configuration options to set a time limit for retention). Ergo supports three backends for persistent history: MySQL, PostgreSQL, and SQLite. If you have a default build of Ergo (for example, a release build from our GitHub page, or our official Docker image), all three backends are available.
435+
436+
To configure persistent history, you must set `history.persistent.enabled` to `true` in the Ergo config file. You may want to adjust other options in the `history` section at this time. Then you must additionally enable and configure one of the backends. Here are per-backend instructions:
437+
438+
### SQLite
439+
440+
SQLite is the easiest backend to enable; it's an embedded database that runs inside the Ergo process, without needing to talk to an external database server. Find `datastore.sqlite` in your config (or add it, following an up-to-date `default.yaml` as a guide):
441+
442+
```yaml
443+
sqlite:
444+
enabled: true
445+
# path to the SQLite database file
446+
database-path: "ergo_history.db"
447+
# timeout when waiting for write lock
448+
busy-timeout: 5s
449+
# maximum concurrent connections
450+
max-conns: 1
451+
```
452+
453+
This creates an on-disk file `ergo_history.db` for the history storage, by default in the same working directory as the Ergo process. We believe SQLite should scale to the needs of most Ergo deployments (in our initial benchmarks, there is a write bottleneck of approximately 1K messages/events per second).
454+
455+
### MySQL
456+
457+
Here's a quick start guide for MySQL on Ubuntu based on [Digital Ocean's documentation](https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04). (Ergo is also compatible with MariaDB; a compatible implementation is available on most Linux and POSIX platforms.)
435458

436459
1. Install the `mysql-server` package
437460
1. Run `mysql_secure_installation` as root; this corrects some insecure package defaults
@@ -452,6 +475,10 @@ On most Linux and POSIX systems, it's straightforward to set up MySQL (or MariaD
452475
timeout: 3s
453476
```
454477

478+
### PostgreSQL
479+
480+
If you don't already have a PostgreSQL database, follow [Digital Ocean's quick start guide](https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-22-04-quickstart) to set one up, then edit `datastore.postgresql` in the Ergo config file with `enabled: true` and your database parameters.
481+
455482

456483
## IP cloaking
457484

traditional.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,6 @@ datastore:
847847
#conn-max-lifetime: 180s
848848

849849
# connection information for PostgreSQL (currently only used for persistent history)
850-
# PostgreSQL support is compiled out by default: you may need to recompile with
851-
# `make build_full`
852850
postgresql:
853851
enabled: false
854852
host: "localhost"
@@ -876,8 +874,6 @@ datastore:
876874
#connect-timeout: 10s
877875

878876
# connection information for SQLite (currently only used for persistent history)
879-
# SQLite support is compiled out by default: you may need to recompile with
880-
# `make build_full`
881877
sqlite:
882878
enabled: false
883879
# path to the SQLite database file

0 commit comments

Comments
 (0)