Dockerfile and docker-compose example

This commit is contained in:
Ben Wilson 2019-11-14 11:50:56 -05:00
parent a8bd03408c
commit 78391b9e9f
5 changed files with 94 additions and 0 deletions

9
.env.example Normal file
View File

@ -0,0 +1,9 @@
GF_ADMIN_USER=admin
GF_ADMIN_PASSWORD=notadmin
ZCASHD_RPCUSER=zcashrpc
ZCASHD_RPCPASSWORD=notsecure
ZCASHD_ALLOWIP=0.0.0.0/0
ZCASHD_DATADIR=/srv/zcashd/.zcash
ZCASHD_PARMDIR=/srv/zcashd/.zcash-params
ZCASHD_NETWORK=testnet
ZCASHD_GEN=0

1
.gitignore vendored
View File

@ -1 +1,2 @@
zcashd_exporter
.env

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM golang:1.13
ADD . /go/src/github.com/zcash-hackworks/zcashd_exporter
RUN go get github.com/zcash-hackworks/zcashd_exporter
RUN go install github.com/zcash-hackworks/zcashd_exporter
ENTRYPOINT ["zcashd_exporter"]
CMD ["--help"]

45
docker-compose.yml Normal file
View File

@ -0,0 +1,45 @@
---
version: '2'
services:
zcashd:
image: gcr.io/zcash-web/zcashd:latest
volumes:
- $ZCASHD_DATADIR:/srv/zcashd/.zcash
- $ZCASHD_PARMDIR:/srv/zcashd/.zcash-params
environment:
- ZCASHD_RPCUSER=$ZCASHD_RPCUSER
- ZCASHD_RPCPASSWORD=$ZCASHD_RPCPASSWORD
- ZCASHD_NETWORK=$ZCASHD_NETWORK
- ZCASHD_ALLOWIP=$ZCASHD_ALLOWIP
mem_limit: 4G
ports:
- "28332:28332"
- "18232:18232"
zcashd_exporter:
build: .
environment:
- ZCASHD_RPCUSER=$ZCASHD_RPCUSER
- ZCASHD_RPCPASSWORD=$ZCASHD_RPCPASSWORD
command:
- --rpc.host=zcashd
- --rpc.port=18232
- --rpc.user=$ZCASHD_RPCUSER
- --rpc.password=$ZCASHD_RPCPASSWORD
ports:
- "9100:9100"
grafana:
image: grafana/grafana:6.4.3
ports:
- "3000:3000"
environment:
- GF_ADMIN_USER=$GF_ADMIN_USER
- GF_ADMIN_PASSWORD=$GF_ADMIN_PASSWORD
prometheus:
image: prom/prometheus:v2.13.1
ports:
- "9090:9090"
volumes:
- ./docker/prometheus/config.yml:/etc/prometheus/prometheus.yml

View File

@ -0,0 +1,30 @@
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'zcashd_exporter'
static_configs:
- targets: ['zcashd_exporter:9100']