Setting up Beanstalk Console on Laravel Forge

February 3, 2015

Using queues in Laravel is a great way to offload any task that can be executed asynchronously from the main processing thread of your application. They are quite easy to use and the only thing I'll say about implementing them is that the sync driver provided in the Laravel distribution allows you to start coding them even before you have a queue provider set up. You can read more about how to use queues here or here for Laravel 4.

Once you're ready to deploy your code to production, you can set up one of several different queue providers. I choose Beanstalkd which is super easy to set up in my production environment of Laravel Forge at Digital Ocean.

This is great and like most other Forge tasks should work with minimal setup effort, but chances are you're going to eventually want to monitor the status of your queue jobs for troubleshooting or just to garner some real-time statistics. For this, you can use Beanstalk Console. There are, however, a few steps in setting it up on Forge that are not immediately obvious.

First, log in to your Forge server over ssh and follow the instructions from the Beanstalk Console readme for setting up a new project.

composer create-project ptrofimov/beanstalk_console -s dev

Next, switch to the beanstalk_console directory that was created and start a server. You should really only be running this server temporarily while you see what you need to see, so running the server from the command line should do the trick.

cd beanstalk_console
php -S [YOUR SERVER IP ADDRESS]:7654 -t public

You will want to substitute the IP address of your server (Digital Ocean or otherwise) in the above command.

In order to view the pages served by that server you'll need to make a few adjustments to your firewall settings in Forge. Navigate to your server details and click on "Network".

Forge Network Button

Grab your IP address from any site that lets you check it. This site seems to work fine. Add a new firewall rule for your IP address and the Beanstalk Console port number. Your settings should look like this:

Forge Firewall Settings

You should be all set now! Navigate to http://[YOUR SERVER IP ADDRESS]:7654. Click "Add server" and stick with the default setting of localhost:11300. Now whenever your application runs a queued job, you should see its status in the console. It should look something like this:

Beanstalk Console

 

comments powered by Disqus

About This Site

This site was designed by We Are How.

This site is powered by Sculpin static site generator and the source is available here.

Yotta = 10^24, or 1 000 000 000 000 000 000 000 000, the largest metric prefix.


Contact

Get in touch to find out how we can help you refine your vision and implement a dynamite product that will help your business grow. Our agile product development process is thoughtfully designed to give clients ongoing feedback and visibility from project inception to completion.