Download the PHP package ac/fiendish-bundle without Composer

On this page you can find all versions of the php package ac/fiendish-bundle. 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 fiendish-bundle

Fiendish-Bundle

Fiendish-bundle allows you to write daemons within Symfony2, and control their execution.

API Documentation

Installation

First you need to install and set up these non-PHP dependencies:

You will also need to make sure that you have the PHP executable available from the command line. On Ubuntu, that means installing the php5-cli package, and on other distributions it's most likely something similar.

Next, install fiendish-bundle into your Symfony2 app via composer:

"require": {
    ...
    "americancouncils/fiendish-bundle": "dev-master"
}

And add both Fiendish and the RabbitMQ bundle to your app/AppKernel.php bundles list:

new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new AC\FiendishBundle\ACFiendishBundle()

Then you'll need to set up the Process table in your database. For now, that means manually installing and running the migration file found in the project's DoctrineMigrations folder.

Finally, you need to add some settings to supervisor to organize the daemons for your specific app. Here's an example of a config /etc/supervisor/conf.d/foobar.conf for a project called Foobar:

[program:foobar_master]
command=/usr/bin/php /var/www/foobar/app/console fiendish:master-daemon foobar
redirect_stderr=true

[group:foobar]

The group section is deliberately empty; Fiendish will be adding and removing processes in that group dynamically.

You'll also want to add a corresponding section to your Symfony config file:

fiendish:
    groups:
        foobar:
            process_user: "www-data"

process_user is the UNIX user that your daemons will run as.

Writing a Daemon

Daemons are implemented as classes that derive from BaseDaemon. Here's an example daemon for Foobar:

The run method is called when your daemon starts. If your daemon is meant to stay up all the time, then run should never return. It also needs to call the heartbeat method regularly, every few seconds or so. If a long enough time passes between heartbeats (by default, 30 seconds), your daemon will be assumed frozen and forcibly restarted.

The daemon has full access to your Symfony app's services. You can get to the container by calling $this->getContainer().

You can also pass arguments to your daemons when you start them. Any JSON-serializable object can be used. In the example above an associative array with a single key was passed in.

Starting and Stopping Daemon Processes

To start a daemon process, use the Group service as shown:

When applyChanges is called, the master daemon wakes up and adds all new processes to the Supervisor group and starts them up.

Stopping a running daemon is similar:

Debugging

Supervisor will keep track of everything printed out by your daemons and all activity related to them starting and stopping. Your best bet for figuring out any problems with your daemons is to use the Supervisor console:

$ sudo supervisorctl
> status
foobar_master              RUNNING    pid 8263, uptime 1:35:03
foobar:useless_thing.373771873643687276    RUNNING   pid 8267, uptime 1:28:28
> tail -f foobar:useless_thing.373771873643687276
FOO fries and a shake!
BAR fries and a shake!
FOO fries and a shake!
BAR fries and a shake!
...  (All print output and PHP error output ends up here) ...

(Thankfully, Supervisor's console has tab-completion, so there's no need to type out the long random numbers used to uniquely tag processes.)

Non-PHP Daemons

You can write your daemon processes in a language other than PHP by using the ExternalDaemon class. Implement the getExternalCommand method, returning a resource path or absolute path to the executable:

The third argument passsed to startProcess should be an array, whose contents which will be passed to your program as command-line arguments.

Your daemon still has to emit heartbeats at regular intervals. To help with this, two environment variables are set:

To emit a heartbeat, publish the given message to default exchange with the given routing key on AMQP.


All versions of fiendish-bundle with dependencies

PHP Build Version
Package Version
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 ac/fiendish-bundle contains the following files

Loading the files please wait ....