Download the PHP package foxxmd/laravel-elasticbeanstalk-queue-worker without Composer

On this page you can find all versions of the php package foxxmd/laravel-elasticbeanstalk-queue-worker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-elasticbeanstalk-queue-worker

Laravel 5 - 9.x Queue Worker for Elastic Beanstalk

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

Laravel provides a wonderful array of drivers for consuming queues within your application as well as some documentation on how to manage your application with Supervisord 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 Laravel application to manage itself, as a worker, in an AWS Elasticbeanstalk environment.

It provides these features:

Amazon Linux 1 deprecation

Amazon Linux 1 (AL1) is going to be unsupported soon, it is advised to migrate to use Amazon Linux 2 (AL2) https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.migration-al.html Starts from this release will only support AL2, please use previous releases for use in AL1

Let's get down to business

Installation

Require this package

or for Amazon Linux 1,

After installing the package you can either:

Add the ServiceProvider to the providers array in config/app.php (for Laravel 5.4 or lower)

Then, publish using artisan

OR

Copy everything from src/.ebextensions into your own .ebextensions folder and everything from src/.platform into your own .platform 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 / .platform folder if you're not into me overwriting your stuff.

Don't forget to add +x permission to the EB Platform Hooks scripts

Configuration

Enable Worker Mode

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

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

Set Queue Driver / Connection

Set the driver in your your EB environmental variables:

Since Laravel 5.7 the variable name got changed so will also support the new name:

Add Queues

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

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

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, pre-built supervisor config file is easy too.

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

Now during the deploy process your configuration file will be used instead of generating one.

Note: you can check eb-hooks.log for your EB environment to verify if the deploy process detected and deployed your file. Search for Starting supervisor configuration parsing. in the log.

But how does it work?

Glad you asked. It's a simple process but required a ton of trial and error to get right (kudos to AWS for their lack of documentation)

EB applications can contain a folder that provides advanced configuration for an EB environment, called .ebextensions.

EB applications since AL2 can contain platform hooks that provides hook scripts for an EB environment, called .platform.

This package uses AWS commands files in this folder to detect, install, and update supervisor and its configuration and then run it for you.

1. Ingress Supervisor rules

Supervisor requires port 9001 to be open if you want to access its web monitor. This is an optional step and can be removed if you don't need it by deleting 00supervisordIngress.config

2. Parse Queue Configuration

parseConfig.php looks for either a user-supplied supervisord.conf file specified in configuration. If one exists then it is used.

Otherwise parseConfig.php looks for a json file generated earlier that contains all of the environmental variables configured for elastic beanstalk. It then parses out any queue configurations found (see Add Queues) section above and generates a supervisor program for each as well as supplying each program with all the environmental variables set for EB. The program to be generated looks like this:

After parsing all queues it then appends the programs to a clean supervisord.conf file in the same directory.

3. Deploy Supervisor

Now a bash script workerDeploy.sh checks for IS_WORKER=TRUE in the EB environmental variables:

Caveats

Please check out issues and if you need them please make a PR!

Contributing

Make a PR for some extra functionality and I will happily accept it :)

License

This package is licensed under the MIT license.


All versions of laravel-elasticbeanstalk-queue-worker with dependencies

PHP Build Version
Package Version
Requires illuminate/console Version 5 - 9
illuminate/support Version 5 - 9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package foxxmd/laravel-elasticbeanstalk-queue-worker contains the following files

Loading the files please wait ....