This example illustrates various parameters that can be adjusted when using the on-premise IP intelligence engine, and controls when a new data file is sought and when it is loaded by the IP intelligence software.
This example illustrates various parameters that can be adjusted when using the on-premise IP intelligence engine, and controls when a new data file is sought and when it is loaded by the IP intelligence software. Three main aspects are demonstrated:
- Update on Start-Up
- Filesystem Watcher
- Daily auto-update
License Key
Updating the data file needs a 51Degrees licence key for the Enterprise data file. Without one, the example shows the free ASN data file and says where to ask for a key. Contact us for a key at /contact-us?utm_source=code&utm_medium=example&utm_campaign=51degrees-node&utm_content=fiftyone.ipintelligence.onpremise-examples-onpremise-updatedatafile-console-updatedatafile.js&utm_term=header
Data Files
You can find out more about data files, licenses etc. at our (FAQ page)[/resources/faqs?utm_source=code&utm_medium=example&utm_campaign=51degrees-node&utm_content=fiftyone.ipintelligence.onpremise-examples-onpremise-updatedatafile-console-updatedatafile.js&utm_term=header]
Enterprise Data File
Enterprise (fully-featured) data files are typically released by 51Degrees four days a week (Mon-Thu) and on-premise deployments can fetch and download those files automatically. Equally, customers may choose to download the files themselves and move them into place to be detected by the 51Degrees filesystem watcher.
Lite Data File
Lite data files (free-to-use, with a small number of Properties, no license key required) are created regularly and cannot be updated using auto-update, they may be downloaded with the scripts in the (data repository)[href=https://github.com/51Degrees/data], which is included with source distributions of this software.
Update on Start-Up
You can configure the pipeline builder to download an Enterprise data file on start-up.
Pre-Requisites
- a license key
- a file location for the download
- this may be an existing file - which will be overwritten
- or if it does not exist must end in ".ipi" and must be in an existing directory
Configuration
- the pipeline must be configured to use a temp file createTempDataCopy: true
- a DataFileUpdateService must be supplied dataUpdateService.on('updateComplete', function(status, dataFile) {// do something with the result.});...dataFileUpdateService: dataUpdateService
- update on start-up must be specified, which will cause pipeline creation to block until a file is downloaded updateOnStart: true
File System Watcher
You can configure the pipeline builder to watch for changes to the currently loaded IP intelligence data file, and to replace the file currently in use with the new one. This is useful, for example, if you wish to download and update the IP intelligence file "manually" - i.e. you would download it then drop it into place with the same path as the currently loaded file. That location is checked periodically (by default every 30 mins) and this frequency can be configured.
Pre-Requisites
- a license key
- the file location of the existing file
Configuration
- the pipeline must be configured to use a temp file createTempDataCopy: true
- a DataFileUpdateService must be supplied dataUpdateService.on('updateComplete', function(status, dataFile) {// do something with the result.});...dataFileUpdateService: dataUpdateService
- configure the frequency with which the location is checked, in seconds (10 mins as shown) pollingInterval: 10*60
Daily auto-update
Enterprise data files are usually created four times a week. Each data file contains a date for when the next data file is expected. You can configure the pipeline so that it starts looking for a newer data file after that time, by connecting to the 51Degrees distributor to see if an update is available. If one is, then it is downloaded and will replace the existing IP intelligence file, which is currently in use.
Pre-Requisites
- a license key
- the file location of the existing file
Configuration
- the pipeline must be configured to use a temp file createTempDataCopy: true
- a DataFileUpdateService must be supplied dataUpdateService.on('updateComplete', function(status, dataFile) {// do something with the result.});...dataFileUpdateService: dataUpdateService
- Set the frequency in seconds that the pipeline should check for updates to data files. A recommended polling interval in a production environment is around 30 minutes. pollingInterval: 10*60
- Set the max amount of time in seconds that should be added to the polling interval. This is useful in datacenter applications where multiple instances may be polling for updates at the same time. A recommended ammount in production environments is 600 seconds. updateTimeMaximumRandomisation: 10*60
Location
This example is available in full on GitHub.
Required npm Dependencies:
- fiftyone.pipeline.core
- fiftyone.pipeline.engines
- fiftyone.pipeline.engines.fiftyone
- fiftyone.ipintelligence.onpremise
