Closed Alexei007 closed 3 years ago
Hey @Alexei007. You have the wrong relay value, it should be in the form of unix://file.sock
, in your case - unix://var/run/rr-rpc.sock
I might be wrong because I guess your socket has the path from the root /var/run/rr-rpc.sock
. Could you also try to run your worker separately, because as I see from the logs, there is an error while RR tries to run your worker.
Hey @Alexei007. You have the wrong relay value, it should be in the form of
unix://file.sock
, in your case -unix://var/run/rr-rpc.sock
. rr.yaml
file.server:
command: "php ./vendor/bin/rr-worker start --relay-dsn unix:///var/run/rr-rpc.sock"
relay: "unix:///var/run/rr-rpc.sock"
http:
address: 0.0.0.0:8080
middleware: ["headers", "static", "gzip"]
pool:
max_jobs: 64 # feel free to change this
supervisor:
exec_ttl: 60s
headers:
response:
X-Powered-By: "RoadRunner"
static:
dir: "public"
forbid: [".php"]
@Alexei007 Check the 8080 port in your local env. And try to run worker without RR, not to work with, but to check the problem.
Also, add these lines to your config:
# RoadRunner internal container configuration (docs: https://github.com/spiral/endure).
endure:
grace_period: 30s
print_graph: false
log_level: error
php ./vendor/bin/rr-worker start
Firewall, hm... Do you use a firewall in your local env? If so, could you please try to turn it off and re-run the application (temporary)?
Let me explain, exactly the same project. The cloud server is running normally (centos8 and Ubuntu). The local server, centos7 system, couldn't work normally. At first, I thought it was a system problem, so I tried to install centos8 to run the code. But it still doesn't work, I can't solve the problem. I would like to use RR + laravel in my new project, but the current situation may not work.
Firewall, hm... Do you use a firewall in your local env? If so, could you please try to turn it off and re-run the application (temporary)?
As I see from the error log, that by some reason, RR can't allocate a worker at your local system. This is definitely some local system issue. Might be some outdated package or something else. If you paste here the steps on how to reproduce your issue with the *.php worker I'll try to help you.
Hi @Alexei007! Could you please try to change relay from unix:///var/run/rr-rpc.sock
to unix:///tmp/rr-rpc.sock
or tcp://127.0.0.1:6001
(any unused port)?
Hi @Alexei007! Could you please try to change relay from
unix:///var/run/rr-rpc.sock
tounix:///tmp/rr-rpc.sock
ortcp://127.0.0.1:6001
(any unused port)?
@tarampampam
server:
command: "php ./vendor/bin/rr-worker start --relay-dsn unix:///tmp/rr-rpc.sock"
relay: "unix:///tmp/rr-rpc.sock"
http:
address: 0.0.0.0:8080
middleware: ["headers", "static", "gzip"]
pool:
max_jobs: 64 # feel free to change this
supervisor:
exec_ttl: 60s
headers:
response:
X-Powered-By: "RoadRunner"
static:
dir: "public"
forbid: [".php"]
...many developers couldn't run RR normally and didn't find a solution.
Sounds very-very strange.. Anyway, could you please to make an attempt to run your application using isolated environment like docker? This tutorial (ru lang; a little bit outdated) can helps you with this.
Have you tried to use pipes relay or TCP relay? Can you post your worker code?
Have you tried to use pipes relay or TCP relay? Can you post your worker code?
spiral/framework
normally.composer require spiral/roadrunner-laravel "^4.0"
./vendor/bin/rr-worker
#!/usr/bin/env php
<?php
declare(strict_types=1);
\define('RR_WORKER_START', \microtime(true));
\ini_set('display_errors', 'stderr');
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
$loaded = false;
foreach (['../../..', '../..', '..', 'vendor', '../vendor', '../../vendor'] as $path) {
if (\is_file($autoload_file = __DIR__ . '/' . $path . '/autoload.php')) {
require $autoload_file;
$loaded = true;
break;
}
}
if ($loaded !== true) {
\fwrite(\STDERR, 'Composer autoload file was not found. Try to install project dependencies' . PHP_EOL);
exit(1);
}
/*
|--------------------------------------------------------------------------
| Find Application Base Path
|--------------------------------------------------------------------------
|
| This file can be located in package `./bin` directory, used as a symbolic
| link or something else. In this case we will try to find application
| base directory using the most obvious application locations.
|
*/
/** @var string|null $base_path */
$base_path = null;
foreach (['../../../..', '../../..', '../..', '..', '../vendor/laravel/laravel'] as $path) {
if (\is_file(__DIR__ . '/' . $path . '/bootstrap/app.php')) {
$base_path = (string) \realpath(__DIR__ . '/' . $path);
break;
}
}
/*
|--------------------------------------------------------------------------
| Create And Run Console Application
|--------------------------------------------------------------------------
|
| Symfony console component is a nice wrapper around worker CLI options.
|
*/
$app = new \Symfony\Component\Console\Application(
'RoadRunner worker',
\Composer\InstalledVersions::getPrettyVersion('spiral/roadrunner-laravel')
);
$app->add(new \Spiral\RoadRunnerLaravel\Console\Commands\StartCommand(
new \Spiral\RoadRunnerLaravel\Worker(),
$base_path
));
$app->run();
@48d90782 @wolfy-j @tarampampam
@wolfy-j @48d90782
spiral/roadrunner-laravel
in the local folder of CentOS, the project can run normallyspiral/roadrunner-laravel
in the shared folder, It doesn't work.spiral/framework
, This project works well in both shared and local foldersspiral/roadrunner-laravel
.@Alexei007 Thanks for your investigation :) We will try to reproduce it.
I tried this code:
I expected to see this happen: The program is running normally
Instead, this happened:
The version of RR used: 2.0.3
The operation system used: cenots7
RR configuration file content:
remarks: I can run normally on the cloud server, including centos8 and Ubuntu. The local server is not working properly.
spiral/roadrunner-laravel version: 4.0.1
. And The CentOS7 of my local machine can run normally,spiral/framework
.