Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Plugin: Extend the docker-compose file #1485

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 3 additions & 29 deletions docusaurus/docs/get-started/set-up-development-environment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ version: '3.7'

services:
grafana:
container_name: 'myorg-basic-app'
extends:
file: .config/docker-compose-base.yaml
service: grafana
build:
context: ./.config
args:
grafana_version: ${GRAFANA_VERSION:-9.1.2}
grafana_image: ${GRAFANA_IMAGE:-grafana}
Expand Down Expand Up @@ -107,33 +108,6 @@ For example, in VSCode, you can add a `launch.json` configuration like this:
}
```

You can control the go version and the architecure used to build your plugin in the docker compose by setting `GO_VERSION` and `GO_ARCH` environment variables:

```yaml title="docker-compose.yaml"
version: '3.7'

services:
grafana:
container_name: 'myorg-basic-app'
build:
context: ./.config
args:
GO_VERSION: ${GO_VERSION:-1.22}
GO_ARCH: ${GO_ARCH:-amd64}
```

You will also notice that the `docker-compose.yaml` file also has the following settings:

```yaml title="docker-compose.yaml"
security_opt:
- 'apparmor:unconfined'
- 'seccomp:unconfined'
cap_add:
- SYS_PTRACE
```

they are necessary to allow delve to attach to the running process and debug it and should not be used in production environments.

## Set up GitHub workflows

Automate your development process to minimize errors and make it faster and more cost-efficient. The `create-plugin` tool helps you to configure your GitHub actions workflows to help automate your development process.
Expand Down
5 changes: 3 additions & 2 deletions packages/create-plugin/templates/common/.config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ version: '3.7'

services:
grafana:
container_name: 'myorg-basic-app'
extends:
file: .config/docker-compose-base.yaml
service: grafana
build:
context: ./.config
args:
grafana_version: ${GRAFANA_VERSION:-9.1.2}
grafana_image: ${GRAFANA_IMAGE:-grafana}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
grafana:
user: root
container_name: '{{ pluginId }}'

build:
context: .
args:
grafana_image: ${GRAFANA_IMAGE:-{{~grafanaImage~}} }
grafana_version: ${GRAFANA_VERSION:-11.3.2}
development: ${DEVELOPMENT:-false}
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
ports:
- 3000:3000/tcp
{{#if hasBackend}}
- 2345:2345/tcp # delve
security_opt:
- "apparmor:unconfined"
- "seccomp:unconfined"
cap_add:
- SYS_PTRACE
{{/if}}
volumes:
- ../dist:/var/lib/grafana/plugins/{{ pluginId }}
- ../provisioning:/etc/grafana/provisioning
- ..:/root/{{ pluginId }}

environment:
NODE_ENV: development
GF_LOG_FILTERS: plugin.{{ pluginId }}:debug
GF_LOG_LEVEL: debug
GF_DATAPROXY_LOGGING: 1
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: {{ pluginId }}
34 changes: 3 additions & 31 deletions packages/create-plugin/templates/common/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
services:
grafana:
user: root
container_name: '{{ pluginId }}'

build:
context: ./.config
args:
grafana_image: ${GRAFANA_IMAGE:-{{~grafanaImage~}} }
grafana_version: ${GRAFANA_VERSION:-11.3.2}
development: ${DEVELOPMENT:-false}
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
ports:
- 3000:3000/tcp
{{#if hasBackend}}
- 2345:2345/tcp # delve
security_opt:
- "apparmor:unconfined"
- "seccomp:unconfined"
cap_add:
- SYS_PTRACE
{{/if}}
volumes:
- ./dist:/var/lib/grafana/plugins/{{ pluginId }}
- ./provisioning:/etc/grafana/provisioning
- .:/root/{{ pluginId }}

environment:
NODE_ENV: development
GF_LOG_FILTERS: plugin.{{ pluginId }}:debug
GF_LOG_LEVEL: debug
GF_DATAPROXY_LOGGING: 1
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: {{ pluginId }}
extends:
file: .config/docker-compose-base.yaml
service: grafana
Loading