Skip to content

Commit 082a61f

Browse files
Split cache config from queue config. (#902)
* Split out queue and cache config * Update usages of cache config, * Update default * Cleanup * Make queue optional. * config updates. * changelog * update spec config * Update tests * tweak import * Update default config. * fixup test * Update config.sample.yml Co-authored-by: Andrew Ferrazzutti <[email protected]> Signed-off-by: Will Hunt <[email protected]> * Update encryption.md Signed-off-by: Will Hunt <[email protected]> * Clear up worker config Signed-off-by: Will Hunt <[email protected]> * Update src/config/Config.ts Co-authored-by: Andrew Ferrazzutti <[email protected]> Signed-off-by: Will Hunt <[email protected]> * update helm config * lint * fix meta * tidy tidy * revert logging change * lint rust --------- Signed-off-by: Will Hunt <[email protected]> Co-authored-by: Andrew Ferrazzutti <[email protected]>
1 parent b70ccb5 commit 082a61f

File tree

22 files changed

+367
-241
lines changed

22 files changed

+367
-241
lines changed

changelog.d/902.removal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The cache/queue configuration has been changed in this release. The `queue.monolithic` option has been deprecated, in place of a dedicated `cache`
2+
config section. Check the ["Cache configuration" section](https://matrix-org.github.io/matrix-hookshot/latest/setup.html#cache-configuration) for
3+
more information on how to configure Hookshot caches.

config.sample.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,15 @@ listeners:
134134
# # (Optional) Prometheus metrics support
135135
# enabled: true
136136

137+
#cache:
138+
# # (Optional) Cache options for large scale deployments.
139+
# # For encryption to work, this must be configured.
140+
# redisUri: redis://localhost:6379
141+
137142
#queue:
138-
# # (Optional) Message queue / cache configuration options for large scale deployments.
139-
# # For encryption to work, must be set to monolithic mode and have a host & port specified.
140-
# monolithic: true
141-
# port: 6379
142-
# host: localhost
143+
# # (Optional) Message queue configuration options for large scale deployments.
144+
# # For encryption to work, this must not be configured.
145+
# redisUri: redis://localhost:6379
143146

144147
#widgets:
145148
# # (Optional) EXPERIMENTAL support for complimentary widgets

docs/advanced/encryption.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Hookshot supports end-to-bridge encryption via [MSC3202](https://github.com/matr
1313
In order for Hookshot to use encryption, it must be configured as follows:
1414
- The `experimentalEncryption.storagePath` setting must point to a directory that Hookshot has permissions to write files into. If running with Docker, this path should be within a volume (for persistency). Hookshot uses this directory for its crypto store (i.e. long-lived state relating to its encryption keys).
1515
- Once a crypto store has been initialized, its files must not be modified, and Hookshot cannot be configured to use another crypto store of the same type as one it has used before. If a crypto store's files get lost or corrupted, Hookshot may fail to start up, or may be unable to decrypt command messages. To fix such issues, stop Hookshot, then reset its crypto store by running `yarn start:resetcrypto`.
16-
- [Redis](./workers.md) must be enabled. Note that worker mode is not yet supported with encryption, so `queue.monolithic` must be set to `true`.
16+
- [Redis](./workers.md) must be enabled. Note that worker mode is not yet supported with encryption, so `queue` MUST **NOT be configured**.
1717

1818
If you ever reset your homeserver's state, ensure you also reset Hookshot's encryption state. This includes clearing the `experimentalEncryption.storagePath` directory and all worker state stored in your redis instance. Otherwise, Hookshot may fail on start up with registration errors.
1919

docs/advanced/workers.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ This feature is <b>experimental</b> and should only be used when you are reachin
1111

1212
You must first have a working Redis instance somewhere which can talk between processes. For example, in Docker you can run:
1313

14-
`docker run --name github-bridge-redis -p 6379:6379 -d redis`.
14+
`docker run --name redis-host -p 6379:6379 -d redis`.
1515

1616
The processes should all share the same config, which should contain the correct config to enable Redis:
1717

1818
```yaml
1919
queue:
20-
monolithic: false
21-
port: 6379
22-
host: github-bridge-redis
20+
redisUri: "redis://redis-host:6379"
21+
cache:
22+
redisUri: "redis://redis-host:6379"
2323
```
2424
25-
Note that if [encryption](./encryption.md) is enabled, `queue.monolithic` must be set to `true`, as worker mode is not yet supported with encryption.
25+
Note that if [encryption](./encryption.md) is enabled, you MUST enable the `cache` config but NOT the `queue` config. Workers require persistent
26+
storage in Redis, but cannot make use of worker-mode queues.
2627

2728
Once that is done, you can simply start the processes by name using yarn:
2829
```

docs/setup.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,20 @@ Please note that the appservice HTTP listener is configured <strong>separately</
227227
in the upstream library. See <a href="https://github.com/turt2live/matrix-bot-sdk/issues/191">this issue</a> for details.
228228
</section>
229229

230+
### Cache configuration
231+
232+
You can optionally enable a Redis-backed cache for Hookshot. This is generally a good thing to enable if you can
233+
afford to, as it will generally improve startup times. Some features such as resuming RSS/Atom feeds between restarts
234+
is also only possible with a external cache.
235+
236+
To enable, simply set:
237+
238+
```yaml
239+
cache:
240+
redisUri: "redis://redis-host:3679"
241+
```
242+
243+
230244
### Services configuration
231245

232246
You will need to configure some services. Each service has its own documentation file inside the setup subdirectory.

0 commit comments

Comments
 (0)