You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Download and install RoadRunner binary using DLoad:
54
60
55
-
After package installation, you can download and install [RoadRunner][roadrunner] binary
56
-
using [DLoad][dload] package:
57
-
58
-
```bash
61
+
```shell
59
62
./vendor/bin/dload get rr
60
63
```
61
64
62
-
### Basic Configuration (.rr.yaml)
65
+
### Configuration
63
66
64
67
Create a `.rr.yaml` configuration file in your project root:
65
68
@@ -70,7 +73,6 @@ rpc:
70
73
71
74
server:
72
75
command: 'php vendor/bin/rr-worker start'
73
-
relay: pipes
74
76
75
77
http:
76
78
address: 0.0.0.0:8080
@@ -87,50 +89,27 @@ http:
87
89
forbid: [ ".php" ]
88
90
```
89
91
90
-
## RoadRunner Worker Configuration
92
+
### Starting the Server
91
93
92
-
You can configure workers in `config/roadrunner.php` file in the `workers` section:
94
+
Start the RoadRunner server with:
93
95
94
-
```php
95
-
use Spiral\RoadRunner\Environment\Mode;
96
-
use Spiral\RoadRunnerLaravel\Grpc\GrpcWorker;
97
-
use Spiral\RoadRunnerLaravel\Http\HttpWorker;
98
-
use Spiral\RoadRunnerLaravel\Queue\QueueWorker;
99
-
use Spiral\RoadRunnerLaravel\Temporal\TemporalWorker;
100
-
101
-
return [
102
-
// ... other configuration options ...
103
-
104
-
'workers' => [
105
-
Mode::MODE_HTTP => HttpWorker::class,
106
-
Mode::MODE_JOBS => QueueWorker::class,
107
-
Mode::MODE_GRPC => GrpcWorker::class,
108
-
Mode::MODE_TEMPORAL => TemporalWorker::class,
109
-
],
110
-
];
96
+
```shell
97
+
./rr serve
111
98
```
112
99
113
-
As you can see, there are several predefined workers for HTTP, Jobs, gRPC, and Temporal. Feel free to replace any of
114
-
them with your implementation if needed. Or create your own worker, for example,
115
-
for [Centrifugo](https://docs.roadrunner.dev/docs/plugins/centrifuge), [TCP](https://docs.roadrunner.dev/docs/plugins/tcp)
116
-
or any other plugin.
117
-
118
100
## How It Works
119
101
120
-
In the server section of the RoadRunner config, we specify the command to start our worker:
102
+
RoadRunner creates a worker pool by executing the command specified in the server configuration:
121
103
122
104
```yaml
123
105
server:
124
106
command: 'php vendor/bin/rr-worker start'
125
-
relay: pipes
126
107
```
127
108
128
-
When RoadRunner server creates a worker pool for a specific plugin, it exposes an environment variable `RR_MODE` that
129
-
indicates which plugin is being used. Our worker checks this variable to determine which Worker class should handle the
130
-
request based on the configuration in `roadrunner.php`.
109
+
When RoadRunner creates a worker pool for a specific plugin, it sets the `RR_MODE` environment variable to indicate which plugin is being used.
110
+
The Laravel Bridge checks this variable to determine which Worker class should handle the request based on your configuration.
131
111
132
-
The selected worker starts listening for requests from the RoadRunner server and handles them using the Octane worker,
133
-
which clears the application state after each task (request, command, etc.).
112
+
The selected worker then listens for requests from the RoadRunner server and handles them using the Octane worker, which clears the application state after each task (request, command, etc.).
134
113
135
114
## Supported Plugins
136
115
@@ -153,16 +132,15 @@ http:
153
132
forbid: [ ".php" ]
154
133
```
155
134
156
-
> **Note:** Read more about the HTTP plugin in
157
-
> the [RoadRunner documentation][https://docs.roadrunner.dev/docs/http/http].
135
+
> **Note:** Read more about the HTTP plugin in the [RoadRunner documentation](https://docs.roadrunner.dev/docs/http/http).
158
136
159
137
### Jobs (Queue) Plugin
160
138
161
-
The Queue plugin allows you to use RoadRunner as a queue driver for Laravel.
139
+
The Queue plugin allows you to use RoadRunner as a queue driver for Laravel without additional services like Redis or a database.
162
140
163
141
#### Configuration
164
142
165
-
First, add the Queue Service Provider in your `config/app.php`:
143
+
First, add the Queue Service Provider in `config/app.php`:
166
144
167
145
```php
168
146
'providers' => [
@@ -171,7 +149,7 @@ First, add the Queue Service Provider in your `config/app.php`:
171
149
],
172
150
```
173
151
174
-
Then, configure a new connection in your `config/queue.php`:
152
+
Then, configure a new connection in `config/queue.php`:
175
153
176
154
```php
177
155
'connections' => [
@@ -197,17 +175,17 @@ jobs:
197
175
config: { }
198
176
```
199
177
200
-
> **Note:** Read more about the Jobs plugin in
201
-
> the [RoadRunner documentation][https://docs.roadrunner.dev/docs/queues-and-jobs/overview-queues].
202
-
203
-
Don't forget to set the `QUEUE_CONNECTION` environment variable in your `.env` file:
178
+
Set the `QUEUE_CONNECTION` environment variable in your `.env` file:
204
179
205
180
```dotenv
206
181
QUEUE_CONNECTION=roadrunner
207
182
```
208
183
209
184
That's it! You can now dispatch jobs to the RoadRunner queue without any additional services like Redis or Database.
210
185
186
+
> [!TIP]
187
+
> Read more about the Jobs plugin in the [RoadRunner documentation](https://docs.roadrunner.dev/docs/queues-and-jobs/overview-queues).
188
+
211
189
### gRPC Plugin
212
190
213
191
The gRPC plugin enables serving gRPC services with your Laravel application.
@@ -268,36 +246,44 @@ return [
268
246
];
269
247
```
270
248
271
-
Download Temporal binary for development purposes using the following command:
249
+
Download Temporal binary for development:
272
250
273
251
```bash
274
252
./vendor/bin/dload get temporal
275
253
```
276
254
277
-
To start the Temporal server, you can use the following command:
255
+
Start the Temporal dev server:
278
256
279
257
```bash
280
258
./temporal server start-dev --log-level error --color always
281
259
```
282
260
283
-
#### Useful links
261
+
#### Useful Links
284
262
285
263
- [PHP SDK on GitHub](https://github.com/temporalio/sdk-php)
0 commit comments