Show More
@@ -4,27 +4,48 b'' | |||||
4 | Configure Celery |
|
4 | Configure Celery | |
5 | ---------------- |
|
5 | ---------------- | |
6 |
|
6 | |||
7 | To improve |RCM| performance you should configure and enabled Celery_ as it makes |
|
7 | Celery_ is an asynchronous task queue. It's a part of RhodeCode scheduler | |
8 | asynchronous tasks work efficiently. Most important it allows sending notification |
|
8 | functionality. Celery_ makes certain heavy tasks perform more efficiently. | |
9 | emails, create repository forks, and import repositories in async way. |
|
9 | Most important it allows sending notification emails, create repository forks, | |
|
10 | and import repositories in async way. It is also used for bi-directional | |||
|
11 | repository sync in scheduler. | |||
10 |
|
12 | |||
11 | If you decide to use Celery you also need a working message queue. |
|
13 | If you decide to use Celery you also need a working message queue. | |
12 | The recommended message broker is rabbitmq_. |
|
14 | The recommended and fully supported message broker is rabbitmq_. | |
13 |
|
15 | |||
14 |
|
16 | |||
15 |
In order to |
|
17 | In order to install and configure Celery, follow these steps: | |
16 |
|
18 | |||
17 | 1. Install RabbitMQ, see the documentation on the Celery website for |
|
19 | 1. Install RabbitMQ, see the documentation on the Celery website for | |
18 | `rabbitmq installation`_. |
|
20 | `rabbitmq installation`_, or `rabbitmq website installation`_ | |
|
21 | ||||
|
22 | ||||
|
23 | 1a. As en example configuration after installation, you can run:: | |||
|
24 | ||||
|
25 | sudo rabbitmqctl add_user rcuser secret_password | |||
|
26 | sudo rabbitmqctl add_vhost rhodevhost | |||
|
27 | sudo rabbitmqctl set_user_tags rcuser rhodecode | |||
|
28 | sudo rabbitmqctl set_permissions -p rhodevhost rcuser ".*" ".*" ".*" | |||
|
29 | ||||
19 |
|
|
30 | ||
20 | 2. Configure Celery in the |
|
31 | 2. Enable celery, and install `celery worker` process script using the `enable-module`:: | |
|
32 | ||||
|
33 | rccontrol enable-module celery {instance-id} | |||
|
34 | ||||
|
35 | .. note:: | |||
|
36 | ||||
|
37 | In case when using multiple instances in one or multiple servers it's highly | |||
|
38 | recommended that celery is running only once, for all servers connected to | |||
|
39 | the same database. Having multiple celery instances running without special | |||
|
40 | reconfiguration could cause scheduler issues. | |||
|
41 | ||||
|
42 | ||||
|
43 | 3. Configure Celery in the | |||
21 | :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file. |
|
44 | :file:`home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file. | |
22 | Set the following minimal settings, that are set during rabbitmq_ installation:: |
|
45 | Set the broker_url as minimal settings required to enable operation. | |
|
46 | If used our example data from pt 1a, here is how the broker url should look like:: | |||
23 |
|
47 | |||
24 | broker.host = |
|
48 | celery.broker_url = amqp://rcuser:secret_password@localhost:5672/rhodevhost | |
25 | broker.vhost = |
|
|||
26 | broker.user = |
|
|||
27 | broker.password = |
|
|||
28 |
|
49 | |||
29 | Full configuration example is below: |
|
50 | Full configuration example is below: | |
30 |
|
51 | |||
@@ -34,35 +55,15 b' 2. Configure Celery in the' | |||||
34 | #################################### |
|
55 | #################################### | |
35 | ### CELERY CONFIG #### |
|
56 | ### CELERY CONFIG #### | |
36 | #################################### |
|
57 | #################################### | |
37 | ## Set to true |
|
|||
38 | use_celery = true |
|
|||
39 | broker.host = localhost |
|
|||
40 | broker.vhost = rabbitmqvhost |
|
|||
41 | broker.port = 5672 |
|
|||
42 | broker.user = rabbitmq |
|
|||
43 | broker.password = secret |
|
|||
44 |
|
||||
45 | celery.imports = rhodecode.lib.celerylib.tasks |
|
|||
46 |
|
58 | |||
47 | celery.result.backend = amqp |
|
59 | use_celery = true | |
48 | celery.result.dburi = amqp:// |
|
60 | celery.broker_url = amqp://rcuser:secret@localhost:5672/rhodevhost | |
49 | celery.result.serialier = json |
|
|||
50 |
|
61 | |||
51 | #celery.send.task.error.emails = true |
|
62 | # maximum tasks to execute before worker restart | |
52 |
|
|
63 | celery.max_tasks_per_child = 100 | |
53 |
|
||||
54 | celeryd.concurrency = 2 |
|
|||
55 | #celeryd.log.file = celeryd.log |
|
|||
56 | celeryd.log.level = debug |
|
|||
57 | celeryd.max.tasks.per.child = 1 |
|
|||
58 |
|
64 | |||
59 | ## tasks will never be sent to the queue, but executed locally instead. |
|
65 | ## tasks will never be sent to the queue, but executed locally instead. | |
60 |
celery.always |
|
66 | celery.task_always_eager = false | |
61 |
|
||||
62 |
|
||||
63 | 3. Enable celery, and install `celeryd` process script using the `enable-module`:: |
|
|||
64 |
|
||||
65 | rccontrol enable-module celery {instance-id} |
|
|||
66 |
|
|
67 | ||
67 |
|
|
68 | ||
68 | .. _python: http://www.python.org/ |
|
69 | .. _python: http://www.python.org/ | |
@@ -70,4 +71,5 b' 3. Enable celery, and install `celeryd` ' | |||||
70 | .. _celery: http://celeryproject.org/ |
|
71 | .. _celery: http://celeryproject.org/ | |
71 | .. _rabbitmq: http://www.rabbitmq.com/ |
|
72 | .. _rabbitmq: http://www.rabbitmq.com/ | |
72 | .. _rabbitmq installation: http://docs.celeryproject.org/en/latest/getting-started/brokers/rabbitmq.html |
|
73 | .. _rabbitmq installation: http://docs.celeryproject.org/en/latest/getting-started/brokers/rabbitmq.html | |
|
74 | .. _rabbitmq website installation: http://www.rabbitmq.com/download.html | |||
73 | .. _Celery installation: http://docs.celeryproject.org/en/latest/getting-started/introduction.html#bundles |
|
75 | .. _Celery installation: http://docs.celeryproject.org/en/latest/getting-started/introduction.html#bundles |
General Comments 0
You need to be logged in to leave comments.
Login now