Skip to content

Commit effd8f7

Browse files
authored
Update README.md
1 parent 2a5a7ab commit effd8f7

File tree

1 file changed

+1
-106
lines changed

1 file changed

+1
-106
lines changed

README.md

Lines changed: 1 addition & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -4,112 +4,7 @@ Improves performance of `fos:elastica:populate` commands by distributing the wor
44
The performance gain depends on how much consumers you run.
55
For example 10 consumers may give you 5 to 7 times better performance.
66

7-
## Installation
8-
9-
Install packages using [composer](https://getcomposer.org/)
10-
11-
```bash
12-
$ composer require enqueue/elastica-bundle friendsofsymfony/elastica-bundle
13-
```
14-
15-
Add bundles to `AppKernel`
16-
17-
```php
18-
<?php
19-
use Symfony\Component\HttpKernel\Kernel;
20-
21-
class AppKernel extends Kernel
22-
{
23-
public function registerBundles()
24-
{
25-
$bundles = [
26-
// ...
27-
28-
new Enqueue\Bundle\EnqueueBundle(),
29-
new Enqueue\ElasticaBundle\EnqueueElasticaBundle(),
30-
new FOS\ElasticaBundle\FOSElasticaBundle(),
31-
];
32-
33-
return $bundles;
34-
}
35-
}
36-
```
37-
38-
Here's an example of what your `FOSElasticaBundle` configuration may look like:
39-
40-
```yaml
41-
fos_elastica:
42-
clients:
43-
default: { host: %elasticsearch_host%, port: %elasticsearch_port% }
44-
indexes:
45-
app:
46-
index_name: app_%kernel.environment%
47-
types:
48-
blog:
49-
mappings:
50-
text: ~
51-
persistence:
52-
driver: orm
53-
model: AppBundle\Entity\Blog
54-
provider: ~
55-
listener: ~
56-
finder: ~
57-
```
58-
59-
Here's an example of what your EnqueueBundle configuration may look like:
60-
61-
```yaml
62-
enqueue:
63-
transport:
64-
default: 'file://%kernel.root_dir%/../var/messages'
65-
```
66-
67-
Sure you can configure other transports like: [rabbitmq, amqp, stomp and so on](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/config_reference.md)
68-
Create a `fos_elastica_populate` queue on broker side, if needed.
69-
70-
## Usage
71-
72-
The bundle once registered automatically replaces Doctrine ORM provider by async one.
73-
So you have to run as usual
74-
75-
```bash
76-
$ ./bin/console fos:elastica:populate
77-
```
78-
79-
If you want to disable this behavior you can un register the bundle or use env var
80-
81-
```bash
82-
$ ENQUEUE_ELASTICA_DISABLE_ASYNC=1 ./bin/console fos:elastica:populate
83-
```
84-
85-
Run some consumers either using client (you might have to enable it) consume command:
86-
87-
```bash
88-
$ ./bin/console enqueue:consume --setup-broker -vvv
89-
```
90-
91-
or a transport one:
92-
93-
```bash
94-
$ ./bin/console enqueue:transport:consume enqueue_elastica.populate_processor -vvv
95-
```
96-
97-
We suggest to use [supervisor](http://supervisord.org/) on production to control numbers of consumers and restart them.
98-
99-
Here's config example
100-
101-
```
102-
# cat /etc/supervisor/conf.d/fos_elastica_populate.conf
103-
[program:fos_elastica_populate]
104-
command=/mqs/symfony/bin/console enqueue:transport:consume fos_elastica_populate enqueue_elastica.populate_processor
105-
process_name=%(program_name)s_%(process_num)02d
106-
numprocs=10
107-
autostart=true
108-
autorestart=true
109-
startsecs=0
110-
user=root
111-
redirect_stderr=true
112-
```
7+
[Read the documenation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/elastica-bundle/populate-command-optimization.md)
1138

1149
## Developed by Forma-Pro
11510

0 commit comments

Comments
 (0)