From 275e41cbc08d9d8bcf2350bb8f7ecc641b18c8d9 Mon Sep 17 00:00:00 2001 From: Niko Abeler Date: Sat, 4 Feb 2023 23:12:04 +0100 Subject: [PATCH] influx setup --- .gitignore | 3 +++ docker-compose.yml | 25 ++++++++++++++++++++++++- influx/scripts/create_tokens.sh | 9 +++++++++ tokens/.gitkeep | 0 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100755 influx/scripts/create_tokens.sh create mode 100644 tokens/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4607ece --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +influx-data/ +tokens/*.txt +passwords* \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ee51f2e..fb61bdf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,4 +12,27 @@ services: volumes: - ./rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro - ./rabbitmq/definitions.json:/etc/rabbitmq/definitions.json:ro - - ./rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins:rw \ No newline at end of file + - ./rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins:rw + influx: + hostname: influx + image: influxdb:2.6 + ports: + - "24005:8086" + volumes: + - ./influx-data:/var/lib/influxdb2:rw + - ./influx/scripts:/docker-entrypoint-initdb.d + - ./tokens:/tokens:rw + environment: + - DOCKER_INFLUXDB_INIT_MODE=setup + - DOCKER_INFLUXDB_INIT_USERNAME=admin + - DOCKER_INFLUXDB_INIT_PASSWORD=admin1234 + - DOCKER_INFLUXDB_INIT_ORG=home + - DOCKER_INFLUXDB_INIT_BUCKET=sensor + gatherer: + hostname: gatherer + volumes: + - ./tokens:/tokens:ro + depends_on: + - rabbitmq + - influx + diff --git a/influx/scripts/create_tokens.sh b/influx/scripts/create_tokens.sh new file mode 100755 index 0000000..8768b6c --- /dev/null +++ b/influx/scripts/create_tokens.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +echo "Creating tokens for ${DOCKER_INFLUXDB_INIT_ORG} organization" + influx auth create \ + --org ${DOCKER_INFLUXDB_INIT_ORG} \ + --read-buckets \ + --write-buckets | tail -1 | awk '{print $2}' > /tokens/read_write.txt +echo "Read/Write token created" diff --git a/tokens/.gitkeep b/tokens/.gitkeep new file mode 100644 index 0000000..e69de29