This is a side/skundworks project focused on data exploration for IOx-based InfluxDB products, currently:
- InfluxDB Cloud Serverles
- InfluxDB Cloud Dedicated
It current allows you to pass in a list of databases, and then shows the data in a treeview. There is sql editor in the UI, but it isn't hooked up to anything yet.
My goal for this project is that any developer can work on it. As such, I keep it simple:
- The backend is a Flask (i.e. Python server).
- The front end uses JQuery and web controls built on JQuery, but no complicated frameworks, and especially no "toolchains", etc...
- The server is stateless (with the obvious exception of start up settings). That means any state for the convenience of the user should reside in the client code, and that should be optional. This means that the server knows how to query the database, it doesn't know about users, user management, or anything similar. The only page it knows how to render is
index.html
.
My goal is that anyone can read through the code, and be able to easily fix it or change it to suit their needs.
Rick's Explorer uses environment variables to configure itself at startup.
The app runs on port 5002.
- INFLUXDB_DATABASES - a list of databases to display, comma separated
- INFLUXDB_HOST - the host of the influxDB instance. should be like
us-east-1-2.aws.cloud2.influxdata.com
(no https://) - INFLUXDB_TOKEN - A token that can read the databases supplied in the list
Here is an example of running the python server directly with just the required envars:
$ INFLUXDB_DATABASES="database1,database2" \
INFLUXDB_HOST="host_name" \
INFLUXDB_TOKEN="token_that_can_read_the_databases" \
python3 app.py
- APP_TITLE: Sets the text at the top of the page and the browser tab title
- TAG_VALUE_RANGE_START: When expanding the treeview, this determines how far back in time to check for data for the tag values. If you are writing a lot of data, retrieving tag values can take a long time because by default InfluxDB may scan a lot of rows. Alternatively, if you are writing a small amount of data and haven't written in a long time, the app might not find any tag values. Send in a time value that InfluxQL understands, for example "10m".
- MAX_ROWS: Sets the maximum number of rows that the server will return to the UI. Defaults to 100,000.
- PORT: Choose the port on which the application will run. Defaults to 5002.
Here is an example of running the python server with the optional envars:
$ INFLUXDB_DATABASES="database1,database2" \
INFLUXDB_HOST="host_name" \
INFLUXDB_TOKEN="token_that_can_read_the_databases" \
APP_TITLE="My Custom Title" \
TAG_VALUE_RANGE_START="10m" \
python3 app.py
$ docker build -t ricks-explorer .
$ docker run -p 5002:5002 -e INFLUXDB_DATABASES="database1,database2" \
-e INFLUXDB_HOST="xxxxx.a.influxdb.io" \
-e INFLUXDB_TOKEN="token_that_can_read_the_databases" \
-d ricks-explorer
See the Docker registry
$ docker run -p 5002:5002 -e INFLUXDB_DATABASES="database1,database2" \
-e INFLUXDB_HOST="xxxxx.a.influxdb.io" \
-e INFLUXDB_TOKEN="token_that_can_read_the_databases" \
-d rickspencer3/ricks-explorer