Open eminos opened 3 years ago
@eminos the way the proxy works, it is proxying port 6001 inside the container to ports 80/443 (or whatever ports you have the proxy bound to) on the host, so what you really want to do is bind it to a DIFFERENT domain than the nginx appserver, like ws-lintext.local
or ws.lintex.local
etc.
This definitely isn't intuitive when the standard way to run stuff is localhost:newport
but its how things work with our proxy.
You can find me in the Lando slack or the Laravel Discord if you have more questions!
Thank you @dustinleblanc ! I do have some more questions. I wrote to you on the Laravel Discord. (Couldn't get access to Lando Slack.)
Hey @eminos! I don't see the question, just made sure to login, my username over there is dustin#0971
. I might have signed up with a couple of accounts over time as discord is weird with accounts/emails, but you can hit me there!
After a long chat with Dustin he helped me figure it all out! Thanks Dustin!
So for anyone wondering or having the same issue...
The key seems to be to proxy the websockets to a custom subdomain, and access websockets through that subdomain on port 80/443 instead. Also I'm running php artisan websockets:serve --port=80
, which is the default proxy port, and makes so there is no need for ws.lintex.local:6001
.
This is my .lando.yml
. I hope it might help someone stumbling upon this issue.
name: lintex
recipe: laravel
config:
webroot: public
php: '7.4'
ssl: true
composer_version: '2.0.4'
via: nginx
database: mysql:8.0
cache: redis
excludes:
- vendor
proxy:
appserver_nginx:
- lintex.local
websockets:
- ws.lintex.local
services:
database:
type: mysql:8.0
portforward: 3306
creds:
user: lintex
password: lintex
database: lintex
horizon:
type: php:7.4
via: cli
command: /app/lando.horizon.sh
overrides:
depends_on:
- database
websockets:
type: php:7.4
via: cli
ssl: true
command: /app/lando.websockets.sh
scanner: false
overrides:
depends_on:
- database
bindAddress: "0.0.0.0" # that probably goes in your global .lando/config.yml file
@eminos Thanks for posting an update on this, it was super useful for me!
Some additional context I'll add from my own semi-related case, in case it's useful to others:
bindAddress: "0.0.0.0"
bindAddress
to 0.0.0.0
, I was able to just bind that process to 0.0.0.0
instead of 127.0.0.1
. That ended up looking like this in my case: beanstalkd -l 0.0.0.0 -p 11303
0.0.0.0
on port 11303
, I was then able to connect to the process from another service. For example, using telnet to connect from another service would look something like this: telnet {service-name}.{app-name}.internal 11303
@eminos I know this is an old issue, but do you remember if you started the server by setting a port flag?
php artisan websockets:serve --port=443
to match the proxied domain? or the host flag?
php artisan websocket:serve --host=<proxied lando host>
I'm trying to figure out how to run laravel-websockets with lando. https://beyondco.de/docs/laravel-websockets/getting-started/introduction laravel-websockets is a PHP CLI Ratchet application running on port 6001.
This is my lando file:
It seems the port 6001 is not accessible from the host. The websockets service also needs to be accessable from the other services.