]> git.immae.eu Git - github/wallabag/wallabag.git/blob - docs/en/developer/asynchronous.rst
Reordered documentation
[github/wallabag/wallabag.git] / docs / en / developer / asynchronous.rst
1 Asynchronous tasks
2 ==================
3
4 In order to launch asynchronous tasks (useful for huge imports for example), we can use RabbitMQ or Redis.
5
6 Install RabbitMQ for asynchronous tasks
7 ---------------------------------------
8
9 Requirements
10 ^^^^^^^^^^^^
11
12 You need to have RabbitMQ installed on your server.
13
14 Installation
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
24 Configuration 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
32 Stop RabbitMQ
33 ^^^^^^^^^^^^^
34
35 .. code:: bash
36
37 rabbitmqctl stop
38
39
40 Configure RabbitMQ in wallabag
41 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42
43 Edit 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
52 Enable RabbitMQ in wallabag
53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
54
55 In internal settings, in the **Import** section, enable RabbitMQ (with the value 1).
56
57 Launch RabbitMQ consumer
58 ^^^^^^^^^^^^^^^^^^^^^^^^
59
60 Depending 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
85 Install Redis for asynchronous tasks
86 ------------------------------------
87
88 In order to launch asynchronous tasks (useful for huge imports for example), we can use Redis.
89
90 Requirements
91 ^^^^^^^^^^^^
92
93 You need to have Redis installed on your server.
94
95 Installation
96 ^^^^^^^^^^^^
97
98 .. code:: bash
99
100 apt-get install redis-server
101
102 Launch
103 ^^^^^^
104
105 The server might be already running after installing, if not you can launch it using:
106
107 .. code:: bash
108
109 redis-server
110
111
112 Configure Redis in wallabag
113 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
114
115 Edit 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
122 Enable Redis in wallabag
123 ^^^^^^^^^^^^^^^^^^^^^^^^
124
125 In internal settings, in the **Import** section, enable Redis (with the value 1).
126
127 Launch Redis consumer
128 ^^^^^^^^^^^^^^^^^^^^^
129
130 Depending 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
155 If 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