forked from matteoredaelli/ebot
-
Notifications
You must be signed in to change notification settings - Fork 4
/
sys.config
349 lines (312 loc) · 13.6 KB
/
sys.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
%% -*- mode: erlang -*-
[
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SASL config
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{sasl, [
{sasl_error_logger, {file, "priv/log/sasl-error.log"}},
{errlog_type, error},
{error_logger_mf_dir, "priv/log/sasl"}, % Log directory
{error_logger_mf_maxbytes, 10485760}, % 10 MB max file size
{error_logger_mf_maxfiles, 5} % 5 files max
]
},
{ebot, [
%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%% see EBOT options in ebot.app and add your changes here!
%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CACHE
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DATABASE
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% you need to set the db backend (COUCHDB or RIAK)
%% in src/ebot.hrl file
{db_hostname, "127.0.0.1"},
%% COUCHDB
%%{db_port, 5984},
%% RIAK
{db_port, 8087},
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MQ
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% WEB
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% -------------------------------------------------------------------------------------------------
%% normalize_url_list
%% -------------------------------------------------------------------------------------------------
%%
%% {normalize_url_list, [{RE, NormalizeUrlOptions},..]}
%%
%% options of normalize_url :
%% add_final_slash
%% to_lower_case : urls are case insensive and some web pages have links with some uppercase letters..
%% without_internal_links
%% without_queries,
%% {max_depth, 2}
%% the url path will be truncated to a max_depth path
%% http://www.redaelli.org/matteo/blog/a/ -> http://www.redaelli.org/matteo/blog/
%% should be the same as "tot_new_urls_queues" in ebot_mq.conf
%% you should also start at least one crawler for depth in [0,max_depth]. see "worker_pools" in this file
%% (TODO) {remove_filename, false}
{normalize_url,
[
%% {\\.com/",
%% [
%% {plugin, ebot_url_util, url_domain},
%% add_final_slash,
%% to_lower_case
%% ]
%% },
%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%% default setting for normalize_url
%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%% rememeber, at least one regexp must match all urls
%% "." should be used
{".",
[
%% -------------------------------------------------------------------
%% {plugin, Module, Function/1}
%% -------------------------------------------------------------------
%% you can call a custom module:function(Url) for normaling urls
%% are you interested only in domain homepages?
%% {plugin, ebot_url_util, url_domain},
%% removing blank characters at the begin and end of url string:
%% yes, sometime happens!
strip,
%% -------------------------------------------------------------------
%% {replace_string, [{from,to},..]}
%% -------------------------------------------------------------------
{replace_string, [
%% http://www.gettyre.it/motoweb/XXX;jsessionid=250485C.sae_1
{";[A-Za-z0-9]+=[^&;?]+", ""},
%% some sites have newlines in url links:
%% see http://opensource.linux-mirror.org/index.php
%% TODO maybe it still doesn t work
{"\n",""},
%% http://github.com/dizzyd/ibrowse
{""\$",""}
]},
%% -------------------------------------------------------------------
%% add_final_slash
%% -------------------------------------------------------------------
%% example: http://www.redaelli.org => http://www.redaelli.org/
add_final_slash,
%% -------------------------------------------------------------------
%% {max_depth, 3}
%% -------------------------------------------------------------------
%% paths > max_depth are truncated to max_depth
%% for instance, if {max_depth,0}
%% http://www.redaelli.org/matteo/ => http://www.redaelli.org/
{max_depth, 4},
%% -------------------------------------------------------------------
%% to_lower_case
%% -------------------------------------------------------------------
%% for some web servers web urls are case insensitive.
%% it is safer to lowecase all urls in order to avoid duplicates in the database
%% {plugin, string, to_lower},
%% -------------------------------------------------------------------
%% without_internal_links
%% -------------------------------------------------------------------
%% internal links (#) are removed
without_internal_links,
%% -------------------------------------------------------------------
%% without_queries
%% -------------------------------------------------------------------
%% parameters, like ?a=1&b=3, are removed from urls
without_queries
]}%% end default
] % end list of {regexp, ListOptions}
}, %% end normalize_url
%% -------------------------------------------------------------------------------------------------
%% tobe_saved_headers
%% -------------------------------------------------------------------------------------------------
%% headers (if exist) that will be saved in the database
{tobe_saved_headers,
[
<<"content-length">>,
<<"content-type">>,
<<"server">>,
<<"x-powered-by">>
]},
%% -------------------------------------------------------------------------------------------------
%% is_valid_image
%% -------------------------------------------------------------------------------------------------
%%
%% this option is useful to check links before converting them to absolute urls
%% when they are relative links
%%
{is_valid_image,
[
%% the url will be analyzed if ALL regexps will be satisfied
{validate_all_url_regexps, [
{nomatch, "\.bmp$"},
{nomatch, "\.raw$"}
]
}
]
},
%% -------------------------------------------------------------------------------------------------
%% is_valid_link
%% -------------------------------------------------------------------------------------------------
%%
%% this option is useful to check links before converting them to absolute urls
%% when they are relative links
%%
{is_valid_link,
[
%% the url will be analyzed if ALL regexps will be satisfied
{validate_all_url_regexps, [
{nomatch, "feed:"},
{nomatch, "ftp:"},
{nomatch, "javascript:"},
{nomatch, "mailto:"},
{nomatch, "news:"}
]
}
]
},
%% -------------------------------------------------------------------------------------------------
%% is_valid_url
%% -------------------------------------------------------------------------------------------------
%%
{is_valid_url,
[
%% you can call your custom function that wull return true or false
%% {plugin, Module, function},
%% silly function : {plugin, erlang, is_list},
%% an url is valid if its mime type satify any of the following regexps
{validate_any_mime_regexps, [
{match, "^text/"}
%%,{match, "^image/"}
]
},
%% the url will be analyzed if ALL the following regexps will be satisfied
{validate_all_url_regexps, [
{match, "^https?://"},
%% {nomatch, "^https"},
{nomatch, "//.+//"},
{nomatch, "/bugs/"},
{nomatch, "viewcvs"},
%% Skipping Apache.org urls
{nomatch, "\\.apache\\..+/dist/"},
{nomatch, "/snapshots/"},
{nomatch, "^http://mail-archives"},
{nomatch, "bugs.+/.+"},
%% apache mirror sites.. TODO
{nomatch, "apache\\.fastbull\\.org/.+"},
%% Skipping unwanted files
{nomatch, "\\.deb$"},
{nomatch, "\\.git$"},
{nomatch, "\\.tgz$"},
{nomatch, "\\.jar$"},
{nomatch, "\\.rpm$"},
{nomatch, "\\.tar$"},
{nomatch, "\\.gz$"},
{nomatch, "\\.makefile$"},
{nomatch, "\\.Makefile$"},
% Skipping CVS repositories
{nomatch, "/cvs/\\."},
%% Skipping Github unseful pages
{nomatch, "github\\.+/issues"},
{nomatch, "gist\\.github\\.com"},
%% the page gives incomplete header
{nomatch, "svn\\.github\\.com"},
%% Skipping Gitorious unseful pages
{nomatch, "git.+/merge_requests/"},
{nomatch, "git.+/commits/"},
{nomatch, "git.+/trees/"},
%% Skipping Git repositories
{nomatch, "git.+/commit/"},
{nomatch, "git.+/tree/"},
%% Skipping HG repositories
{nomatch, "/changeset/"},
%% Skipping SVN repositories
{nomatch, "svn.+/viewvc/.+/"},
{nomatch, "/svn[\\./]"},
{nomatch, "/branches"},
{nomatch, "/trunk"},
{nomatch, "/tags"}
]
}, %% end of validate_all_regexps
%% The url will be analyzed if ANY of the following regexps will be satisfied.
%% Here you should put the list of web sites to be visited by ebot.
{validate_any_url_regexps, [
%% at least one regexp must be defined
%% {match,"."},
%{match, "redaelli\\.org"},
%% Opensource projects
%{match, "apache\\.org"},
%{match, "freshmeat\\.net"},
%{match, "github\\.com"},
%{match, "code\\.google\\.com"},
%{match, "sourceforge\\.net"},
%{match, "ohloh\\.net"},
%{match, "bitbucket\\.org"},
%{match, "www\\.gettyre\\.it"},
%{match, "www\\.tyres-pneus-online\\.co\\.uk"}
{match, "linux\\.org\\.ru"},
{match, "newsru\\.com"}
]
}
] %% end list of options
} %% end is_valid_url
,
%% -------------------------------------------------------------------------------------------------
%% obsolete_urls_after_day
%% -------------------------------------------------------------------------------------------------
%%
%% after how many days, an url that is stored in the DB will become obsolete
{obsolete_urls_after_days, 10},
%% -------------------------------------------------------------------------------------------------
%% save_referrals
%% -------------------------------------------------------------------------------------------------
%%
%% (cumulable) values: external, domain, subdomain
%%
%% domain: means same domain,
%% es: true <= http://www.redaelli.org/a and http://www.redaelli.org/
%% false <= http://www.redaelli.org/a and http://redaelli.org/
%%
%% subdomain: means same main domain but not same domain,
%% es: false <= http://www.redaelli.org/a and http://www.redaelli.org/
%% true <= http://www.redaelli.org/a and http://redaelli.org/
%%
%% external: means samenot same domain and not same main domain
%% es: false <= http://www.redaelli.org/a and http://www.redaelli.org/
%% false <= http://www.redaelli.org/a and http://redaelli.org/
%% true <= http://www.redaelli.org/a and http://matteoredaelli.wordpress.com/
{save_referrals, [external]},
%% -------------------------------------------------------------------------------------------------
%% workers_pool
%% -------------------------------------------------------------------------------------------------
%%
%% how many crawler threads will be started for each candidated url queue/depth
%% {worker_pools, [{0,3},{1,2},{2,1}]} means
%% 3 crawlers will analyze urls got from AMQP queue ebot.new.0 that countains urls with depth==0
%% (ex. http://www.redaelli.org, http://www.redaelli.org/index.html)
%% 2 crawlers will analyze urls got from AMQP queue ebot.new.1 that countains urls with depth==1
%% (ex. http://www.redaelli.org/matteo/, http://www.redaelli.org/matteo/index.html)
%% 1 crawlers will analyze urls got from AMQP queue ebot.new.2 that countains urls with depth==2
%%{workers_pool, [{0,4}, {1,2}, {2,1}] },
{workers_pool, [{0,2}, {1,2}, {2,2}, {3,2}, {4,2} ] },
%% -------------------------------------------------------------------------------------------------
%% start_workers_at_boot
%% -------------------------------------------------------------------------------------------------
%%
%% are the crawlers started automatically at boot time?
{start_workers_at_boot, true},
%% -------------------------------------------------------------------------------------------------
%% workers_sleep_time
%% -------------------------------------------------------------------------------------------------
%%
%% how many milliseconds will each crawler sleep between two url crawls?
%% this option is useful in order to avoid heavy workloads for the visited websites
%% and for the ebot system if the hardware is not enough powerful
{workers_sleep_time, 2000}
]
}
].