---
# System prepended metadata

title: Grafana in Docker連線InfluxDB設定(周老師)
tags: [Documentation, Templates]

---

---
title: 'Grafana in Docker連線InfluxDB設定(周老師)'
disqus: hackmd
---

Grafana in Docker連線InfluxDB設定(周老師)
===

## 索引

[TOC]

## 注意事項
* 此部分操作將進行部分設定檔案的永久儲存機制
    * grafana.ini
    * 管理專案

## Docker部屬
https://gitlab.gpu.mlc.app/smarthome/Long-Care-Dev-305
```plantuml
@startyaml

## >>>>> InfluxDB >>>>>

  ## Influx
  influxdb:
    image: influxdb:2.0
    restart: always
    expose:
      - 8086
      #- 8088
    environment:
      # 反向代理
      - VIRTUAL_PORT=8086
      - VIRTUAL_PROTO=http
      - VIRTUAL_HOST=influx.topnet.174.mlc.app
      - LETSENCRYPT_HOST=influx.topnet.174.mlc.app
      - LETSENCRYPT_EMAIL=m0724001@gm.nuu.edu.tw
    env_file:
      - ./初始部屬設定/InfluxDB部屬設定.env
    volumes:
      #- influxdb_data:/bitnami/influxdb
      - influxdb_data:/var/lib/influxdb2
      - influxdb_config:/etc/influxdb2

  ## >>>>> Grafana >>>>>

  ## Grafana
  grafana:
    image: bitnami/grafana:8
    restart: always
    expose:
      - '3000'
    environment:
      # 反向代理
      VIRTUAL_PORT: 3000
      VIRTUAL_PROTO: http
      GF_RENDERING_SERVER_URL: "http://grafana-image-renderer:8080/render"
      GF_RENDERING_CALLBACK_URL: "http://grafana:3000/"
    env_file:
      - ./初始部屬設定/Grafana部屬設定.env
  ## You can install the Grafana Image Renderer plugin to handle rendering panels and dashboards as PNG images. 
  ## To install the plugin, follow the instructions described in the previous section.
  ## As an alternative to install this plugin, you can use the Grafana Image Renderer container to set another Docker container for 
  ## rendering and using remote rendering. We highly recommend to use this option. In the Docker Compose below you can see an example to use this container:
  grafana-image-renderer:
    image: bitnami/grafana-image-renderer:1
    restart: always
    expose:
      - '8080'
    environment:
      HTTP_HOST: "0.0.0.0"
      HTTP_PORT: "8080"
      ENABLE_METRICS: 'true'

@endyaml
```

## InfluxDB資訊
![](https://i.imgur.com/b78hOih.png)
* Org: `nuu-csie`
* Token: ``
* Bucket: `top-care`

## Grafana設定
![](https://i.imgur.com/1agIJYS.png)
* 一個是內部連線(外部無法連線)
![](https://i.imgur.com/40zcoAz.png)
Query Language: `Flux`
Name: `InfluxDB`
URL: `http://influxdb-test:8086`
Auth: `Basic Auth`
User: `nschou`

* 一個是外部連線
![](https://i.imgur.com/41zqAVv.png)
Query Language: `Flux`
Name: `InfluxDB`
URL: `https://influx.topnet.174.mlc.app`
Auth: `Basic Auth`
User: `nschou`

## Reference and FAQ

:::info
**Find this document incomplete?** Leave a comment!
:::

###### tags: `Templates` `Documentation`
