版本
grafana/grafana:8.3.3
配置
- 环境变量配置 使用容器时,这些路径只能通过环境变量配置,而不能通过conf/grafana.ini配置
Setting | Default value |
---|---|
GF_PATHS_CONFIG | /etc/grafana/grafana.ini |
GF_PATHS_DATA | /var/lib/grafana |
GF_PATHS_HOME | /usr/share/grafana |
GF_PATHS_LOGS | /var/log/grafana |
GF_PATHS_PLUGINS | /var/lib/grafana/plugins |
GF_PATHS_PROVISIONING | /etc/grafana/provisioning |
- 配置文件 默认配置文件(镜像/etc/grafana/grafana.ini原始文件)
- 配置使用nginx 反向代理 参考官方文档
[server]
domain = example.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
ningx配置
代码语言:javascript复制# 此项配置用于支持WS协议链接
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
...
# 代理grafana站点
location / {
proxy_pass http://localhost:3000/;
}
# 代理grafana WS链接
location /api/live {
rewrite ^/(.*) /$1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000/;
}
}
注:如果domain与访问地址不同,页面可以显示但是websocket调用会报403 forbidden
- 启用页面嵌套支持
[security]
allow_embedding = true
- 启用匿名访问
[auth.anonymous]
enabled = true
org_name = my org.
org_role = Viewer