Skip to content

Commit

Permalink
Add all-in-one Docker Compose and Grafana configuration (#997)
Browse files Browse the repository at this point in the history
Updated docker-compose manifest to easily deploy Yorkie server with configured monitoring tools like Prometheus and Grafana.
  • Loading branch information
window9u authored Sep 6, 2024
1 parent b77c25a commit 3e49afb
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ docker compose -f docker/docker-compose.yml down
The docker-compose files we use are as follows:
- `docker-compose.yml`: This file is used to run Yorkie's integration tests. It
runs MongoDB.
- `docker-compose-full.yml`: This file launches all the applications needed to
develop Yorkie. It also runs monitoring tools such as Prometheus and Grafana.
- `docker-compose-full.yml`: This file builds Yorkie and launches it. It also runs
MongoDB and monitoring tools such as Prometheus and Grafana.
29 changes: 26 additions & 3 deletions build/docker/docker-compose-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ services:
image: prom/prometheus:latest
container_name: prometheus
ports:
- '9090:9090'
- '9090:9090'
command:
- --config.file=/etc/prometheus/prometheus.yml
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- '3000:3000'
command:
- --config=/etc/grafana/grafana.ini
volumes:
- ./monitoring/grafana.ini:/etc/grafana/grafana.ini:ro
- ./monitoring/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml:ro
depends_on:
- prometheus
mongo:
Expand All @@ -23,3 +28,21 @@ services:
restart: always
ports:
- '27017:27017'
yorkie:
build:
context: ../../
dockerfile: Dockerfile
container_name: 'yorkie'
command:
[
'server',
'--mongo-connection-uri',
'mongodb://mongo:27017',
'--enable-pprof',
]
restart: always
ports:
- '8080:8080'
- '8081:8081'
depends_on:
- mongo
12 changes: 12 additions & 0 deletions build/docker/monitoring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Grafana Setup Guide

## Importing Dashboards

To import dashboards into Grafana, follow these steps:

1. Open Grafana in your browser ([http://localhost:3000](http://localhost:3000)).
2. Log in with the default credentials (admin/admin).
3. Click "Dashboards" in the left sidebar.
4. Click "New" and then "Import".
5. Use the Yorkie dashboard ID `18560` to import the dashboard.
6. Click "Load" and "Import" and the dashboard will be made.
8 changes: 8 additions & 0 deletions build/docker/monitoring/datasources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: 1

datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
21 changes: 21 additions & 0 deletions build/docker/monitoring/grafana.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[paths]
provisioning = /etc/grafana/provisioning

[server]
http_port = 3000

[security]
admin_user = admin
admin_password = admin

[users]
allow_sign_up = true

[auth.anonymous]
enabled = false

[dashboards]
versions_to_keep = 20

[unified_alerting]
enabled = true
7 changes: 7 additions & 0 deletions build/docker/monitoring/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
scrape_configs:
- job_name: yorkie
metrics_path: /metrics
scrape_interval: 5s
static_configs:
- targets:
- yorkie:8081
8 changes: 0 additions & 8 deletions build/docker/prometheus.yml

This file was deleted.

0 comments on commit 3e49afb

Please sign in to comment.