2021-12-21 16:41:19 +00:00
|
|
|
Workers
|
|
|
|
=======
|
|
|
|
|
|
|
|
Hookshot supports running in a worker configuration, using Redis as the middleman process to handle traffic between processes.
|
|
|
|
|
|
|
|
<section class="warning">
|
|
|
|
This feature is <b>experimental</b> and should only be used when you are reaching natural limits in the monolith process.
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Running in multi-process mode
|
|
|
|
|
2023-12-20 11:36:52 +01:00
|
|
|
You must first have a working Redis instance somewhere which can talk between processes. For example, in Docker you can run:
|
2021-12-21 16:41:19 +00:00
|
|
|
|
2024-03-19 16:45:52 +00:00
|
|
|
`docker run --name redis-host -p 6379:6379 -d redis`.
|
2021-12-21 16:41:19 +00:00
|
|
|
|
2023-12-20 11:36:52 +01:00
|
|
|
The processes should all share the same config, which should contain the correct config to enable Redis:
|
2021-12-21 16:41:19 +00:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
queue:
|
2024-03-19 16:45:52 +00:00
|
|
|
redisUri: "redis://redis-host:6379"
|
|
|
|
cache:
|
|
|
|
redisUri: "redis://redis-host:6379"
|
2021-12-21 16:41:19 +00:00
|
|
|
```
|
|
|
|
|
2024-03-19 16:45:52 +00:00
|
|
|
Note that if [encryption](./encryption.md) is enabled, you MUST enable the `cache` config but NOT the `queue` config. Workers require persistent
|
|
|
|
storage in Redis, but cannot make use of worker-mode queues.
|
2022-12-09 15:25:36 +00:00
|
|
|
|
2021-12-21 16:41:19 +00:00
|
|
|
Once that is done, you can simply start the processes by name using yarn:
|
|
|
|
```
|
|
|
|
yarn start:webhooks
|
2022-07-11 09:37:06 -04:00
|
|
|
yarn start:matrixsender
|
2021-12-21 16:41:19 +00:00
|
|
|
yarn start:app
|
|
|
|
```
|
|
|
|
|
|
|
|
Be aware that you will need to start all worker types when running in worker mode, as the service does not allow a hybrid worker approach.
|