From 7efc17a2ba11681985a0c8901e39dd50daae3bfe Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Mon, 30 Nov 2020 13:19:59 -0600 Subject: influx password --- .gitignore | 2 +- docker-compose.yml | 8 ++++++-- influxdb.env.example | 8 ++++++++ write-influx/write_influx.py | 4 ++-- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 influxdb.env.example diff --git a/.gitignore b/.gitignore index c2de89b..9333c69 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/db +influxdb.env diff --git a/docker-compose.yml b/docker-compose.yml index d5b0812..78de83a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,19 +11,23 @@ services: - 8086:8086 volumes: - influxdb:/var/lib/influxdb + env_file: + - ./influxdb.env write-influx: build: ./write-influx depends_on: - broker - db + env_file: + - ./influxdb.env web: build: ./web ports: - - 80:80 + - 8080:80 depends_on: - broker - db - write-influx volumes: - influxdb: \ No newline at end of file + influxdb: diff --git a/influxdb.env.example b/influxdb.env.example new file mode 100644 index 0000000..7e5ad8e --- /dev/null +++ b/influxdb.env.example @@ -0,0 +1,8 @@ +INFLUXDB_DB=homie +INFLUXDB_HTTP_AUTH_ENABLED=true + +INFLUXDB_ADMIN_USER=admin +INFLUXDB_ADMIN_PASSWORD=supersecurepassword + +INFLUXDB_READ_USER=user +INFLUXDB_READ_USER_PASSWORD=xtssxgxy diff --git a/write-influx/write_influx.py b/write-influx/write_influx.py index ccfb15d..b558b84 100644 --- a/write-influx/write_influx.py +++ b/write-influx/write_influx.py @@ -68,8 +68,8 @@ def on_message(client, userdata, msg): influx_client = InfluxDBClient(host="db", port=8086, - username="root", - password="root", + username="admin", + password=os.environ["INFLUXDB_ADMIN_PASSWORD"], database="homie") influx_client.create_database("homie") -- cgit v1.2.3