Skip to content

Commit f041e72

Browse files
author
Richard Patel
committed
Merge branch 'richard/quickstart' into 'master'
add Docker Compose quickstart config See merge request Blockdaemon/solana/pyth_exporter!6
2 parents 0e10eef + 1cf1942 commit f041e72

17 files changed

+2908
-34
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.png filter=lfs diff=lfs merge=lfs -text

README.md

Lines changed: 78 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -63,40 +63,84 @@ Usage of pyth_exporter:
6363
Solana WebSocket RPC URL
6464
```
6565

66-
## Metrics
66+
## Deployment
6767

68+
[./docker-compose.yml](./docker-compose.yml) defines a reference [Docker Compose](https://docs.docker.com/compose/) deployment on a single host.
69+
70+
The compose config includes the following services:
71+
- pyth_exporter (this repo)
72+
- Prometheus monitoring agent
73+
- Grafana monitoring UI
74+
75+
### Requirements
76+
77+
The reference deployment requires Docker Compose: [Compose installation guide](https://docs.docker.com/compose/install/)
78+
79+
### Configuration
80+
81+
The env vars file contains deployment-specific config.
82+
Copy the example config and adjust it.
83+
84+
```shell
85+
cp docker.example.env docker.env
86+
$EDITOR docker.env
87+
```
88+
89+
- `*_IMAGE`: Docker image strings
90+
- `SOLANA_RPC`: Solana RPC access
91+
- `SOLANA_WS`: Solana WebSocket access
92+
- `SOLANA_ENV`: Environment name (devnet, testnet, mainnet)
93+
94+
### Operations
95+
96+
Start all services
97+
98+
```shell
99+
docker-compose --env-file docker.env up -d
100+
```
101+
102+
Stop all services
103+
104+
```shell
105+
docker-compose down
68106
```
69-
% curl http://localhost:8080/metrics
70-
71-
# HELP pyth_exporter_rpc_requests_total Number of outgoing RPC requests from pyth_exporter to RPC nodes
72-
# TYPE pyth_exporter_rpc_requests_total counter
73-
pyth_exporter_rpc_requests_total 24
74-
# HELP pyth_exporter_ws_active_conns Number of active WebSockets between pyth_exporter and RPC nodes
75-
# TYPE pyth_exporter_ws_active_conns gauge
76-
pyth_exporter_ws_active_conns 1
77-
# HELP pyth_exporter_ws_events_total Number of WebSocket events delivered from RPC nodes to pyth_exporter
78-
# TYPE pyth_exporter_ws_events_total counter
79-
pyth_exporter_ws_events_total 14408
80-
# HELP pyth_oracle_aggregated_conf_amount Last aggregated conf of Pyth product
81-
# TYPE pyth_oracle_aggregated_conf_amount gauge
82-
pyth_oracle_aggregated_conf_amount{pyth_product="EWxGfxoPQSNA2744AYdAKmsQZ8F9o9M7oKkvL3VM1dko"} 2e-05
83-
# HELP pyth_oracle_aggregated_price Last aggregated price of Pyth product
84-
# TYPE pyth_oracle_aggregated_price gauge
85-
pyth_oracle_aggregated_price{pyth_product="EWxGfxoPQSNA2744AYdAKmsQZ8F9o9M7oKkvL3VM1dko"} 1.1326100000000001
86-
# HELP pyth_oracle_publisher_conf_amount Last published product confidence by Pyth publisher
87-
# TYPE pyth_oracle_publisher_conf_amount gauge
88-
pyth_oracle_publisher_conf_amount{pyth_product="EWxGfxoPQSNA2744AYdAKmsQZ8F9o9M7oKkvL3VM1dko",pyth_publisher="AKPWGLY5KpxbTx7DaVp4Pve8JweMjKbb1A19MyL2nrYT"} 0.00014000000000000001
89-
# HELP pyth_oracle_publisher_price Last published product price by Pyth publisher
90-
# TYPE pyth_oracle_publisher_price gauge
91-
pyth_oracle_publisher_price{pyth_product="EWxGfxoPQSNA2744AYdAKmsQZ8F9o9M7oKkvL3VM1dko",pyth_publisher="AKPWGLY5KpxbTx7DaVp4Pve8JweMjKbb1A19MyL2nrYT"} 1.1326500000000002
92-
# HELP pyth_oracle_publisher_slot Last observed slot for Pyth publisher
93-
# TYPE pyth_oracle_publisher_slot gauge
94-
pyth_oracle_publisher_slot{pyth_product="EWxGfxoPQSNA2744AYdAKmsQZ8F9o9M7oKkvL3VM1dko",pyth_publisher="AKPWGLY5KpxbTx7DaVp4Pve8JweMjKbb1A19MyL2nrYT"} 1.16427278e+08
95-
# HELP pyth_solana_publish_account_balance SOL balance of Pyth publish account in lamports
96-
# TYPE pyth_solana_publish_account_balance gauge
97-
pyth_solana_publish_account_balance{pyth_publisher="AKPWGLY5KpxbTx7DaVp4Pve8JweMjKbb1A19MyL2nrYT"} 4.950539e+10
98-
# HELP pyth_txs_total Approximate number of Pyth transactions sent
99-
# TYPE pyth_txs_total counter
100-
pyth_txs_total{pyth_publisher="AKPWGLY5KpxbTx7DaVp4Pve8JweMjKbb1A19MyL2nrYT",tx_status="failed"} 10
101-
pyth_txs_total{pyth_publisher="AKPWGLY5KpxbTx7DaVp4Pve8JweMjKbb1A19MyL2nrYT",tx_status="success"} 67
107+
108+
Stop all services and delete all data (!)
109+
110+
```shell
111+
docker-compose down -v --remove-orphans
102112
```
113+
114+
View service status
115+
116+
```shell
117+
docker-compose ps
118+
```
119+
120+
View service logs
121+
122+
```shell
123+
docker-compose logs
124+
```
125+
126+
## Screenshots
127+
128+
**Overview**
129+
130+
![Overview](./docs/grafana-overview.png)
131+
132+
**Status Matrix**
133+
134+
![Status Matrix](./docs/grafana-status-matrix.png)
135+
136+
**Aggregated Price**
137+
138+
![Aggregated Price](./docs/grafana-price.png)
139+
140+
**Multiple Price Components**
141+
142+
![Multiple Price Components](./docs/grafana-price-components.png)
143+
144+
**Single Price Component**
145+
146+
![Single Price Component](./docs/grafana-price-published.png)

docker-compose.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Example docker-compose deployment.
2+
version: '3'
3+
4+
volumes:
5+
prometheus_storage: {}
6+
grafana_storage: {}
7+
8+
services:
9+
# Prometheus exporter
10+
pyth_exporter:
11+
# --- Release build
12+
# image: "${PYTH_EXPORTER_IMAGE}"
13+
# --- Development build
14+
build:
15+
dockerfile: ./Dockerfile
16+
context: .
17+
restart: unless-stopped
18+
command:
19+
- "--listen=:8080"
20+
- "--log-level=info"
21+
- "--env=${SOLANA_ENV}"
22+
- "--rpc=${SOLANA_RPC}"
23+
- "--ws=${SOLANA_WS}"
24+
25+
# Prometheus monitoring agent
26+
prometheus:
27+
image: "${PROMETHEUS_IMAGE}"
28+
restart: unless-stopped
29+
ports:
30+
- '9090:9090'
31+
volumes:
32+
- 'prometheus_storage:/prometheus'
33+
- './docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro'
34+
35+
# Grafana UI
36+
grafana:
37+
image: "${GRAFANA_IMAGE}"
38+
restart: unless-stopped
39+
ports:
40+
- '3000:3000'
41+
volumes:
42+
- 'grafana_storage:/var/lib/grafana'
43+
- './docker/grafana/grafana.ini:/etc/grafana/grafana.ini:ro'
44+
- './docker/grafana/provisioning:/etc/grafana/provisioning:ro'

docker.example.env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Pyth Prometheus Exporter
2+
PYTH_EXPORTER_IMAGE=registry.gitlab.com/blockdaemon/solana/pyth_exporter:latest
3+
4+
# Prometheus
5+
PROMETHEUS_IMAGE=prom/prometheus:latest
6+
7+
# Grafana
8+
GRAFANA_IMAGE=grafana/grafana-oss:latest
9+
10+
# Solana node access
11+
SOLANA_RPC=https://my-node.bdnodes.net?auth=xxx
12+
SOLANA_WS=wss://my-node.bdnodes.net/websocket?auth=xxx
13+
SOLANA_ENV=mainnet

docker/grafana/grafana.ini

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Example config file for Grafana.
2+
3+
[auth]
4+
disable_login_form = true
5+
6+
[auth.basic]
7+
enabled = false
8+
9+
[auth.anonymous]
10+
enabled = true
11+
org_name = Main Org.
12+
org_role = Editor
13+
hide_version = true
14+
15+
[security]
16+
disable_initial_admin_creation = true
17+
18+
[users]
19+
default_theme = light
20+
home_page = /d/V0YM0T-7z/pyth-fix-overview?orgId=1&kiosk=tv&refresh=10s
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: 1
2+
providers:
3+
- name: 'local'
4+
orgId: 1
5+
folder: ''
6+
folderUid: ''
7+
type: file
8+
disableDeletion: true
9+
allowUiUpdates: true
10+
options:
11+
path: /etc/grafana/provisioning/dashboards

0 commit comments

Comments
 (0)