Skip to content

Commit

Permalink
docs (readme): update to reflect bundle version 3 and symfony 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Phobetor committed May 10, 2018
1 parent 59e7130 commit 9c9817e
Showing 1 changed file with 30 additions and 43 deletions.
73 changes: 30 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ When your worker configuration or your code changes, run the command again and a

Install [supervisor](http://supervisord.org/). e. g. on debian based distributions via `apt-get`:
```sh
$ apt-get install supervisor
# apt-get install supervisor
```

Add bundle via composer
Expand All @@ -27,9 +27,8 @@ $ php composer require phobetor/rabbitmq-supervisor-bundle
```
This will install the bundle to your project’s `vendor` directory.

Add the bundle to your project’s `AppKernel`:
If your are not using Symfony Flex, also add the bundle to your project’s `AppKernel`:
```php
<?php
// app/AppKernel.php

public function registerBundles()
Expand All @@ -46,7 +45,7 @@ public function registerBundles()
RabbitMQ supervisor bundle works out of the box with a predefined configuration. If you leave it this way you will end
up with this directory structure:
```sh
app/supervisor/
supervisor/
└── dev
├── logs
│   ├── stderr.log
Expand All @@ -61,61 +60,49 @@ app/supervisor/
├── queue3.conf
└── queue4.conf
```
In symfony 2 and 3 this will be placed inside your `app/` directory.

## Advanced configuration

You can use the following configuration options in your `app/config/config.yml`:
Caution with symfony 4: to not have this inside of your `src/` directory you need to set the paths to suit your needs.
E. g. to use the standard structure inside of the `var/` directory, use this:
```yml
rabbit_mq_supervisor:
supervisor_instance_identifier: instance_name
paths:
workspace_directory: /path/to/workspace/
configuration_file: /path/to/workspace/supervisord.conf
pid_file: /path/to/workspace/supervisord.pid
sock_file: /path/to/workspace/supervisord.sock
log_file: /path/to/workspace/supervisord.log
worker_configuration_directory: /path/to/workspace/worker/
worker_output_log_file: /path/to/workspace/logs/%kernel.environment%.log
worker_error_log_file: /path/to/workspace/logs/%kernel.environment%.log
commands:
rabbitmq_consumer: user-specific-command:consumer
rabbitmq_multiple_consumer: user-specific-command:multiple-consumer
consumer:
general:
messages: 250 # consumer command option: messages to consume
memory-limit: 32 # consumer command option: allowed memory for this process
debug: true # consumer command option: enable debugging
without-signals: true # consumer command option: disable catching of system signals
worker:
count: 1 # number of workers per consumer
startsecs: 2 # supervisord worker option: seconds to consider program running
autorestart: true # supervisord worker option: if supervisord should restarted program automatically
stopsignal: INT # supervisord worker option: the signal used to kill the program
stopasgroup: true # supervisord worker option: if whole process group should be stopped
stopwaitsecs: 60 # supervisord worker option: seconds to wait after stop signal before sending kill signal
individual:
# override options for specific consumers. you can use the same options for any consumer as in consumer.general
consumer_name_1:
# […]
consumer_name_2:
# […]
workspace_directory: "%kernel.project_dir%/var/supervisor/%kernel.environment%/"
configuration_file: "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisord.conf"
pid_file: "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisor.pid"
sock_file: "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisor.sock"
log_file: "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisord.log"
worker_configuration_directory: "%kernel.project_dir%/var/supervisor/%kernel.environment%/worker/"
worker_output_log_file: "%kernel.project_dir%/var/supervisor/%kernel.environment%/logs/stdout.log"
worker_error_log_file: "%kernel.project_dir%/var/supervisor/%kernel.environment%/logs/stderr.log"
```
## Advanced configuration
To see all configuration options run
```sh
$ console config:dump-reference RabbitMqSupervisorBundle
```

### BC break when updating from v1.* to v2.*
If you used custom commands before version 2.0, you need to update them. In most case you can just remove everything
after the command name.

### BC break when updating from v2.* to v3.*
Commands will by default no longer wait for `supervisord` to complete. If you need this (e. g. to get feedback on
errors) use the `--wait-for-supervisord` option.

## Usage

Build or rebuild the supervisor and worker configuration and start the daemon:
```sh
$ app/console rabbitmq-supervisor:rebuild
$ console rabbitmq-supervisor:rebuild
```

Control the supervisord daemon:
```sh
$ app/console rabbitmq-supervisor:control stop
$ app/console rabbitmq-supervisor:control start
$ app/console rabbitmq-supervisor:control restart
$ app/console rabbitmq-supervisor:control hup
$ console rabbitmq-supervisor:control stop
$ console rabbitmq-supervisor:control start
$ console rabbitmq-supervisor:control restart
$ console rabbitmq-supervisor:control hup
```

0 comments on commit 9c9817e

Please sign in to comment.