Skip to content

docs(katana): update monitoring example #2942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/katana/monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "katana"
services:
katana:
restart: unless-stopped
image: ghcr.io/dojoengine/dojo
image: ghcr.io/dojoengine/dojo:v1.0.12
ports:
- "5050:5050" # rpc
- "9001:9001" # metrics
Expand All @@ -15,7 +15,7 @@ services:

prometheus:
restart: unless-stopped
image: prom/prometheus
image: prom/prometheus:v3.1.0
depends_on:
- katana
ports:
Expand All @@ -29,7 +29,7 @@ services:

grafana:
restart: unless-stopped
image: grafana/grafana
image: grafana/grafana:11.4.0
depends_on:
- prometheus
ports:
Expand All @@ -38,6 +38,11 @@ services:
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
- ./grafana/datasources:/etc/grafana/provisioning/datasources
- grafanadata:/var/lib/grafana
environment:
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/overview.json
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_SECURITY_ADMIN_USER=admin
- GF_AUTH_ANONYMOUS_ENABLED=true
Comment on lines +41 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Secure configuration for Grafana environment variables.

The current setup exposes admin credentials in the compose file and enables anonymous access. While this might be fine for development, please consider:

  1. Using a .env file for sensitive values
  2. Evaluating if anonymous access is really needed

Create a .env file:

GF_SECURITY_ADMIN_PASSWORD=your_secure_password
GF_SECURITY_ADMIN_USER=admin
GF_AUTH_ANONYMOUS_ENABLED=false

Then update the compose file:

     environment:
       - GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/overview.json
-      - GF_SECURITY_ADMIN_PASSWORD=admin
-      - GF_SECURITY_ADMIN_USER=admin
-      - GF_AUTH_ANONYMOUS_ENABLED=true
+      - GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
+      - GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
+      - GF_AUTH_ANONYMOUS_ENABLED=${GF_AUTH_ANONYMOUS_ENABLED:-false}


volumes:
prometheusdata:
Expand Down
12 changes: 12 additions & 0 deletions crates/katana/monitoring/grafana/dashboards/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: 1

providers:
- name: "Katana"
orgId: 1
folder: ""
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: true
options:
path: /etc/grafana/provisioning/dashboards
Loading
Loading