Setting up Laravel Reverb
simpan
HOBBYOP

7 days ago

Hello,

We recently added Laravels Reverb service but don't know how to setup it here, my guess is that its similar to setup the workers and connect it to the same github repo and use a deploy scripts but since reverb requires the clients to connect to the server as well im a bit lost on how to set it up and how the configuration should be.

Should i set it up like the queue service in the admin panel? and if so what ip and port should i configure in the laravel config? Do i need to create a custom Caddy config for the wss connection and if so how should it look like?

The current setup i have here is how i have it locally but locally i just run "php artisan reverb:start" and everything is working, how do i solve this here?

Best Regards

Simon

$10 Bounty

2 Replies

Status changed to Open Railway 7 days ago


You don't need an IP. You can use a pregenerated domain (or your own domain) and point it towards the port the service is listening to. A reverse proxy configuration (Caddy/Nginx) isn't required.

Also, php artisan reverb:start will work just fine. You can set that as your start command in your service configurations. (You can also use a Dockerfile for this)


0x5b62656e5d

You don't need an IP. You can use a pregenerated domain (or your own domain) and point it towards the port the service is listening to. A reverse proxy configuration (Caddy/Nginx) isn't required. Also, `php artisan reverb:start` will work just fine. You can set that as your start command in your service configurations. (You can also use a Dockerfile for this)

simpan
HOBBYOP

7 days ago

Ok, will try it out but will post my configs here if you/someone can see some errors.

One note, it wasn't me that did the setup so im not familiar with everything here, hence my quetions.

I'm following a public template with one service for pgSQL, one for Redis, one for the web app, one for the workers (which uses:

"php artisan queue:work" in it's run-worker.sh that is executed with "chmod +x ./railway/run-worker.sh && sh ./railway/run-worker.sh" as custom start command. (and one similar fron cron service).

My application has a file "railway/init-app.sh" but just noticed while checking the settings it isn't added as a custom start command as the worker is, however the content of that file is:

#!/bin/bash

#Make sure this file has executable permissions, run chmod +x railway/init-app.sh

#Exit the script if any command fails

#set -e

#mkdir -p storage/framework/{sessions,views,cache} storage/logs && php artisan config:cache && php artisan view:cache &&

php artisan storage:link --force

#Run migrations php artisan migrate --force

Clear cache

php artisan optimize:clear

Cache the various components of the Laravel application

php artisan config:cache

php artisan event:cache

php artisan route:cache

php artisan view:cache

Should i add this file as custom start command and add php reverb:start at the end like the worker has "php artisan queue:work" as last command for the worker command or is it possible to run commands with superviser?

On my local setup in .env i use:

REVERB_HOST="localhost"

REVERB_PORT=8080

REVERB_SCHEME=http

Which ofc i should change, do i just set it to:

REVERB_HOST="my.www-domain.tld"

REVERB_PORT=8081 (looks like port 8080 is in use by the application which i guess caddy then points to port 443, thats why i though i needed Caddy to point it to the right port)

REVERB_SCHEME=https

However my domain setup is via cloudflare and proxied to railway internal port 8080, see attached screenshot.

So i guess i set REVERB_PORT to like 8081 but still confusing, been reading lots of different configuration examples at https://github.com/laravel/framework/discussions/50675

Ok so cutting it down to some clear cut questions:

  • Should i set it up as it's own service with custom start command which runs php artisan reverb:start like the queue service or add php artisan reverb:start on my main application service?
  • If i set it up as its own service what port should i set REVERB_SERVER_PORT and REVERB_PORT to? also the REVERB_HOST i see most set to 0.0.0.0
  • Then we have the VITE_REVERB_* settings which i guess is the information for the JS that the client needs to be able to connect to, so the VITE_REVERB_HOST should be the generated domain and VITE_REVERB_PORT should be 443 and railway will send the connections to the REVERB_PORT ?

My take it comes down to some different scenarios:

  • Hostsing the service on same domain and its own server port but using a reverse proxy to send path /app and /apps on port 443 to the reverb port so wss://my-domin.tld/app will point to reverb, will need a custom caddy file to fix the port forwarding.
  • Hosting it on a pre-generated domain, setting RESVERB_HOST and PORT to the generated domain
  • i guess some more, so many examples online where everyone says they got the examples to work for them..

Would really really appricated if someone could do a quick dummy list of how i should set it up in general, can trix around with all the config values myself i just wanna know im going down the right path..

https://laravel.com/docs/13.x/reverb#running-server

Skärmbild 2026-06-01 052841.png

Attachments


Welcome!

Sign in to your Railway account to join the conversation.

Loading...