Skip to content

How to use outside of Vagrant Box? #10

Open

Description

@ian-nisbet

This is working fine (both with Laravel and Lumen) when using homestead and running php artisan dump-server inside of the Vagrant box. How do I configure it to run from outside of the Vagrant box, but listen to the server inside?

I tried changing config 'host' => 'tcp://192.168.10.8:9912' but I get error stream_socket_server(): unable to connect to tcp://192.168.10.8:9912 (Can't assign requested address)

Thanks

Activity

  1. mpociot commented on Jul 14, 2018

    @mpociot
    Member

    The homestead VM needs to connect to the host server. Maybe you got the IP address wrong?

  2. mfauveau commented on Jul 16, 2018

    @mfauveau

    @ian-nisbet did you figure this out?
    I'm running into the same problem and I'm sure I'm using the correct VM IP.

  3. johanvanhelden commented on Jul 16, 2018

    @johanvanhelden

    I can't get it to work inside a docker-compose setup, this might be a similar issue. There is a nginx image to serve the site, the code runs from a PHP image and artisan commands are issued from a workspace container. What should be the host IP here? I've tried them all, but the connection seems to always fail.

  4. Rigby90 commented on Jul 16, 2018

    @Rigby90

    @johanvanhelden

    I had a similar issue with Docker. I had to set the config file to listen to all IP addresses as per the below snippet and run the 'php artisan dump-server' command within the work space container to get the dump server up and running listening on all IPs.

    'host' => 'tcp://0.0.0.0:9912'

    then changed the config file to point to the IP address of the workspace container to allow the nginx container to send the logs to the correct address. In this instance I had to set it too -

    'host' => 'tcp://172.20.0.3:9912'

    @ian-nisbet

    Perhaps you can attempt something similar with Vagrant?

    Might be of benefit to split the config values into a 'listen on' and 'connect to' address to allow the dump server to exist on a different node/machine/container?

    Alternatively, for my use case I can just move the options to environment variables and set them within the docker compose files or set them at run time.

  5. johanvanhelden commented on Jul 16, 2018

    @johanvanhelden

    @Rigby90 you are a lifesaver, thanks!

    So to summarize what I did to get it to work:

    I edited my docker-compose file to expose the port the dump server runs on in the php image section:

      php:
        <snip>
        ports:
          - "9912:9912"
    

    And in the dump-server config, I pointed to the name of the workspace container, like so:

    return [
        // The host to use when listening for debug server connections.
        'host' => 'tcp://dockerhero_workspace:9912',
    ];
    

    And everything works like a charm:

    Laravel Var Dump Server
    =======================
    
                                                                                                                            
     [OK] Server listening on tcp://dockerhero_workspace:9912    
    
  6. ian-nisbet commented on Jul 17, 2018

    @ian-nisbet
    Author

    IP Address of Vagrant box is correct.
    I tried the above with Vagrant/Homestead, but nothing worked.
    Interestingly, the following occurs:

    1. With 'host' => 'tcp://192.168.10.8:9912' when I run php artisan dump-server inside Vagrant, Artisan commands from outside vagrant and http requests all dump correctly.
    2. With 'host' => 'tcp://0.0.0.0:9912' when I run php artisan dump-server inside Vagrant, only http dumps correctly and Artisan commands are ignored.
    3. With 'host' => 'tcp://0.0.0.0:9912' when I run php artisan dump-server outside Vagrant, only Artisan commands dump correctly, but http requests are ignored.
    4. With 'host' => 'tcp://192.168.10.8:9912' when I run php artisan dump-server outside Vagrant, nothing works and I get error:
    DumpServer.php line 43:
      stream_socket_server(): unable to connect to tcp://192.168.10.8:9912 (Can't assign re
      quested address)
    
  7. Volmarg commented on Sep 10, 2018

    @Volmarg

    Got same issues with Vagrant.
    In my case
    'host' => 'tcp://0.0.0.0:9912'

    is not working, and inserting IP obtained from Laravel Homestead yaml
    http://192.168.10.10/

    not working as well.

    obraz

  8. eleftrik commented on Sep 14, 2018

    @eleftrik

    For those using Laradock, here what I had to do (thanks @johanvanhelden for sharing your solution):

    • edit docker-compose.yml adding, under php-fpm section, these lines:
    php-fpm:
      ...
      ports:
        - "9912:9912"
    
    • docker-compose build workspace
    • in config/debug-server.php change to 'host' => 'tcp://<workspace container IP address>:9912'
    • docker-compose exec workspace bash
    • php artisan dump-server
  9. eleftrik commented on Apr 2, 2019

    @eleftrik

    Anyone using dump-server with Lando (https://github.com/lando/lando)?
    I can't make it work :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions