Baldinof / roadrunner-bundle

A RoadRunner worker integrated in your Symfony app
MIT License
270 stars 48 forks source link

Worker not creating unix socket #20

Closed TimJones closed 3 years ago

TimJones commented 4 years ago

I have the bundle installed in a Symfony 5 based app and the command is showing up in the console as expected

$ php apps/rrtest/bin/console.php list
Symfony 5.1.5 (env: local, debug: true)

...snip...
 baldinof
  baldinof:roadrunner:worker    Run the roadrunner worker
...snip...

but running RoadRunner fails because the socket has not been created.

$ rr serve -d -v -c .rr.yaml
WARNING: Native build is an experimental feature and could change at any time
Creating busuu-dev_courses-service_run ... done
DEBU[0000] [metrics]: disabled
DEBU[0000] [headers]: disabled
DEBU[0000] [static]: disabled
DEBU[0000] [health]: disabled
DEBU[0000] [reload]: disabled
DEBU[0000] [rpc]: disabled
DEBU[0000] [http]: started
ERRO[0000] [http]: [http]: listen unix var/roadrunner.sock: bind: no such file or directory
DEBU[0000] [rpc]: stopped
Error: [http]: listen unix var/roadrunner.sock: bind: no such file or directory

My .rr.yaml is very basic

rpc:
  enabled: false
http:
  address: "0.0.0.0:8080"
  workers:
    command: php/apps/rrtest/bin/console.php baldinof:roadrunner:worker
    relay: unix://var/roadrunner.sock
Baldinof commented 4 years ago

Hi, it looks like you are not running roadrunner from the project directory. If so, you should change the socket path, like you did for bin/console:

# .rr.yaml
http:
  address: "0.0.0.0:8080"
  workers:
    command: php/apps/rrtest/bin/console.php baldinof:roadrunner:worker
    relay: unix://php/apps/rrtest/var/roadrunner.sock

If you want, you can redefine Spiral\Goridge\RelayInterface to use a custom path for the socket:

# config/services.yaml
services:
  Spiral\Goridge\RelayInterface:
    class: 'Spiral\Goridge\SocketRelay'
    arguments:
      - '/your/custom/path'
      - null
      - 1 # SocketRelay::SOCK_UNIX

You can also use a TCP socket, see https://github.com/Baldinof/roadrunner-bundle#configuration

alxbndrs commented 3 years ago

I think it would better make the path argument configurable:

    $services->set(RelayInterface::class, SocketRelay::class)
        ->args([
            '%kernel.project_dir%/var/roadrunner.sock',
            null,
            SocketRelay::SOCK_UNIX,
        ]);
Baldinof commented 3 years ago

Yes!

I don't have time for this right now, but I would be happy to review / merge a PR implementing a configuration that supports unix://path/to/rr.sock and tcp://127.0.0.0:3000, like in the workers.relay RoadRunner config.