1
0
Fork 0

Auto create InfluxDB database and users

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-02-02 12:38:47 +01:00
parent 42b97119be
commit df7141504e
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
4 changed files with 16 additions and 8 deletions

View file

@ -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

View file

@ -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"

View file

@ -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=

View file

@ -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"]