Skip to content

Commit 1e3ef6c

Browse files
authored
add grafana (#1094)
1 parent e65e12f commit 1e3ef6c

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

store/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ POSTGRES_HOST=store-pgsql
77
POSTGRES_USER=postgres
88
POSTGRES_PASSWORD=example
99
POSTGRES_DB=neurostore
10+
GRAFANA_ADMIN_USER=admin
11+
GRAFANA_ADMIN_PASSWORD=changeme
1012
BEARERINFO_FUNC=neurostore.resources.auth.decode_token
1113
AUTH0_CLIENT_ID=YOUR_CLIENT_ID
1214
AUTH0_CLIENT_SECRET=YOUR_CLIENT_SECRET

store/docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,34 @@ services:
7979
store-pgsql:
8080
condition: service_healthy
8181

82+
grafana:
83+
image: grafana/grafana
84+
restart: always
85+
expose:
86+
- "3030"
87+
env_file:
88+
- .env
89+
environment:
90+
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER}
91+
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
92+
- GF_SERVER_ROOT_URL=/grafana
93+
- GF_SERVER_SERVE_FROM_SUB_PATH="true"
94+
- GF_SERVER_HTTP_PORT=3030
95+
volumes:
96+
- grafana_data:/var/lib/grafana
97+
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
98+
depends_on:
99+
store-pgsql:
100+
condition: service_healthy
101+
networks:
102+
- default
103+
82104
volumes:
83105
postgres_data:
106+
grafana_data:
84107

85108
networks:
86109
default:
87110
external:
88111
name: nginx-proxy
112+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Postgres
5+
type: postgres
6+
access: proxy
7+
isDefault: true
8+
user: $__env{POSTGRES_USER}
9+
secureJsonData:
10+
password: $__env{POSTGRES_PASSWORD}
11+
jsonData:
12+
host: store-pgsql
13+
port: 5432
14+
database: $__env{POSTGRES_DB}
15+
sslmode: disable

store/nginx/nginx.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,17 @@ http {
103103
proxy_set_header Upgrade $http_upgrade;
104104
proxy_set_header Connection "upgrade";
105105
}
106+
107+
location /grafana/ {
108+
rewrite ^/grafana/(.*)$ /$1 break;
109+
proxy_pass http://grafana:3030/;
110+
proxy_set_header Host $host;
111+
proxy_set_header X-Real-IP $remote_addr;
112+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
113+
proxy_set_header X-Forwarded-Proto $scheme;
114+
proxy_http_version 1.1;
115+
proxy_set_header Upgrade $http_upgrade;
116+
proxy_set_header Connection "upgrade";
117+
}
106118
}
107119
}

0 commit comments

Comments
 (0)