diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-18 09:28:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-18 09:28:20 +0100 |
commit | 19d401b15c1151bfa6c2364f31cc1eb87e7c99ef (patch) | |
tree | 9c47399f9b1a9ad2228ec365a1fd5e20edc7771f /docs/en/developer/asynchronous.rst | |
parent | 9e0a49e6acf60c3dbf3c479cb36d404239dfda89 (diff) | |
parent | 50540682ffcaa6acf16f3b17cede3da9694c494f (diff) | |
download | wallabag-19d401b15c1151bfa6c2364f31cc1eb87e7c99ef.tar.gz wallabag-19d401b15c1151bfa6c2364f31cc1eb87e7c99ef.tar.zst wallabag-19d401b15c1151bfa6c2364f31cc1eb87e7c99ef.zip |
Merge pull request #2550 from wallabag/reorder-documentation
Reordered documentation
Diffstat (limited to 'docs/en/developer/asynchronous.rst')
-rw-r--r-- | docs/en/developer/asynchronous.rst | 159 |
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 @@ | |||
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 | ||