Skip to content

Commit c7e9392

Browse files
committed
Rewrite readme and cleanup
1 parent 527c1ab commit c7e9392

File tree

7 files changed

+54
-91
lines changed

7 files changed

+54
-91
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 3.0.0 - 2022-04-03
8+
9+
**Added**
10+
11+
- Added support for PostgreSQL
12+
- Added a dashboard used to monitor jobs
13+
14+
**Removed**
15+
16+
- Dropped support for PHP 7.2 and 7.3
17+
- Dropped support for Laravel 5.x
18+
719
## 2.3.0 - 2022-02-09
820

921
**Changed**

README.md

+24-90
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This package allows Google Cloud Tasks to be used as the queue driver.
2121
</summary>
2222

2323
<br>
24-
This package requires Laravel 6 or higher.
24+
This package requires Laravel 6 or higher and supports MySQL 8 and PostgreSQL 14. Might support older database versions too, but package hasn't been tested for it.
2525

2626
Please check the table below for supported Laravel and PHP versions:
2727

@@ -36,18 +36,15 @@ Please check the table below for supported Laravel and PHP versions:
3636
<summary>Installation</summary>
3737
<br>
3838

39-
(1) Require the package using Composer
39+
Require the package using Composer
4040

41-
```bash
41+
```console
4242
composer require stackkit/laravel-google-cloud-tasks-queue
4343
```
4444

45+
Add a new queue connection to `config/queue.php`
4546

46-
[Official documentation - Creating Cloud Tasks queues](https://cloud.google.com/tasks/docs/creating-queues)
47-
48-
(2) Add a new queue connection to `config/queue.php`
49-
50-
```
47+
```php
5148
'cloudtasks' => [
5249
'driver' => 'cloudtasks',
5350
'project' => env('STACKKIT_CLOUD_TASKS_PROJECT', ''),
@@ -58,33 +55,23 @@ Please check the table below for supported Laravel and PHP versions:
5855
],
5956
```
6057

61-
(3) Update the `QUEUE_CONNECTION` environment variable
58+
Update the `QUEUE_CONNECTION` environment variable
6259

63-
```
60+
```dotenv
6461
QUEUE_CONNECTION=cloudtasks
6562
```
6663

67-
(4) [Laravel ^8.0 and above only] configure failed tasks to use the `database-uuids` driver in `config/queue.php`
68-
69-
```
70-
'failed' => [
71-
'database' => env('DB_CONNECTION', 'mysql'),
72-
'table' => 'failed_jobs',
73-
'driver' => 'database-uuids',
74-
],
75-
```
76-
7764
Now that the package is installed, the final step is to set the correct environment variables.
7865

7966
Please check the table below on what the values mean and what their value should be.
8067

81-
| Environment variable | Description |Example
82-
--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---
83-
| `STACKKIT_CLOUD_TASKS_PROJECT` | The project your queue belongs to. |`my-project`
84-
| `STACKKIT_CLOUD_TASKS_LOCATION` | The region where the AppEngine is hosted |`europe-west6`
85-
| `STACKKIT_CLOUD_TASKS_QUEUE` | The queue a job will be added to |`emails`
86-
| `STACKKIT_CLOUD_TASKS_SERVICE_EMAIL` | The email address of the AppEngine service account. Important, it should have the correct roles. See the section below which roles. |`[email protected]`
87-
| `STACKKIT_CLOUD_TASKS_HANDLER` (optional) | The URL that Cloud Tasks will call to process a job. This should be the URL to your Laravel app with the `handle-task` path added. By default we will use the URL that dispatched the job. |`https://<your website>.com/handle-task`
68+
| Environment variable | Description |Example
69+
--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---
70+
| `STACKKIT_CLOUD_TASKS_PROJECT` | The project your queue belongs to. |`my-project`
71+
| `STACKKIT_CLOUD_TASKS_LOCATION` | The region where the project is hosted |`europe-west6`
72+
| `STACKKIT_CLOUD_TASKS_QUEUE` | The default queue a job will be added to |`emails`
73+
| `STACKKIT_CLOUD_TASKS_SERVICE_EMAIL` | The email address of the service account. Important, it should have the correct roles. See the section below which roles. |`[email protected]`
74+
| `STACKKIT_CLOUD_TASKS_HANDLER` (optional) | The URL that Cloud Tasks will call to process a job. This should be the URL to your Laravel app. By default we will use the URL that dispatched the job. |`https://<your website>.com`
8875
</details>
8976
<details>
9077
<summary>
@@ -95,8 +82,6 @@ Please check the table below on what the values mean and what their value should
9582

9683
Typically a Laravel queue has a worker that listens to incoming jobs using the `queue:work` / `queue:listen` command.
9784
With Cloud Tasks, this is not the case. Instead, Cloud Tasks will schedule the job for you and make an HTTP request to your application with the job payload. There is no need to run a `queue:work/listen` command.
98-
99-
For more information on how to configure the Cloud Tasks queue, read the next section [Configuring the queue](#configuring-the-queue)
10085
</details>
10186
<details>
10287
<summary>Dashboard (beta)</summary>
@@ -112,7 +97,7 @@ _Experimental_
11297

11398
The dashboard works by storing all outgoing tasks in a database table. When Cloud Tasks calls the application and this
11499
package handles the task, we will automatically update the tasks' status, attempts
115-
and possible exceptions.
100+
and possible errors.
116101

117102
There is probably a (small) performance penalty because each task dispatch and handling does extra database read and writes.
118103
Also, the dashboard has not been tested with high throughput queues.
@@ -129,10 +114,13 @@ To make use of it, enable it through the `.env` file:
129114

130115
Then publish its assets and migrations:
131116

132-
```php
117+
```console
133118
php artisan vendor:publish --tag=cloud-tasks
134119
php artisan migrate
135120
```
121+
122+
The dashboard is accessible at the URI: /cloud-tasks
123+
136124
</details>
137125
<details>
138126
<summary>Authentication</summary>
@@ -149,65 +137,6 @@ If you're not using your master service account (which has all abilities), you m
149137
4. Cloud Tasks Task Deleter
150138
5. Service Account User
151139
</details>
152-
<details>
153-
<summary>Configuring the queue</summary>
154-
<br>
155-
When you first create a queue using `gcloud tasks queues create`, the default settings will look something like this:
156-
157-
```
158-
rateLimits:
159-
maxBurstSize: 100
160-
maxConcurrentDispatches: 1000
161-
maxDispatchesPerSecond: 500.0
162-
retryConfig:
163-
maxAttempts: 100
164-
maxBackoff: 3600s
165-
maxDoublings: 16
166-
minBackoff: 0.100s
167-
```
168-
169-
## Configurable settings
170-
171-
### maxBurstSize
172-
173-
Max burst size limits how fast tasks in queue are processed when many tasks are in the queue and the rate is high.
174-
175-
### maxConcurrentDispatches
176-
177-
The maximum number of concurrent tasks that Cloud Tasks allows to be dispatched for this queue
178-
179-
### maxDispatchesPerSecond
180-
181-
The maximum rate at which tasks are dispatched from this queue.
182-
183-
### maxAttempts
184-
185-
Number of attempts per task. Cloud Tasks will attempt the task max_attempts times (that is, if the first attempt fails, then there will be max_attempts - 1 retries). Must be >= -1.|
186-
187-
### maxBackoff
188-
189-
A task will be scheduled for retry between min_backoff and max_backoff duration after it fails
190-
191-
### maxDoublings
192-
193-
The time between retries will double max_doublings times.
194-
195-
A task's retry interval starts at min_backoff, then doubles max_doublings times, then increases linearly, and finally retries retries at intervals of max_backoff up to max_attempts times.
196-
197-
For example, if min_backoff is 10s, max_backoff is 300s, and max_doublings is 3, then the a task will first be retried in 10s. The retry interval will double three times, and then increase linearly by 2^3 * 10s. Finally, the task will retry at intervals of max_backoff until the task has been attempted max_attempts times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....
198-
199-
## Recommended settings for Laravel
200-
201-
To simulate a single `queue:work/queue:listen` process, simply set the `maxConcurrentDispatches` to 1:
202-
203-
```
204-
gcloud tasks queues update [QUEUE_ID] --max-concurrent-dispatches=1
205-
```
206-
207-
More information on configuring queues:
208-
209-
https://cloud.google.com/tasks/docs/configuring-queues
210-
</details>
211140
<details>
212141
<summary>Security</summary>
213142
<br>
@@ -219,3 +148,8 @@ More information about OpenID Connect:
219148

220149
https://developers.google.com/identity/protocols/oauth2/openid-connect
221150
</details>
151+
<details>
152+
<summary>Upgrading</summary>
153+
<br>
154+
Read [UPGRADING.MD](UPGRADING.md) on how to update versions.
155+
</details>

UPGRADING.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# From 2.x to 3.x
2+
3+
PHP 7.2 and 7.3, and Laravel 5.x are no longer supported.
4+
5+
## Update handler URL (Impact: high)
6+
7+
The handler URL environment has been simplified. Please change it like this:
8+
9+
```dotenv
10+
# Before
11+
STACKKIT_CLOUD_TASKS_HANDLER=https://my-app/handle-task
12+
# After
13+
STACKKIT_CLOUD_TASKS_HANDLER=https://my-app
14+
```
15+
16+
It's also allowed to remove this variable entirely in 3.x: The package will automatically use the application URL if the `STACKKIT_CLOUD_TASKS_HANDLER`
17+
environment is not present. If you omit it, please ensure the [trusted proxy](https://laravel.com/docs/9.x/requests#configuring-trusted-proxies) have been configured
18+
in your application. Otherwise, you might run into weird issues. :-)

dashboard/public/crossword.png

-42.7 KB
Binary file not shown.

dashboard/public/dot-grid.png

-25.4 KB
Binary file not shown.

dashboard/public/pw_maze_white.png

-600 Bytes
Binary file not shown.

tests/.gitignore

-1
This file was deleted.

0 commit comments

Comments
 (0)