diff --git a/README.md b/README.md index a130eec..ca33b28 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This stack is also known as the **TIG** stack. The easiest way to test is to use [Docker](https://www.docker.com/). Ensure you have `docker` and `docker-compose` binary installed. -Write your miner address, grafana username and grafana password: +Write your miner address, grafana and influxdb credentials: ``` vi docker/environment @@ -25,14 +25,13 @@ vi docker/environment Then start containers: ``` -docker-compose up +docker-compose up -d ``` ## Going further You should secure [InfluxDB](https://docs.influxdata.com/influxdb/v1.7/administration/security/) by using encryption for -communication, tokens for authentication (one read-only token for Grafana, one write only for Telegraf). The stack -doesn't require Docker. +communication. The stack doesn't require Docker. ## Disclaimer diff --git a/docker-compose.yml b/docker-compose.yml index 846397b..ccb83fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,8 @@ version: "2" services: influxdb: container_name: influxdb + env_file: + - ./docker/environment image: influxdb:1.7.10 ports: - "8083:8083" @@ -32,7 +34,7 @@ services: - ./docker/environment image: telegraf:1.15.4 volumes: - - ./docker/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf + - ./docker/telegraf.conf:/etc/telegraf/telegraf.conf - ./telegraf:/etc/telegraf/telegraf.d links: - "influxdb:influxdb" diff --git a/docker/environment b/docker/environment index b73163d..6889b88 100644 --- a/docker/environment +++ b/docker/environment @@ -1,3 +1,10 @@ MINER_ADDRESS= -GF_SECURITY_ADMIN_USER= +GF_SECURITY_ADMIN_USER=admin GF_SECURITY_ADMIN_PASSWORD= +INFLUXDB_DB=metrics +INFLUXDB_WRITE_USER=telegraf +INFLUXDB_WRITE_USER_PASSWORD= +INFLUXDB_READ_USER=grafana +INFLUXDB_READ_USER_PASSWORD= +INFLUXDB_ADMIN_USER=admin +INFLUXDB_ADMIN_USER_PASSWORD= diff --git a/docker/telegraf.conf b/docker/telegraf.conf index 46b0811..80f677d 100644 --- a/docker/telegraf.conf +++ b/docker/telegraf.conf @@ -13,5 +13,5 @@ omit_hostname = false [[outputs.influxdb]] - database = "metrics" - urls = ["http://influxdb:8086"] + database = "${INFLUXDB_DB}" + urls = ["http://${INFLUXDB_WRITE_USER}:${INFLUXDB_WRITE_USER_PASSWORD}@influxdb:8086"]