@grafana/create-plugin 4.3.0-canary.832.a1f8d8a.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # v4.3.0 (Fri Mar 22 2024)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Create Plugin: add support for remote debugging in docker dev env [#809](https://github.com/grafana/plugin-tools/pull/809) ([@oshirohugo](https://github.com/oshirohugo))
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - Add condition about backend to success message [#830](https://github.com/grafana/plugin-tools/pull/830) ([@Ukochka](https://github.com/Ukochka))
10
+
11
+ #### Authors: 2
12
+
13
+ - Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
14
+ - Yulia Shanyrova ([@Ukochka](https://github.com/Ukochka))
15
+
16
+ ---
17
+
1
18
  # v4.2.5 (Mon Mar 18 2024)
2
19
 
3
20
  #### 🐛 Bug Fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "4.3.0-canary.832.a1f8d8a.0",
3
+ "version": "4.3.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -87,5 +87,5 @@
87
87
  "engines": {
88
88
  "node": ">=20"
89
89
  },
90
- "gitHead": "a1f8d8ab30d080e193cc25765da1bcd2742d7601"
90
+ "gitHead": "7c5dc7f0f55e8903d25e5fc1630d350a743fccaf"
91
91
  }
@@ -3,6 +3,11 @@ ARG grafana_image=grafana-enterprise
3
3
 
4
4
  FROM grafana/${grafana_image}:${grafana_version}
5
5
 
6
+ {{#if hasBackend}}
7
+ ARG GO_VERSION=1.21.6
8
+ ARG GO_ARCH=amd64
9
+ {{/if}}
10
+
6
11
  # Make it as simple as possible to access the grafana instance for development purposes
7
12
  # Do NOT enable these settings in a public facing / production grafana instance
8
13
  ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
@@ -11,6 +16,53 @@ ENV GF_AUTH_BASIC_ENABLED "false"
11
16
  # Set development mode so plugins can be loaded without the need to sign
12
17
  ENV GF_DEFAULT_APP_MODE "development"
13
18
 
14
- # Inject livereload script into grafana index.html
19
+
20
+ LABEL maintainer="Grafana Labs <hello@grafana.com>"
21
+
22
+ ENV GF_PATHS_HOME="/usr/share/grafana"
23
+ WORKDIR $GF_PATHS_HOME
24
+
15
25
  USER root
26
+
27
+
28
+ # Installing supervisor and inotify-tools
29
+ RUN if grep -i -q alpine /etc/issue; then \
30
+ apk add supervisor inotify-tools git; \
31
+ elif grep -i -q ubuntu /etc/issue; then \
32
+ DEBIAN_FRONTEND=noninteractive && \
33
+ apt-get update && \
34
+ apt-get install -y supervisor inotify-tools git && \
35
+ rm -rf /var/lib/apt/lists/*; \
36
+ else \
37
+ echo 'ERROR: Unsupported base image' && /bin/false; \
38
+ fi
39
+
40
+ COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini
41
+ COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
42
+
43
+
44
+ {{#if hasBackend}}
45
+ # Installing Go
46
+ RUN curl -O -L https://golang.org/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
47
+ rm -rf /usr/local/go && \
48
+ tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
49
+ echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bashrc && \
50
+ rm -f go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
51
+
52
+ # Installing delve for debugging
53
+ RUN /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest
54
+
55
+ # Installing mage for plugin (re)building
56
+ RUN git clone https://github.com/magefile/mage; \
57
+ cd mage; \
58
+ export PATH=$PATH:/usr/local/go/bin; \
59
+ go run bootstrap.go
60
+ {{/if}}
61
+
62
+ # Inject livereload script into grafana index.html
16
63
  RUN sed -i 's|</body>|<script src="http://localhost:35729/livereload.js"></script></body>|g' /usr/share/grafana/public/views/index.html
64
+
65
+
66
+ COPY entrypoint.sh /entrypoint.sh
67
+ RUN chmod +x /entrypoint.sh
68
+ ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ if grep -i -q alpine /etc/issue; then
4
+ exec /usr/bin/supervisord -c /etc/supervisord.conf
5
+ elif grep -i -q ubuntu /etc/issue; then
6
+ exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
7
+ else
8
+ echo 'ERROR: Unsupported base image'
9
+ exit 1
10
+ fi
@@ -0,0 +1,49 @@
1
+ [supervisord]
2
+ nodaemon=true
3
+ user=root
4
+
5
+ [program:grafana]
6
+ user=root
7
+ directory=/var/lib/grafana
8
+ command=/run.sh
9
+ stdout_logfile=/dev/fd/1
10
+ stdout_logfile_maxbytes=0
11
+ redirect_stderr=true
12
+ killasgroup=true
13
+ stopasgroup=true
14
+ autostart=true
15
+
16
+ {{#if hasBackend}}
17
+ [program:delve]
18
+ user=root
19
+ command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep -f gpx_{{ snakeCase pluginName }}); done; /root/go/bin/dlv attach --api-version=2 --headless --continue --accept-multiclient --listen=:2345 $pid'
20
+ stdout_logfile=/dev/fd/1
21
+ stdout_logfile_maxbytes=0
22
+ redirect_stderr=true
23
+ killasgroup=false
24
+ stopasgroup=false
25
+ autostart=true
26
+ autorestart=true
27
+
28
+ [program:build-watcher]
29
+ user=root
30
+ command=/bin/bash -c 'while inotifywait -e modify,create,delete -r /var/lib/grafana/plugins/{{ pluginId }}; do echo "Change detected, restarting delve...";supervisorctl restart delve; done'
31
+ stdout_logfile=/dev/fd/1
32
+ stdout_logfile_maxbytes=0
33
+ redirect_stderr=true
34
+ killasgroup=true
35
+ stopasgroup=true
36
+ autostart=true
37
+
38
+ [program:mage-watcher]
39
+ user=root
40
+ environment=PATH="/usr/local/go/bin:/root/go/bin:%(ENV_PATH)s"
41
+ directory=/root/{{ pluginId }}
42
+ command=/bin/bash -c 'git config --global --add safe.directory /root/{{ pluginId }} && mage -v watch'
43
+ stdout_logfile=/dev/fd/1
44
+ stdout_logfile_maxbytes=0
45
+ redirect_stderr=true
46
+ killasgroup=true
47
+ stopasgroup=true
48
+ autostart=true
49
+ {{/if}}
@@ -2,7 +2,9 @@ version: '3.0'
2
2
 
3
3
  services:
4
4
  grafana:
5
+ user: root
5
6
  container_name: '{{ pluginId }}'
7
+
6
8
  platform: 'linux/amd64'
7
9
  build:
8
10
  context: ./.config
@@ -11,6 +13,23 @@ services:
11
13
  grafana_version: ${GRAFANA_VERSION:-{{~grafanaVersion~}} }
12
14
  ports:
13
15
  - 3000:3000/tcp
16
+ {{#if hasBackend}}
17
+ - 2345:2345/tcp # delve
18
+ security_opt:
19
+ - "apparmor:unconfined"
20
+ - "seccomp:unconfined"
21
+ cap_add:
22
+ - SYS_PTRACE
23
+ {{/if}}
14
24
  volumes:
15
25
  - ./dist:/var/lib/grafana/plugins/{{ pluginId }}
16
26
  - ./provisioning:/etc/grafana/provisioning
27
+ - .:/root/{{ pluginId }}
28
+
29
+ environment:
30
+ NODE_ENV: development
31
+ GF_LOG_FILTERS: plugin.{{ pluginId }}:debug
32
+ GF_LOG_LEVEL: debug
33
+ GF_DATAPROXY_LOGGING: 1
34
+ GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: {{ pluginId }}
35
+ GF_PLUGINS_DELVE_ENABLED: true