Skip to content
New: Laravel Hosting, Node.js Hosting & GitHub DeploysSee the plans →
Products
Solutions
Developers

Guides

Run Laravel Horizon, Reverb and Octane on shared hosting

Run Horizon, Reverb websockets and Octane with RoadRunner as worker processes on Litehost, plus the proxy settings that make them reachable on your domain.

Introduction

Horizon, Reverb, and Octane all run as worker processes. Reverb and Octane also use the panel’s HTTP proxy so browsers can reach them on your own domain. This guide assumes you are familiar with launching workers, as described in the queue worker guide.

Horizon

Horizon requires Redis, which is included on every Laravel Hosting and Node.js Hosting plan, and on Business and Cloud Enterprise for Linux and WordPress. Enable it for the site under Advanced, then add the following to your .env file:

QUEUE_CONNECTION=redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379

Launch a Laravel worker with the command php artisan horizon and the working directory that holds artisan, with no proxy. Horizon supervises its own child workers, so you do not need a separate queue:work worker.

The log may show a few Worker STOPPED Interrupted lines in the first few seconds while Horizon settles its pool. These stop on their own, and jobs process normally.

When deploying, end the build script with php artisan horizon:terminate. Horizon exits cleanly and the panel starts it again in the new release.

Reverb

Reverb is Laravel’s websocket server. Launch a Laravel worker with the following command:

php artisan reverb:start --host=0.0.0.0 --port=8080

Turn HTTP proxy on, set the path to app and the port to 8080, and turn websocket upgrade on. The panel then forwards https://yourdomain.com/app/... to Reverb inside the container, including the websocket handshake.

Client Configuration

The proxy strips the path prefix before forwarding, and Reverb also expects its routes under /app. The browser must therefore connect to /app/app/{key}, which you may configure in Laravel Echo:

wsPath: '/app',
wsHost: window.location.hostname,
wsPort: 443,
forceTLS: true,

Server Configuration

Laravel publishes events to Reverb from the server. The proxy only forwards /app, while Laravel publishes to /apps/..., so you should point Laravel directly at Reverb inside the container:

REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=http

The Echo settings above already use the page’s own hostname for the browser. When deploying, end the build script with php artisan reverb:restart.

Octane With RoadRunner

Octane serves the whole site from a long running process. Launch a Laravel worker with the following command:

php artisan octane:start --server=roadrunner --host=0.0.0.0 --port=8000

Turn HTTP proxy on, leave the path empty so the proxy covers the whole site, and set the port to 8000. The first start downloads the RoadRunner binary into the project folder, which takes a moment and appears in the log.

Note: You should use RoadRunner. Swoole is not installed in the container.

There are two things to handle when deploying:

  • The RoadRunner binary lives in the release folder, so copy it forward in the build script with cp ../current/rr rr, or let Octane download it again.
  • Octane does not reload on queue:restart, so press Restart container on the site overview after each deploy. This restarts every worker on the site and takes a few seconds.

Running Multiple Workers

The test site for this guide runs a queue worker, the scheduler, Horizon, Reverb, and Octane as five worker cards on one site, with Octane serving the site and Reverb on /app. Each card has its own log. All workers share the memory of your plan, so a site running five long lived processes needs a plan with enough memory for them.

Limitations

Workers restart if they exit, but a worker that exits every few seconds is restarted every few seconds, with no throttling. The panel log only keeps the most recent attempt, so you should test commands over SSH first. If your application needs a process manager with backoff rules, health checks, and alerting, you should use a VPS.

Keep reading

Other guides

Start building today

Laravel apps with queues and Horizon, WordPress stores, Node.js servers. One container with SSH, deploys from GitHub and people who answer. One bill a year.

Launch my site