|
1 |
| -# tyler36/ddev-laravel-queue <!-- omit in toc --> |
| 1 | +[](https://addons.ddev.com) |
| 2 | +[](https://github.com/tyler36/ddev-laravel-queue/actions/workflows/tests.yml) |
| 3 | +[](https://github.com/tyler36/ddev-laravel-queue/commits) |
| 4 | +[](https://github.com/tyler36/ddev-laravel-queue/releases/latest) |
2 | 5 |
|
3 |
| -[](https://github.com/tyler36/ddev-laravel-queue/actions/workflows/tests.yml)  |
| 6 | +# DDEV Laravel Queue |
4 | 7 |
|
5 |
| -- [Introduction](#introduction) |
6 |
| -- [Getting Started](#getting-started) |
7 |
| -- [What does this add-on do and add?](#what-does-this-add-on-do-and-add) |
| 8 | +## Overview |
8 | 9 |
|
9 |
| -## Introduction |
| 10 | +This add-on runs a Laravel queue worker inside the DDEV web container. |
| 11 | +This add-on is recommended for `QUEUE_CONNECTION=database` environments. |
10 | 12 |
|
11 |
| -This add-on allows you to start a Laravel queue worker through the DDEV web service. See [offical Queues documentation](https://laravel.com/docs/9.x/queues) for more details. |
| 13 | +See [official Queues documentation](https://laravel.com/docs/master/queues) for more details. |
12 | 14 |
|
13 |
| -## Getting Started |
14 |
| - |
15 |
| -This add-on requires DDEV v1.19.3 or higher. |
16 |
| - |
17 |
| -- Install the DDEV laravel worker add-on: |
18 |
| - |
19 |
| -For DDEV v1.23.5 or above run |
| 15 | +## Installation |
20 | 16 |
|
21 | 17 | ```shell
|
22 | 18 | ddev add-on get tyler36/ddev-laravel-queue
|
| 19 | +ddev restart |
23 | 20 | ```
|
24 | 21 |
|
25 |
| -For earlier versions of DDEV run |
| 22 | +After installation, make sure to commit the `.ddev` directory to version control. |
26 | 23 |
|
27 |
| -```shell |
28 |
| -ddev get tyler36/ddev-laravel-queue |
29 |
| -``` |
| 24 | +## Usage |
30 | 25 |
|
31 |
| -Then restart the project |
| 26 | +The queue worker automatically runs as a background daemon inside the container. No configuration is required. |
| 27 | +To view queue worker output, check the web container logs. |
32 | 28 |
|
33 | 29 | ```shell
|
34 |
| -ddev restart |
| 30 | +$ ddev logs -s web |
| 31 | +... |
| 32 | +2025-09-19 09:12:23,817 INFO spawned: 'queue-1' with pid 1666 |
| 33 | +2025-09-19 09:12:27,571 INFO success: queue-1 entered RUNNING state, process has stayed up for > than 3 seconds (startsecs) |
| 34 | +... |
| 35 | +2025-09-19 00:16:13 App\Events\TaskUpdated ....................................................................... RUNNING |
| 36 | +2025-09-19 00:16:13 App\Events\TaskUpdated ....................................................................... 73.82ms DONE |
35 | 37 | ```
|
36 | 38 |
|
37 |
| -## What does this add-on do and add? |
| 39 | +## Configuration |
| 40 | + |
| 41 | +`.ddev/config.laravel-workers.yaml` starts the queue work daemon. |
| 42 | +It uses the following configuration settings: |
| 43 | + |
| 44 | +- `--sleep=3` : This option tells the queue worker to sleep for 3 seconds between polling for new jobs when the queue is empty. |
| 45 | +- `--tries=3` : This option specifies that if a job fails, the worker should try to process the job up to three times before sending it to a failed—jobs storage. |
| 46 | +- `sleep 1` : After processing a job, the script pauses for 1 second before re—checking conditions in the loop; this reduces CPU usage by preventing the loop from running too aggressively . |
| 47 | + |
| 48 | +To configure this add-on, remove `#ddev-generated` from `.ddev/config.laravel-workers.yaml` and edit the file as required. |
38 | 49 |
|
39 |
| -1. Checks to make sure the DDEV version is adequate. |
40 |
| -2. Adds `.ddev/config.laravel-workers.yaml`, which starts the queue worker daemon. |
| 50 | +## Credits |
41 | 51 |
|
42 | 52 | **Contributed and maintained by [tyler36](https://github.com/tyler36)**
|
0 commit comments