Skip to content

Using influxDB

Lluís Marquès i Peñaranda edited this page Jun 8, 2020 · 9 revisions

Xatkit can make use of an influx 2.x database instead of the internal mapDB one. This page details how to use it.

Requirements

Setup the influxdb for the Xatkit environment

Run influx setup to create a primary organization and bucket.

If you already have an influxdb instance, consider creating a different bucket/organization for your bots with

influx org create

and

influx bucket create

run influx with influxd --http-bind-address=:XXXX

More info: https://v2.docs.influxdata.com/v2.0/reference/cli/influx/bucket/ and https://v2.docs.influxdata.com/v2.0/reference/cli/influx/org/, also, worth reading: https://v2.docs.influxdata.com/v2.0/reference/cli/influx/

Setting up the bot properties

The bot's properties file will need to specify the following data to make the connection work:

  • Specify to the bot that you want to use influxDB: xatkit.database.model = influxDB
  • Specify the organization and bucket that the bot will have access to, for example: xatkit.influx.bucket = xatbot xatkit.influx.organization = X
  • You will have to tell the bot which is the "token" to get access the given bucket: xatkit.influx.token = yourBucketTokenGoesHere
  • And last, where to find the influxdb instance, to start the connection: xatkit.influx.url = http://localhost:7777

A complete (working) properties file example would look like this:

# Execution file containing the logic of the bot
xatkit.execution.model = src/GreetingsBot.execution

# Resolve alias imports in Execution model
xatkit.libraries.custom.GreetingsBotLib = src/GreetingsBot.intent

# Set a concrete platform to use in place of the ChatPlatform
xatkit.platforms.abstract.ChatPlatform = com.xatkit.plugins.react.platform.ReactPlatform

# Set the server port to use (defaults to 5000)
xatkit.server.port = 5060
xatkit.react.port = 5061

# Xatkit database options:
xatkit.database.model = influxDB
xatkit.influx.token = yourBucketTokenGoesHerebb==
xatkit.influx.bucket = xatbot
xatkit.influx.organization = X
xatkit.influx.url = http://localhost:7777

TL;DR

# Xatkit database options:
xatkit.database.model = influxDB
xatkit.influx.token = yourBucketTokenGoesHerebb==
xatkit.influx.bucket = yourBucket
xatkit.influx.organization = yourOrg
xatkit.influx.url = http://localhost:port # Where the influxDB instance is running

Note: By using influxDB, data WON'T be stored in the internal mapDB instance, which means the bot becomes dependant on the influxDB availability to write/store data

Clone this wiki locally