zapps's avatar
Level 8

Laravel Reverb on Cloudways Hosting Working?

Hi

Has anyone got Laravel Reverb to work on Cloudways?

Thanks

0 likes
6 replies
LaryAI's avatar
Level 58

Laravel Reverb is not a standard or widely recognized package or feature within the Laravel ecosystem, so it's possible that the question might be referring to a custom package or a specific feature that is not commonly known. However, I can provide some general guidance on deploying Laravel applications on Cloudways, which might help if "Laravel Reverb" is part of a Laravel application.

To deploy a Laravel application on Cloudways, you can follow these general steps:

  1. Set Up a Server on Cloudways:

    • Log in to your Cloudways account.
    • Launch a new server with your preferred cloud provider (e.g., DigitalOcean, AWS, Google Cloud).
    • Choose the Laravel application from the available options.
  2. Deploy Your Laravel Application:

    • Once the server is ready, go to the "Applications" tab and select your Laravel application.
    • Use the provided SFTP credentials to upload your Laravel project files to the public_html directory.
  3. Configure Environment Variables:

    • Access the .env file in your Laravel project and update the necessary environment variables, such as DB_DATABASE, DB_USERNAME, DB_PASSWORD, etc., to match your Cloudways database credentials.
  4. Run Composer Install:

    • Use the SSH access provided by Cloudways to connect to your server.
    • Navigate to your application directory and run the following command to install dependencies:
      composer install
      
  5. Set File Permissions:

    • Ensure that the storage and bootstrap/cache directories are writable:
      chmod -R 775 storage
      chmod -R 775 bootstrap/cache
      
  6. Migrate the Database:

    • Run the Laravel migrations to set up your database schema:
      php artisan migrate
      
  7. Set Up a Queue Worker (if needed):

    • If your application uses queues, you can set up a queue worker on Cloudways using Supervisor or a similar tool.
  8. Test Your Application:

    • Visit your application URL to ensure everything is working correctly.

If "Laravel Reverb" refers to a specific package or feature, please provide more details, and I can offer more targeted advice. Otherwise, these steps should help you get a standard Laravel application running on Cloudways.

zapps's avatar
Level 8

@LaryAI

Just go to sleep Lary. You're embarrassing yourself.

1 like
dkroft's avatar

@zapps although I do admire his certainty and confidence

1 like
cellen's avatar

I had to reach out to Cloudways support (you can create a ticket or do a live chat) in order for the websocket ports to get opened up on my application to allow reverb to work as expected.

Make sure to give them the websocket path (looks like: wss://<domain>/app/<reverb_app_key>?protocol=7&client=js&version=8.4.0-rc2&flash=false) and port. I ended up using 6001 for my REVERB_SERVER_PORT because it kept telling me that 8080 was in use/unavailable.

And when asking about running php artisan reverb:start through Supervisor, they said I can provide them the commands I need adjusted on jobs added through the Application Settings gui. I haven't requested this yet, but it seems on track from the previous support.

cellen's avatar

Quick follow-up in case anyone was curious about keeping Reverb running on your Cloudways staging/production app:

  1. Create a new job under your Supervisor tab in your Cloudways application (I set "reverb" as the queue name to help differentiate between the main queue worker, did not adjust any other settings)
  2. Reach out to support and tell them you need the job (provide the ID) to run the following command: php artisan reverb:start
  3. Make sure to specify that no additional arguments should be following the command (remove --queue --sleep --tries --quiet --timeout, they are default included with the queue worker jobs but obviously won't work with Reverb)

This worked for me! My company has high-level support, so your mileage may vary.

clivew's avatar

@cellen Many thanks for posting these details. Out of interest, in your server's ".env" file...

  1. What did you set REVERB_HOST to? If you created a subdomain like ws.your-domain.com did you create a CNAME record and point it at the same *.cloudwaysapps.com address that your main your-domain.com points at?
  2. What did you set REVERB_PORT and REVERB_SCHEME to?
  3. Did you set a value for REVERB_SERVER_HOST or did you leave it at its default of '0.0.0.0'?

Please or to participate in this conversation.