-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symfony worker (for inclusion in the wiki) #42
Comments
Done! https://github.com/spiral/roadrunner/wiki/Symfony-Framework Let me know if you want to change something in the article. I wonder if GitHub has any protocol for Wiki PRs. |
FYI, you can define ENV in |
Thanks @wolfy-j. Indeed env vars should probably be moved here. I'll send you the changes when ready. |
@dunglas I was using your config in my SF 4.1 app, but my static files like (app.js and images) could not be loaded. Switched to |
Have you changed static:
dir: "public"
forbid: [".php", ".htaccess"] Also, try to run with |
Does It should look like that: http://prntscr.com/l1atdz |
Yeah, found it. Is passing the requests for files directly to the application. |
Daaang I'm stupid! The Sorry for wasting your time @wolfy-j . I'm loving the project already!! :) |
This is correct behavior if file not found or static service is disabled (identical to nginx |
Ugh, yaml is really annoying sometimes. Try using json config instead if you run into this problem often. :) |
I just tried this example, but it doesn't work. I get this error:
When I change the while loop to this: while ($req = $psr7->acceptRequest()) {
try {
$resp = new \Zend\Diactoros\Response();
$resp->getBody()->write("hello world");
$psr7->respond($resp);
} catch (\Throwable $e) {
$psr7->getWorker()->error(get_class($e));
$psr7->getWorker()->error((string)$e);
}
} it works fine. Something is happening inside What am I doing wrong? |
Do you echo anything to STDOUT without buffers? There is an option how you can debug it. Switch RR to work over TCP: workers:
relay: "tcp://localhost:5000" Use SocketRelay instead of SteamRelay: $relay = new SocketRelay("localhost", 5000); |
Weird, now it works. But I don't see anything being echo'd?
|
Well, RR does not redirect STDOUT to the log, only STDERR. Does your worker die during the bootload? If so, try to run it manually If you can't find it (or don't want to) switch to TCP or Unix sockets ( |
I started RR and in a new terminal opened |
When doing a couple requests, and monitor |
So it's not bootloader issues, sounds like you output something to STDOUT while running your script. Is it possible you have some warnings and Since it's working over sockets I can conclude that your workers are fine, but they definitely use pipes for something which creates conflicts with Goridge relays. P.S. |
Do you use any |
More info added here: https://github.com/spiral/roadrunner/wiki/PHP-Workers |
I don't have any header functions in use. Also checked output of |
I'm running this inside Docker btw, not sure if that's related. |
Problem solved:
Sorry everybody! |
The Symfony example is not performant at all. It's doing a |
Yes it is, some Symfony services are stateful. You must reset their states before handling a different requests to avoid side effects. |
Wasn't this fixed with resettable services? |
PM has a lot of reseting going on: https://github.com/php-pm/php-pm-httpkernel/blob/master/Bootstraps/Symfony.php With reset tag in symfony now, this should be a lot smaller. |
Hi, thanks for this very interesting project!
Here is a worker to serve apps based on the default Symfony skeleton:
And the corresponding
.rr.yaml
file:Would you mind including it in the wiki?
The text was updated successfully, but these errors were encountered: