lando / laravel

The Official Laravel Lando Plugin
https://docs.lando.dev/laravel/
GNU General Public License v3.0
12 stars 11 forks source link

Reverb support #61

Open jameswagoner opened 2 months ago

jameswagoner commented 2 months ago

Would be nice for out of the box support for Reverb or a guide if it just needs some tweaking of the YML.

I have tried various things to get a connection going and always ends up with a connection refused error.

reynoldsalec commented 2 months ago

That would be awesome, I wonder if @yolcuiskender has played with Reverb at all? Know he's doing a bunch of cool stuff with Lando and various Laravel services...

yolcuiskender commented 2 months ago

I haven't had the opportunity to use reverb yet, but I'm willing to give it a try in the next few days. Based on my initial understanding, I don't foresee encountering significant problems. However, if there are any specific aspects you'd like me to focus on or if you have any concerns, please feel free to let me know.

Looking forward to contributing to this issue.

maikezan commented 2 months ago

Any news about this? We are trying to set it up by ouserlves, but so far no success. This is our current lando.yml:

name: test_app
recipe: laravel
config:
  webroot: public
  php: 8.2
  xdebug: true
  via: nginx
  database: mysql:8.0
  cache: redis
services:
  node:
    type: node:18
    scanner: false
    ports:
      - 3009:3009
  database:
    portforward: 3307
  cache:
    portforward: 32293
  appserver:
      config:
        server: .nginx/server.conf
  queue:
    type: php:8.2
    via: cli
    command: php artisan horizon
  reverb:
    type: php:8.2
    via: cli
    ssl: true
    command: php artisan reverb:start --debug
    overrides:
      ports:
        - 8080:8080
    networks:
      - network_default
networks:
  network_default:
    driver: bridge
tooling:
  npm:
    service: node
  node:
    service: node

Apparently reverb correctly starts to listen (looking at the logs) but we haven't found a way to make the app talk to the ws server. We always end up with failed connection:

WebSocket connection to 'wss://xxxxxx/app/wkvtwtt7uvf8kmmkjjgv?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed: 
createWebSocket @   pusher-js.js?v=20883fe9:3268

Following some other guide we also have configured a custom nginx.conf adding this:

.........
location /app {
        proxy_http_version 1.1;
        proxy_set_header Host $http_host;
        proxy_set_header Scheme $scheme;
        proxy_set_header SERVER_PORT $server_port;
        proxy_set_header REMOTE_ADDR $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";

        proxy_pass http://0.0.0.0:8080;
}
........
jameswagoner commented 1 month ago

The solution I know lies in the nginx config but I'm only good enough to be dangerous in that respect. I just haven't made the time to try things out myself.

On Thu, May 9, 2024, 4:30 AM maikezan @.***> wrote:

Any news about this? We are trying to set it up by ouserlves, but so far no success. This is our current lando.yml:

name: test_app recipe: laravel config: webroot: public php: 8.2 xdebug: true via: nginx database: mysql:8.0 cache: redis services: node: type: node:18 scanner: false ports:

  • 3009:3009 database: portforward: 3307 cache: portforward: 32293 appserver: config: server: .nginx/server.conf queue: type: php:8.2 via: cli command: php artisan horizon reverb: type: php:8.2 via: cli ssl: true command: php artisan reverb:start --debug overrides: ports:
    • 8080:8080 networks:
  • network_default networks: network_default: driver: bridge tooling: npm: service: node node: service: node

Apparently reverb correctly starts to listen (looking at the logs) but we haven't found a way to make the app talk to the ws server. We always end up with failed connection:

WebSocket connection to 'wss://videomood.lndo.site/app/wkvtwtt7uvf8kmmkjjgv?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed: createWebSocket @ pusher-js.js?v=20883fe9:3268

— Reply to this email directly, view it on GitHub https://github.com/lando/laravel/issues/61#issuecomment-2102298697, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXJKNSVEYFC4AOTBQHM3YLZBM64FAVCNFSM6AAAAABGQVMHO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBSGI4TQNRZG4 . You are receiving this because you authored the thread.Message ID: @.***>

maikezan commented 1 month ago

Yea there is something in the network part i'm missing. Amazingly i can succesfully connect to the websocket server now from outside the application (via POSTMAN) but not from within the app container, so there must be something up there.

reynoldsalec commented 1 month ago

@maikezan are you using the correct hostname within the container environment for the wss server? For example, if you're trying to call the reverb service from another container in the app, it should be accessible as reverb.

maikezan commented 1 month ago

@maikezan are you using the correct hostname within the container environment for the wss server? For example, if you're trying to call the reverb service from another container in the app, it should be accessible as reverb.

this is something i need to test again. I think that was one of our first attempts and it didn't work. But we've made so many tests that i honestly need to rerun again with this and see if it works. Thanks for the suggestion

maikezan commented 1 month ago

So far no luck with using "reverb" as hostname. We are still in this situation right now, where postman connect succesfully but laravel can't.

image

this is our current lando.yml for reverb:

reverb:
    type: php:8.3
    via: cli
    ports:
      - 8080:8080
    command: php artisan reverb:start --debug
    overrides:
      depends_on:
        cache:
          condition: service_started
        queue:
          condition: service_started

And .env file for reverb:


REVERB_APP_KEY=***
REVERB_APP_SECRET=***
REVERB_HOST="landotest.lndo.site"
REVERB_PORT=8080
REVERB_SCHEME=https```