PHPackages                             aramirez92/laravel-elasticbeanstalk-queue-worker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. aramirez92/laravel-elasticbeanstalk-queue-worker

ActiveLibrary[Queues &amp; Workers](/categories/queues)

aramirez92/laravel-elasticbeanstalk-queue-worker
================================================

Deploy your Laravel application as a queue worker on AWS ElasticBeanstalk

0.2.1(9y ago)011MITShell

Since Nov 11Pushed 9y agoCompare

[ Source](https://github.com/aramirez92/laravel-elasticbeanstalk-queue-worker)[ Packagist](https://packagist.org/packages/aramirez92/laravel-elasticbeanstalk-queue-worker)[ RSS](/packages/aramirez92-laravel-elasticbeanstalk-queue-worker/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (5)Used By (0)

Laravel 5 Queue Worker for Elastic Beanstalk
============================================

[](#laravel-5-queue-worker-for-elastic-beanstalk)

*Use your L5 application as a worker to consume queues on AWS Elasticbeanstalk*

Laravel provides a [wonderful array](https://laravel.com/docs/5.1/queues) of drivers for consuming queues within your application as well as [some documentation](https://laravel.com/docs/5.1/queues#supervisor-configuration) on how to manage your application with [Supervisord](http://supervisord.org/) when it is acting as a worker.

Unfortunately that's where the documentation ends. There is no guidance on how to manage multiple workers from a devops context which is a huge bummer. But don't worry fam I've got your covered.

**This package enables your L5 application to manage itself, as a worker, in an [AWS Elasticbeanstalk](https://aws.amazon.com/elasticbeanstalk/) environment.**

**It provides these features:**

- **Automated installation of supervisor on first-time deployment**
- **Automatic updating of supervisor configuration upon deployment**
- **Two supervisor configuration deployment options:**
    - **Parsing of EB environmental variables to generate supervisor config**
    - **Or using a pre-built supervisor config supplied in project**

Let's get down to business
==========================

[](#lets-get-down-to-business)

Installation
------------

[](#installation)

Require this package

```
composer require "foxxmd/laravel-elasticbeanstalk-queue-worker"
```

**After installing the package you can either:**

Add the ServiceProvider to the providers array in `config/app.php`

```
FoxxMD\LaravelElasticBeanstalkQueueWorker\ElasticBeanstalkQueueWorkerProvider::class
```

Then, publish using artisan

```
php artisan vendor:publish --tag=ebworker
```

**OR**

Copy everything from `src/.ebextensions` into your own `.ebextensions` folder manually

**Note:** This library only consists of the EB deploy steps -- the provider is only for a convenience -- so if you want to you can modify/consolidate the `.ebextensions` folder if you're not into me overwriting your stuff.

Configuration
-------------

[](#configuration)

### Enable Worker Mode

[](#enable-worker-mode)

In order for worker deployment to be active you **must** add this environmental to your elasticbeanstalk environment configuration:

```
IS_WORKER = true

```

**If this variable is false or not present the deployment will not run**

### Set Queue Driver

[](#set-queue-driver)

Set the [driver](https://laravel.com/docs/5.1/queues#introduction) in your your EB envronmental variables:

```
QUEUE_DRIVER = [driver]

```

**Note: If no `QUEUE_DRIVER` key is present in your EB envronmental variables then `beanstalkd` will be used.**

### Add Queues

[](#add-queues)

All queues are configured using EB envronmental variables with the following syntax:

**Note**: brackets are placeholders only, do not use them in your actual configuration

```
queue[QueueName]     = [queueName]   # Required. The name of the queue that should be run.
[QueueName]NumProcs  = [value]       # Optional. The number of instances supervisor should run for this queue. Defaults to 1
[QueueName]Tries     = [value]       # Optional. The number of times the worker should attempt to run in the event an unexpected exit code occurs. Defaults to 5
[QueueName]Sleep     = [value]       # Optional. The number of seconds the worker should sleep if no new jobs are in the queue. Defaults to 5
[QueueName]StartSecs = [value]       # Optional. How long a job should run for to be considered successful. Defaults to 1
[QueueName]Delay     = [value]       # Optional. Time in seconds a job should be delayed before returning to the ready queue. Defaults to 0

```

Add one `queue[QueueName] = [queueName]` entry in your EB environmental variables for each queue you want to run. The rest of the parameters are optional.

That's it! On your next deploy supervisor will have its configuration updated/generated and start chugging along on your queues.

Using Your Own `supervisord.conf`
---------------------------------

[](#using-your-own-supervisordconf)

Using your own, pre-built supervisor config file is easy too.

Simply set the location of the file in the published `elasticbeanstalkworker.php` config file:

```
