1
0
Fork 0

Add Docker instructions

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-02-01 17:34:27 +01:00
parent 20f88988fd
commit 42b97119be
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
5 changed files with 98 additions and 10 deletions

View file

@ -11,6 +11,29 @@ Dashboards rely on the following softwares:
This stack is also known as the **TIG** stack.
## Quickstart
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:
```
vi docker/environment
```
Then start containers:
```
docker-compose up
```
## 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.
## Disclaimer
Telegraf is able to make API call on thrid-party services. Please read terms of service before going further. The

45
docker-compose.yml Normal file
View file

@ -0,0 +1,45 @@
---
version: "2"
services:
influxdb:
container_name: influxdb
image: influxdb:1.7.10
ports:
- "8083:8083"
- "8086:8086"
volumes:
- influxdb-storage:/var/lib/influxdb
restart: always
grafana:
container_name: grafana
env_file:
- ./docker/environment
image: grafana/grafana:7.3.7
volumes:
- grafana-storage:/var/lib/grafana
user: "472:472"
ports:
- "3000:3000"
links:
- "influxdb:influxdb"
restart: always
telegraf:
container_name: telegraf
entrypoint: telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
env_file:
- ./docker/environment
image: telegraf:1.15.4
volumes:
- ./docker/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
- ./telegraf:/etc/telegraf/telegraf.d
links:
- "influxdb:influxdb"
restart: always
volumes:
influxdb-storage:
driver: local
grafana-storage:
driver: local

3
docker/environment Normal file
View file

@ -0,0 +1,3 @@
MINER_ADDRESS=
GF_SECURITY_ADMIN_USER=
GF_SECURITY_ADMIN_PASSWORD=

17
docker/telegraf.conf Normal file
View file

@ -0,0 +1,17 @@
[global_tags]
[agent]
interval = "60s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "60s"
flush_jitter = "0s"
precision = ""
hostname = "docker"
omit_hostname = false
[[outputs.influxdb]]
database = "metrics"
urls = ["http://influxdb:8086"]

View file

@ -1,45 +1,45 @@
[[inputs.http]]
name_override = "flexpool_balance"
urls = ["https://flexpool.io/api/v1/miner/MINER_ADDRESS/balance"]
urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/balance"]
data_format = "json"
tagexclude = ["url"]
[inputs.http.tags]
miner = "MINER_ADDRESS"
miner = "${MINER_ADDRESS}"
[[inputs.http]]
name_override = "flexpool_stats"
urls = ["https://flexpool.io/api/v1/miner/MINER_ADDRESS/stats"]
urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/stats"]
data_format = "json"
fieldpass = ["*hashrate", "*shares"]
tagexclude = ["url"]
json_query = "result"
[inputs.http.tags]
miner = "MINER_ADDRESS"
miner = "${MINER_ADDRESS}"
[[inputs.http]]
name_override = "flexpool_workers"
urls = ["https://flexpool.io/api/v1/miner/MINER_ADDRESS/workers"]
urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/workers"]
data_format = "json"
tagexclude = ["url"]
fieldpass = ["*hashrate", "*shares"]
tag_keys = ["name"]
json_query = "result"
[inputs.http.tags]
miner = "MINER_ADDRESS"
miner = "${MINER_ADDRESS}"
[[inputs.http]]
name_override = "flexpool_paid"
urls = ["https://flexpool.io/api/v1/miner/MINER_ADDRESS/totalPaid"]
urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/totalPaid"]
data_format = "json"
tagexclude = ["url"]
[inputs.http.tags]
miner = "MINER_ADDRESS"
miner = "${MINER_ADDRESS}"
[[inputs.http]]
name_override = "flexpool_daily_revenue_estimation"
urls = ["https://flexpool.io/api/v1/miner/MINER_ADDRESS/estimatedDailyRevenue"]
urls = ["https://flexpool.io/api/v1/miner/${MINER_ADDRESS}/estimatedDailyRevenue"]
data_format = "json"
tagexclude = ["url"]
[inputs.http.tags]
miner = "MINER_ADDRESS"
miner = "${MINER_ADDRESS}"