Auto create InfluxDB database and users
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
42b97119be
commit
df7141504e
4 changed files with 16 additions and 8 deletions
|
@ -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
|
The easiest way to test is to use [Docker](https://www.docker.com/). Ensure you have `docker` and
|
||||||
`docker-compose` binary installed.
|
`docker-compose` binary installed.
|
||||||
|
|
||||||
Write your miner address, grafana username and grafana password:
|
Write your miner address, grafana and influxdb credentials:
|
||||||
|
|
||||||
```
|
```
|
||||||
vi docker/environment
|
vi docker/environment
|
||||||
|
@ -25,14 +25,13 @@ vi docker/environment
|
||||||
Then start containers:
|
Then start containers:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose up
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
## Going further
|
## Going further
|
||||||
|
|
||||||
You should secure [InfluxDB](https://docs.influxdata.com/influxdb/v1.7/administration/security/) by using encryption for
|
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
|
communication. The stack doesn't require Docker.
|
||||||
doesn't require Docker.
|
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ version: "2"
|
||||||
services:
|
services:
|
||||||
influxdb:
|
influxdb:
|
||||||
container_name: influxdb
|
container_name: influxdb
|
||||||
|
env_file:
|
||||||
|
- ./docker/environment
|
||||||
image: influxdb:1.7.10
|
image: influxdb:1.7.10
|
||||||
ports:
|
ports:
|
||||||
- "8083:8083"
|
- "8083:8083"
|
||||||
|
@ -32,7 +34,7 @@ services:
|
||||||
- ./docker/environment
|
- ./docker/environment
|
||||||
image: telegraf:1.15.4
|
image: telegraf:1.15.4
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
|
- ./docker/telegraf.conf:/etc/telegraf/telegraf.conf
|
||||||
- ./telegraf:/etc/telegraf/telegraf.d
|
- ./telegraf:/etc/telegraf/telegraf.d
|
||||||
links:
|
links:
|
||||||
- "influxdb:influxdb"
|
- "influxdb:influxdb"
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
MINER_ADDRESS=
|
MINER_ADDRESS=
|
||||||
GF_SECURITY_ADMIN_USER=
|
GF_SECURITY_ADMIN_USER=admin
|
||||||
GF_SECURITY_ADMIN_PASSWORD=
|
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=
|
||||||
|
|
|
@ -13,5 +13,5 @@
|
||||||
omit_hostname = false
|
omit_hostname = false
|
||||||
|
|
||||||
[[outputs.influxdb]]
|
[[outputs.influxdb]]
|
||||||
database = "metrics"
|
database = "${INFLUXDB_DB}"
|
||||||
urls = ["http://influxdb:8086"]
|
urls = ["http://${INFLUXDB_WRITE_USER}:${INFLUXDB_WRITE_USER_PASSWORD}@influxdb:8086"]
|
||||||
|
|
Reference in a new issue