DOC: deviceatlas: update to be in line with the v3 api.

Reflecting here all the changes, no longer need to cater with
the legacy v2 neither.
This commit is contained in:
David Carlier 2024-01-25 09:09:07 +00:00 committed by Willy Tarreau
parent 9cfd6c8f8e
commit f960cde786

View File

@ -3,15 +3,20 @@ DeviceAtlas Device Detection
In order to add DeviceAtlas Device Detection support, you would need to download In order to add DeviceAtlas Device Detection support, you would need to download
the API source code from https://deviceatlas.com/deviceatlas-haproxy-module. the API source code from https://deviceatlas.com/deviceatlas-haproxy-module.
The build supports the USE_PCRE and USE_PCRE2 options. Once extracted : Once extracted :
$ make TARGET=<target> USE_PCRE=1 (or USE_PCRE2=1) USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder> $ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder>
Optionally DEVICEATLAS_INC and DEVICEATLAS_LIB may be set to override the path Optionally DEVICEATLAS_INC and DEVICEATLAS_LIB may be set to override the path
to the include files and libraries respectively if they're not in the source to the include files and libraries respectively if they're not in the source
directory. However, if the API had been installed beforehand, DEVICEATLAS_SRC directory. Also, in the case the api cache support is not needed and/or a C++ toolchain
can be omitted. Note that the DeviceAtlas C API version supported is the 2.4.0 could not be used, DEVICEATLAS_NOCACHE is available.
at minimum.
$ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder> DEVICEATLAS_NOCACHE=1
However, if the API had been installed beforehand, DEVICEATLAS_SRC
can be omitted. Note that the DeviceAtlas C API version supported is from the 3.x
releases serie (3.2.1 minimum recommended).
For HAProxy developers who need to verify that their changes didn't accidentally For HAProxy developers who need to verify that their changes didn't accidentally
break the DeviceAtlas code, it is possible to build a dummy library provided in break the DeviceAtlas code, it is possible to build a dummy library provided in
@ -20,7 +25,7 @@ full library. This will not provide the full functionalities, it will just allow
haproxy to start with a deviceatlas configuration, which generally is enough to haproxy to start with a deviceatlas configuration, which generally is enough to
validate API changes : validate API changes :
$ make TARGET=<target> USE_PCRE=1 USE_DEVICEATLAS=1 DEVICEATLAS_SRC=$PWD/addons/deviceatlas/dummy $ make TARGET=<target> USE_DEVICEATLAS=1 DEVICEATLAS_SRC=$PWD/addons/deviceatlas/dummy
These are supported DeviceAtlas directives (see doc/configuration.txt) : These are supported DeviceAtlas directives (see doc/configuration.txt) :
- deviceatlas-json-file <path to the DeviceAtlas JSON data file>. - deviceatlas-json-file <path to the DeviceAtlas JSON data file>.
@ -28,6 +33,7 @@ These are supported DeviceAtlas directives (see doc/configuration.txt) :
the API, 0 by default). the API, 0 by default).
- deviceatlas-property-separator <character> (character used to separate the - deviceatlas-property-separator <character> (character used to separate the
properties produced by the API, | by default). properties produced by the API, | by default).
- deviceatlas-cache-size <number> (number of cache entries, 0 by default).
Sample configuration : Sample configuration :
@ -64,18 +70,8 @@ Single HTTP header
acl device_type_tablet req.fhdr(User-Agent),da-csv-conv(primaryHardwareType) "Tablet" acl device_type_tablet req.fhdr(User-Agent),da-csv-conv(primaryHardwareType) "Tablet"
Optionally a JSON download scheduler is provided to allow a data file being Note that the JSON download scheduler is now part of the API's package, it is recommended
fetched automatically in a daily basis without restarting HAProxy : to read its documentation. Note it needs to be started before HAProxy.
$ cd addons/deviceatlas && make [DEVICEATLAS_SRC=<path to the API root folder>]
Similarly, if the DeviceAtlas API is installed, DEVICEATLAS_SRC can be omitted.
$ ./dadwsch -u JSON data file URL e.g. "https://deviceatlas.com/getJSON?licencekey=<your licence key>&format=zip&data=my&index=web" \
[-p download directory path /tmp by default] \
[-d scheduled hour of download, hour when the service is launched by default]
Noted it needs to be started before HAProxy.
Please find more information about DeviceAtlas and the detection methods at Please find more information about DeviceAtlas and the detection methods at