Skip to content

Commit

Permalink
Merge pull request #154 from lidofinance/feat/VAL-460-add-grafana
Browse files Browse the repository at this point in the history
feat: VAL-460 grafana and dev env
  • Loading branch information
eddort authored Dec 6, 2023
2 parents 2896930 + ed95407 commit cfdb713
Show file tree
Hide file tree
Showing 7 changed files with 1,750 additions and 24 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,30 @@ info: New staking router state cycle end

## Development

### Copy env file for development and print your RPC_URL

```bash
cp develop.env ./.env
```

```diff
- RPC_URL=%NODE_URL%
+ RPC_URL=https://mainnet.infura.io/v3/***
```

### Starting the development environment (PostgreSQL, KAPI, Grafana, Prometheus, RabbitMQ)

```bash
docker-compose -f ./docker-compose.dev.yml up -d
```

### Run Council Daemon

```bash
# development
$ yarn start

# watch mode
# development watch mode
$ yarn start:dev
```

Expand Down
41 changes: 41 additions & 0 deletions develop.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# env from guide
# App
PORT=3003

# Log level: debug, info, notice, warning or error
LOG_LEVEL=info

# Log format: simple or json
LOG_FORMAT=simple

# Pubsub (default: rabbitmq)
PUBSUB_SERVICE=rabbitmq

# RabbitMQ

RABBITMQ_URL=ws://127.0.0.1:15674/ws
RABBITMQ_LOGIN=guest
RABBITMQ_PASSCODE=guest


# Private key
# Used to sign transactions and stop the protocol.
# Make sure there are enough ETH on the balance to send a transaction to stop the protocol
WALLET_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000001"

KEYS_API_HOST=http://127.0.0.1

# Keys API
KEYS_API_PORT=3002

# chain id
# for mainnet 1
CHAIN_ID=1
RPC_URL=%NODE_URL%

# KeysAPI DB config
KEYS_API_DB_NAME=keys_service_db
KEYS_API_DB_PORT=5453
KEYS_API_DB_HOST=localhost
KEYS_API_DB_USER=postgres
KEYS_API_DB_PASSWORD=postgres
52 changes: 29 additions & 23 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
version: '3.7'

services:
council_daemon_prometheus:
image: prom/prometheus:v2.44.0
container_name: council_daemon_prometheus
ports:
- 9090:9090
volumes:
- ./prometheus/:/etc/prometheus/
command: --config.file=/etc/prometheus/prometheus.yml --enable-feature=remote-write-receiver

council_daemon_grafana:
image: grafana/grafana-oss:9.1.5
container_name: council_daemon_grafana
restart: unless-stopped
ports:
- 8001:3000
volumes:
- ./grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
depends_on:
- council_daemon_prometheus

keys_api_service_db:
image: postgres:14-alpine
platform: linux/arm64/v8
Expand All @@ -16,7 +36,7 @@ services:
- ./.volumes/pgdata-${CHAIN_ID}/:/var/lib/postgresql/data

keys_api_service_api:
image: lidofinance/lido-keys-api:dev
image: lidofinance/lido-keys-api:0.10.1
platform: linux/amd64
container_name: keys_api_service_api
ports:
Expand All @@ -35,26 +55,12 @@ services:
- DB_PASSWORD=${KEYS_API_DB_PASSWORD}
depends_on:
- keys_api_service_db

council_daemon:
image: lidofinance/lido-council-daemon:dev
platform: linux/amd64
rabbitmq:
build:
context: .
dockerfile: Dockerfile.test.yml
container_name: 'rabbitmq'
ports:
- "${PORT}:3000" # port is used for prometheus metrics
environment:
- PORT=${PORT}
- LOG_LEVEL=debug
- LOG_FORMAT=json
- RPC_URL=${RPC_URL}
- WALLET_PRIVATE_KEY=${WALLET_PRIVATE_KEY}
- KEYS_API_HOST=http://keys_api_service_api
- KEYS_API_PORT=3001
- PUBSUB_SERVICE=rabbitmq
- RABBITMQ_URL=${RABBITMQ_URL}
- RABBITMQ_LOGIN=${RABBITMQ_LOGIN}
- RABBITMQ_PASSCODE=${RABBITMQ_PASSCODE}
- RABBITMQ_PASSCODE_FILE=${RABBITMQ_PASSCODE_FILE}
depends_on:
- keys_api_service_api
volumes:
- ./.volumes/cache/:/council/cache/
- 5672:5672
- 15672:15672
- 15674:15674
22 changes: 22 additions & 0 deletions docker-compose.metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.7'

services:
council_daemon_prometheus:
image: prom/prometheus:v2.44.0
container_name: council_daemon_prometheus
ports:
- 9090:9090
volumes:
- ./prometheus/:/etc/prometheus/
command: --config.file=/etc/prometheus/prometheus.yml --enable-feature=remote-write-receiver

council_daemon_grafana:
image: grafana/grafana-oss:9.1.5
container_name: council_daemon_grafana
restart: unless-stopped
ports:
- 8001:3000
volumes:
- ./grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
depends_on:
- council_daemon_prometheus
15 changes: 15 additions & 0 deletions grafana/datasources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: 1

datasources:
- name: Prometheus
type: prometheus
access: proxy
orgId: 1
url: http://docker.for.mac.host.internal:9090
basicAuth: false
isDefault: true
editable: true
jsonData:
graphiteVersion: '1.1'
tlsAuth: false
tlsAuthWithCACert: false
Loading

0 comments on commit cfdb713

Please sign in to comment.