Skip to content

Instantly share code, notes, and snippets.

@HimbeersaftLP
Last active July 21, 2024 11:22
Show Gist options
  • Save HimbeersaftLP/82b2a1be7708ddcf71746cd86f2c5de0 to your computer and use it in GitHub Desktop.
Save HimbeersaftLP/82b2a1be7708ddcf71746cd86f2c5de0 to your computer and use it in GitHub Desktop.
grafana-mqtt-docker

Instructions

Build

git clone https://gist.github.com/82b2a1be7708ddcf71746cd86f2c5de0.git grafana-mqtt-docker
cd grafana-mqtt-docker
docker-compose build

Start

cd grafana-mqtt-docker
docker-compose up -d

Then open http://localhost:3000 in your browser and login with the usernameadmin and password admin.

Stop

cd grafana-mqtt-docker
docker-compose down
version: '3.3'
services:
grafana-mqtt:
build: .
ports:
- '3000:3000'
hostname: grafana
restart: unless-stopped
volumes:
- type: volume
source: grafana_storage
target: /var/lib/grafana
networks:
- 'int_net'
- 'ext_net'
mosquitto:
ports:
- '1883:1883'
- '9001:9001'
hostname: mosquitto
restart: unless-stopped
image: eclipse-mosquitto
command: 'mosquitto -c /mosquitto-no-auth.conf'
networks:
- 'int_net'
- 'ext_net'
networks:
int_net:
internal: true
ext_net:
volumes:
grafana_storage:
FROM golang:alpine as plugin-builder
RUN apk add --no-cache yarn git
RUN git clone https://github.com/magefile/mage --depth=1
RUN git clone https://github.com/grafana/mqtt-datasource.git --depth=1
RUN cd mage && go run bootstrap.go
RUN cd mqtt-datasource && yarn install && yarn build
FROM grafana/grafana
COPY --from=plugin-builder /go/mqtt-datasource $GF_PATHS_PLUGINS
ENV GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-mqtt-datasource
EXPOSE 3000
USER grafana
ENTRYPOINT [ "/run.sh" ]
@jpmorris
Copy link

thanks for this!

@Buzzology
Copy link

This worked for me as well, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment