chore: Add back debug backend (#2244)
This commit is contained in:
@@ -7,7 +7,8 @@ ARG anonymous_auth_enabled=true
|
||||
ARG development=false
|
||||
ARG TARGETARCH
|
||||
|
||||
|
||||
ARG GO_VERSION=1.25.6
|
||||
ARG GO_ARCH=${TARGETARCH:-amd64}
|
||||
ENV DEV "${development}"
|
||||
|
||||
# Make it as simple as possible to access the grafana instance for development purposes
|
||||
@@ -43,7 +44,27 @@ RUN if [ "${development}" = "true" ]; then \
|
||||
COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini
|
||||
COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Installing Go
|
||||
RUN if [ "${development}" = "true" ]; then \
|
||||
curl -O -L https://golang.org/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
|
||||
rm -rf /usr/local/go && \
|
||||
tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
|
||||
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bashrc && \
|
||||
rm -f go${GO_VERSION}.linux-${GO_ARCH}.tar.gz; \
|
||||
fi
|
||||
|
||||
# Installing delve for debugging
|
||||
RUN if [ "${development}" = "true" ]; then \
|
||||
/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest; \
|
||||
fi
|
||||
|
||||
# Installing mage for plugin (re)building
|
||||
RUN if [ "${development}" = "true" ]; then \
|
||||
git clone https://github.com/magefile/mage; \
|
||||
cd mage; \
|
||||
export PATH=$PATH:/usr/local/go/bin; \
|
||||
go run bootstrap.go; \
|
||||
fi
|
||||
|
||||
# Inject livereload script into grafana index.html
|
||||
RUN sed -i 's|</body>|<script src="http://localhost:35729/livereload.js"></script></body>|g' /usr/share/grafana/public/views/index.html
|
||||
|
||||
@@ -7,11 +7,17 @@ services:
|
||||
context: .
|
||||
args:
|
||||
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
|
||||
grafana_version: ${GRAFANA_VERSION:-12.2.0}
|
||||
grafana_version: ${GRAFANA_VERSION:-12.3.1}
|
||||
development: ${DEVELOPMENT:-false}
|
||||
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
|
||||
ports:
|
||||
- 3000:3000/tcp
|
||||
- 2345:2345/tcp # delve
|
||||
security_opt:
|
||||
- 'apparmor:unconfined'
|
||||
- 'seccomp:unconfined'
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
volumes:
|
||||
- ../dist:/var/lib/grafana/plugins/alexanderzobnin-zabbix-app
|
||||
- ../provisioning:/etc/grafana/provisioning
|
||||
|
||||
@@ -5,7 +5,7 @@ user=root
|
||||
[program:grafana]
|
||||
user=root
|
||||
directory=/var/lib/grafana
|
||||
command=/run.sh
|
||||
command=bash -c 'while [ ! -f /root/alexanderzobnin-zabbix-app/dist/datasource/gpx_zabbix-datasource* ]; do sleep 1; done; /run.sh'
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
@@ -13,3 +13,35 @@ killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
|
||||
[program:delve]
|
||||
user=root
|
||||
command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep -f gpx_zabbix-datasource); done; /root/go/bin/dlv attach --api-version=2 --headless --continue --accept-multiclient --listen=:2345 $pid'
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
killasgroup=false
|
||||
stopasgroup=false
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:build-watcher]
|
||||
user=root
|
||||
command=/bin/bash -c 'while inotifywait -e modify,create,delete -r /var/lib/grafana/plugins/alexanderzobnin-zabbix-app; do echo "Change detected, restarting delve...";supervisorctl restart delve; done'
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
|
||||
[program:mage-watcher]
|
||||
user=root
|
||||
environment=PATH="/usr/local/go/bin:/root/go/bin:%(ENV_PATH)s"
|
||||
directory=/root/alexanderzobnin-zabbix-app
|
||||
command=/bin/bash -c 'git config --global --add safe.directory /root/alexanderzobnin-zabbix-app && mage -v watch'
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
killasgroup=true
|
||||
stopasgroup=true
|
||||
autostart=true
|
||||
|
||||
Reference in New Issue
Block a user