Skip to content

Commit ba55f3f

Browse files
authored
[2.x] feat: database queue (#495)
* feat: database queue * chore: add screenshot of db queue settings * chore: typo * chore: env vars
1 parent e343f01 commit ba55f3f

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

docs/admin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ The Admin Dashboard has the following sections, being:
1111
- **Permissions** - Shows the permissions for each user group, and allows you to configure global and specific scopes.
1212
- **Appearance** - Allows you to customize the forum's colors, branding and add additional CSS for customization.
1313
- **Users** - Provides you with a paginated list of all the users in the forum, and grants you the ability to edit the user or take administrative actions.
14-
- **Advanced** - Allows you to configure advanced settings such as Maintenance Mode, Search drivers, and more.
14+
- **Advanced** - Allows you to configure advanced settings such as Maintenance Mode, Search drivers, Queue driver, and more.
1515

1616
Apart from the above-mentioned sections, the Admin Dashboard also allows you to manage your Extensions (including the flarum core extensions such as Tags) under the _Features_ section. Extensions which modify the forum theme, or allow you to use multiple languages are categorized under the _Themes_ and _Languages_ section respectively.

docs/config.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,40 @@ Here's a quick overview of what everything means with an example file:
3232
'api' => 'api', // /api goes to the API
3333
'admin' => 'admin', // /admin goes to the admin
3434
),
35+
'queue' =>
36+
array (
37+
'driver' => 'sync', // Use the standard sync queue. Omitting this will entirely will have the same effect
38+
)
39+
);
40+
```
41+
42+
### Configuration via environment variables
43+
44+
Whilst the file based method described here is suitable for most Flarum installations, scaled Flarum instances or those deployed via CI/CD will probably benefit from being configured via the environment. Here's an example of how to do this:
45+
46+
```php
47+
<?php return array (
48+
'debug' => env('DEBUG')
49+
...
3550
);
3651
```
3752

53+
This provides Flarum with the static configuration file it expects, but pulls variables from the environment at runtime.
54+
55+
### Queues
56+
57+
Flarum ships with support for two queue types - `sync` and `database`. Many tasks, or 'jobs' can be offloaded to a seperate process in order to improve response times and provide a better user experience.
58+
* `sync` - default behaviour
59+
* `database` - stores jobs in a dedicated database table, which are then processed via the [scheduler](/2.x/scheduler) in a seperate process. It is strongly advised that the scheduler is configured to run _every minute_
60+
61+
When the `database` queue is active, additional configuration options are available under `advanced settings`.
62+
63+
![Database Queue Settings](https://private-user-images.githubusercontent.com/16573496/511708325-c4e8c663-b98e-45a9-a32f-d3be9a8f1aa6.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM5NzA5NTMsIm5iZiI6MTc2Mzk3MDY1MywicGF0aCI6Ii8xNjU3MzQ5Ni81MTE3MDgzMjUtYzRlOGM2NjMtYjk4ZS00NWE5LWEzMmYtZDNiZTlhOGYxYWE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTExMjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUxMTI0VDA3NTA1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRhNDM0ZTNlMDc4NjU5ZjBkYzVlZGZjNTNmYzExMTU4ZmVhMDhkOTA5OGM2NTRjYTYxZjNlYWI0NWNkNWI5ZGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Q8_b4O04wzKtqkaVyjukeucaR05r9oRPdNNvjODd2ME)
64+
65+
##### Other queue processors
66+
67+
At this point in time, use of other schedulers is supported, but configuration via `config.php` is not required. Example [FoF Horizon](https://FriendsOfFlarum/horizon) or [Redis Queues](https://FriendsOfFlarum/redis).
68+
3869
### Maintenance modes
3970

4071
Flarum has a maintenance mode that can be enabled by setting the `offline` key in the `config.php` file to one of the following values:

0 commit comments

Comments
 (0)