Download the PHP package foxxmd/laravel-elasticbeanstalk-cron without Composer

On this page you can find all versions of the php package foxxmd/laravel-elasticbeanstalk-cron. 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-cron

Laravel 5 - 9.x Task Scheduler with Elastic Beanstalk

Ensure one instance in an Elastic Beanstalk environment is running Laravel's Scheduler

A common problem many people have encountered with Amazon's Elastic Beanstalk is maintaining a single instance in an environment that runs Laravel's Task Scheduler. Difficulties arise because auto-scaling does not guarantee any instance is run indefinitely and there are no "master-slave" relationships within an environment to differentiate one instance from the rest.

Although Amazon has provided a solution it involves setting up a worker tier and then, potentially, creating new routes/methods for implementing the tasks that need to be run. Yuck!

This package provides a simple, zero-setup solution for maintaining one instance within an Elastic Beanstalk environment that runs the Task Scheduler.

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

How Does It Work?

Glad you asked! The below process is completely automated and only requires that you publish the .platform folder to the root of your application.

1. Use Elastic Beanstalk's Advanced Configuration to run CRON setup commands

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

This package provides a configuration file that runs two commands on deployment (every instance initialization) that setup the conditions needed to run the Task Scheduler on one instance:

2. Run system:start:leaderselection

This is the first command that is run on deployment. It configures the instance's Cron to run Leader Selection at a configured interval (default = 5 minutes)

3. Run Leader Selection aws:configure:leader

This is the Leader Selection command. It does the following:

If this instance is the earliest launched then it is deemed the Leader and runs system:start:cron

4. Run system:start:cron

This command is run only if the current instance running Leader Selection is the Leader. It inserts another entry in the instance's Cron to run Laravel's Scheduler.

That's it!

Now only one instance, the earliest launched, will have the scheduler inserted into its Cron. If that instance is terminated by auto-scaling a new Leader will be chosen within 5 minutes (or the configured interval) from the remaining running instances.

Installation

Require this package, for Amazon Linux 2,

or for Amazon Linux 1,

After adding the package, add the ServiceProvider to the providers array in config/app.php (for Laravel 5.4 or lower)

Then, publish the .platform folder and configuration file

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

Configuration

In order for Leader Selection to run a few environmental variables must be present:

These can be included in your .env or, for EB, in the environment's configuration section.

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-cron with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version 5 - 9
illuminate/console Version 5 - 9
aws/aws-sdk-php Version ^3.26
lstrojny/functional-php Version ^1.17
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-cron contains the following files

Loading the files please wait ....