aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/en/developer/asynchronous.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/en/developer/asynchronous.rst')
-rw-r--r--docs/en/developer/asynchronous.rst159
1 files changed, 159 insertions, 0 deletions
diff --git a/docs/en/developer/asynchronous.rst b/docs/en/developer/asynchronous.rst
new file mode 100644
index 00000000..6a991cf6
--- /dev/null
+++ b/docs/en/developer/asynchronous.rst
@@ -0,0 +1,159 @@
1Asynchronous tasks
2==================
3
4In order to launch asynchronous tasks (useful for huge imports for example), we can use RabbitMQ or Redis.
5
6Install RabbitMQ for asynchronous tasks
7---------------------------------------
8
9Requirements
10^^^^^^^^^^^^
11
12You need to have RabbitMQ installed on your server.
13
14Installation
15^^^^^^^^^^^^
16
17.. code:: bash
18
19 wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
20 apt-key add rabbitmq-signing-key-public.asc
21 apt-get update
22 apt-get install rabbitmq-server
23
24Configuration and launch
25^^^^^^^^^^^^^^^^^^^^^^^^
26
27.. code:: bash
28
29 rabbitmq-plugins enable rabbitmq_management # (useful to have a web interface, available at http://localhost:15672/ (guest/guest)
30 rabbitmq-server -detached
31
32Stop RabbitMQ
33^^^^^^^^^^^^^
34
35.. code:: bash
36
37 rabbitmqctl stop
38
39
40Configure RabbitMQ in wallabag
41^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42
43Edit your ``app/config/parameters.yml`` file to edit RabbitMQ configuration. The default one should be ok:
44
45.. code:: yaml
46
47 rabbitmq_host: localhost
48 rabbitmq_port: 5672
49 rabbitmq_user: guest
50 rabbitmq_password: guest
51
52Enable RabbitMQ in wallabag
53^^^^^^^^^^^^^^^^^^^^^^^^^^^
54
55In internal settings, in the **Import** section, enable RabbitMQ (with the value 1).
56
57Launch RabbitMQ consumer
58^^^^^^^^^^^^^^^^^^^^^^^^
59
60Depending on which service you want to import from you need to enable one (or many if you want to support many) cron job:
61
62.. code:: bash
63
64 # for Pocket import
65 bin/console rabbitmq:consumer -e=prod import_pocket -w
66
67 # for Readability import
68 bin/console rabbitmq:consumer -e=prod import_readability -w
69
70 # for Instapaper import
71 bin/console rabbitmq:consumer -e=prod import_instapaper -w
72
73 # for wallabag v1 import
74 bin/console rabbitmq:consumer -e=prod import_wallabag_v1 -w
75
76 # for wallabag v2 import
77 bin/console rabbitmq:consumer -e=prod import_wallabag_v2 -w
78
79 # for Firefox import
80 bin/console rabbitmq:consumer -e=prod import_firefox -w
81
82 # for Chrome import
83 bin/console rabbitmq:consumer -e=prod import_chrome -w
84
85Install Redis for asynchronous tasks
86------------------------------------
87
88In order to launch asynchronous tasks (useful for huge imports for example), we can use Redis.
89
90Requirements
91^^^^^^^^^^^^
92
93You need to have Redis installed on your server.
94
95Installation
96^^^^^^^^^^^^
97
98.. code:: bash
99
100 apt-get install redis-server
101
102Launch
103^^^^^^
104
105The server might be already running after installing, if not you can launch it using:
106
107.. code:: bash
108
109 redis-server
110
111
112Configure Redis in wallabag
113^^^^^^^^^^^^^^^^^^^^^^^^^^^
114
115Edit your ``app/config/parameters.yml`` file to edit Redis configuration. The default one should be ok:
116
117.. code:: yaml
118
119 redis_host: localhost
120 redis_port: 6379
121
122Enable Redis in wallabag
123^^^^^^^^^^^^^^^^^^^^^^^^
124
125In internal settings, in the **Import** section, enable Redis (with the value 1).
126
127Launch Redis consumer
128^^^^^^^^^^^^^^^^^^^^^
129
130Depending on which service you want to import from you need to enable one (or many if you want to support many) cron job:
131
132.. code:: bash
133
134 # for Pocket import
135 bin/console wallabag:import:redis-worker -e=prod pocket -vv >> /path/to/wallabag/var/logs/redis-pocket.log
136
137 # for Readability import
138 bin/console wallabag:import:redis-worker -e=prod readability -vv >> /path/to/wallabag/var/logs/redis-readability.log
139
140 # for Instapaper import
141 bin/console wallabag:import:redis-worker -e=prod instapaper -vv >> /path/to/wallabag/var/logs/redis-instapaper.log
142
143 # for wallabag v1 import
144 bin/console wallabag:import:redis-worker -e=prod wallabag_v1 -vv >> /path/to/wallabag/var/logs/redis-wallabag_v1.log
145
146 # for wallabag v2 import
147 bin/console wallabag:import:redis-worker -e=prod wallabag_v2 -vv >> /path/to/wallabag/var/logs/redis-wallabag_v2.log
148
149 # for Firefox import
150 bin/console wallabag:import:redis-worker -e=prod firefox -vv >> /path/to/wallabag/var/logs/redis-firefox.log
151
152 # for Chrome import
153 bin/console wallabag:import:redis-worker -e=prod instapaper -vv >> /path/to/wallabag/var/logs/redis-chrome.log
154
155If you want to launch the import only for some messages and not all, you can specify this number (here 12) and the worker will stop right after the 12th message :
156
157.. code:: bash
158
159 bin/console wallabag:import:redis-worker -e=prod pocket -vv --maxIterations=12