diff --git a/build/docker/README.md b/build/docker/README.md index ef18072f2..28820835c 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -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. diff --git a/build/docker/docker-compose-full.yml b/build/docker/docker-compose-full.yml index c6739062d..b49563f24 100644 --- a/build/docker/docker-compose-full.yml +++ b/build/docker/docker-compose-full.yml @@ -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: @@ -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 diff --git a/build/docker/monitoring/README.md b/build/docker/monitoring/README.md new file mode 100644 index 000000000..d49d5c0a4 --- /dev/null +++ b/build/docker/monitoring/README.md @@ -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. diff --git a/build/docker/monitoring/datasources.yml b/build/docker/monitoring/datasources.yml new file mode 100644 index 000000000..86fd3465e --- /dev/null +++ b/build/docker/monitoring/datasources.yml @@ -0,0 +1,8 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + isDefault: true diff --git a/build/docker/monitoring/grafana.ini b/build/docker/monitoring/grafana.ini new file mode 100644 index 000000000..6145316b9 --- /dev/null +++ b/build/docker/monitoring/grafana.ini @@ -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 diff --git a/build/docker/monitoring/prometheus.yml b/build/docker/monitoring/prometheus.yml new file mode 100644 index 000000000..9cd0205d6 --- /dev/null +++ b/build/docker/monitoring/prometheus.yml @@ -0,0 +1,7 @@ +scrape_configs: +- job_name: yorkie + metrics_path: /metrics + scrape_interval: 5s + static_configs: + - targets: + - yorkie:8081 diff --git a/build/docker/prometheus.yml b/build/docker/prometheus.yml deleted file mode 100644 index 8f9792960..000000000 --- a/build/docker/prometheus.yml +++ /dev/null @@ -1,8 +0,0 @@ -scrape_configs: -- job_name: yorkie - metrics_path: /metrics - scrape_interval: 5s - static_configs: - - targets: - # win/mac hosts: Use address: host.docker.internal instead of address: localhost in the line below - - host.docker.internal:8081