-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from AndreZiviani/feat-custom-headers
Feat: Support for custom headers
- Loading branch information
Showing
14 changed files
with
353 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# default configuration created by the `mage watch` command. | ||
# this file can be edited and should be checked into source control. | ||
# see https://github.com/unknwon/bra/blob/master/templates/default.bra.toml for more configuration options. | ||
[run] | ||
init_cmds = [ | ||
["mage", "-v", "build:debug"], | ||
["mage", "-v" , "reloadPlugin"] | ||
] | ||
watch_all = true | ||
follow_symlinks = false | ||
ignore = [".git", "node_modules", "dist"] | ||
ignore_files = ["mage_output_file.go"] | ||
watch_dirs = [ | ||
"pkg", | ||
"src", | ||
] | ||
watch_exts = [".go", ".json"] | ||
build_delay = 2000 | ||
cmds = [ | ||
["mage", "-v", "build:debug"], | ||
["mage", "-v" , "reloadPlugin"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "2.10.1" | ||
"version": "4.12.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,13 @@ ARG grafana_image=grafana-enterprise | |
|
||
FROM grafana/${grafana_image}:${grafana_version} | ||
|
||
ARG development=false | ||
|
||
ARG GO_VERSION=1.21.6 | ||
ARG GO_ARCH=amd64 | ||
|
||
ENV DEV "${development}" | ||
|
||
# Make it as simple as possible to access the grafana instance for development purposes | ||
# Do NOT enable these settings in a public facing / production grafana instance | ||
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" | ||
|
@@ -11,6 +18,58 @@ ENV GF_AUTH_BASIC_ENABLED "false" | |
# Set development mode so plugins can be loaded without the need to sign | ||
ENV GF_DEFAULT_APP_MODE "development" | ||
|
||
# Inject livereload script into grafana index.html | ||
|
||
LABEL maintainer="Grafana Labs <[email protected]>" | ||
|
||
ENV GF_PATHS_HOME="/usr/share/grafana" | ||
WORKDIR $GF_PATHS_HOME | ||
|
||
USER root | ||
RUN sed -i 's/<\/body><\/html>/<script src=\"http:\/\/localhost:35729\/livereload.js\"><\/script><\/body><\/html>/g' /usr/share/grafana/public/views/index.html | ||
|
||
# Installing supervisor and inotify-tools | ||
RUN if [ "${development}" = "true" ]; then \ | ||
if grep -i -q alpine /etc/issue; then \ | ||
apk add supervisor inotify-tools git; \ | ||
elif grep -i -q ubuntu /etc/issue; then \ | ||
DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update && \ | ||
apt-get install -y supervisor inotify-tools git && \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
else \ | ||
echo 'ERROR: Unsupported base image' && /bin/false; \ | ||
fi \ | ||
fi | ||
|
||
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 | ||
|
||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
if [ "${DEV}" = "false" ]; then | ||
echo "Starting test mode" | ||
exec /run.sh | ||
fi | ||
|
||
echo "Starting development mode" | ||
|
||
if grep -i -q alpine /etc/issue; then | ||
exec /usr/bin/supervisord -c /etc/supervisord.conf | ||
elif grep -i -q ubuntu /etc/issue; then | ||
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf | ||
else | ||
echo 'ERROR: Unsupported base image' | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[supervisord] | ||
nodaemon=true | ||
user=root | ||
|
||
[program:grafana] | ||
user=root | ||
directory=/var/lib/grafana | ||
command=bash -c 'while [ ! -f /root/retrodaredevil-wildgraphql-datasource/dist/gpx_wild_graphql_datasource* ]; do sleep 1; done; /run.sh' | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
killasgroup=true | ||
stopasgroup=true | ||
autostart=true | ||
|
||
[program:delve] | ||
user=root | ||
command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep -f gpx_wild_graphql_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/retrodaredevil-wildgraphql-datasource; 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/retrodaredevil-wildgraphql-datasource | ||
command=/bin/bash -c 'git config --global --add safe.directory /root/retrodaredevil-wildgraphql-datasource && mage -v watch' | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
killasgroup=true | ||
stopasgroup=true | ||
autostart=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.