-
Notifications
You must be signed in to change notification settings - Fork 0
feat(grafana): add grafana #16
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
Open
netanelC
wants to merge
11
commits into
master
Choose a base branch
from
add-grafana
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9ff42b3
feat(grafana): add grafana
netanelC 6b463ae
style(grafana): fix hadolint errors
netanelC 3165524
ci(global): replacing megalinter with the official action
netanelC 9b8f713
ci(global): use proper secret
netanelC a8cd2ad
ci(global): latest version of megalinter
netanelC 2fec39d
style(global): remove unnecessary folder from prettier
netanelC 2f22399
ci(global): permissions
netanelC a1897b6
fix(global): apply megalinter comment
netanelC a4937d4
ci(global): fix lint warnings
netanelC 055929c
feat(global): disable osv scanner
netanelC 331a339
fix(global): pr comments
netanelC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
| { | ||
| "threshold": 0, | ||
| "reporters": ["html", "markdown"], | ||
| "ignore": [ | ||
| "**/node_modules/**", | ||
| "**/.git/**", | ||
| "**/.rbenv/**", | ||
| "**/.venv/**", | ||
| "**/*cache*/**", | ||
| "**/.github/**", | ||
| "**/.idea/**", | ||
| "**/report/**", | ||
| "**/*.svg" | ||
| ] | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ README.md | |
| node_modules | ||
| .release-please-manifest.json | ||
| .ruff_cache/ | ||
| .mypy_cache/ | ||
This file contains hidden or 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 hidden or 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,36 @@ | ||
| # We use an ARG to dynamically set the base version from CI | ||
| ARG GRAFANA_VERSION=12.3.1 | ||
|
|
||
| # --- Stage 1: Downloader --- | ||
| FROM alpine:3.19 AS downloader | ||
|
|
||
| # Prevents silent pipeline failures | ||
| SHELL ["/bin/ash", "-eo", "pipefail", "-c"] | ||
|
|
||
| # Install tools needed to parse YAML and extract zips | ||
| RUN apk add --no-cache curl yq unzip | ||
|
|
||
| WORKDIR /downloads | ||
| COPY plugins.yaml . | ||
|
|
||
| # Parse the YAML file and download/extract each plugin | ||
| RUN mkdir -p /plugins && \ | ||
| yq e '.plugins[] | .name + " " + .version' plugins.yaml | while read -r plugin version; do \ | ||
| echo "Downloading $plugin version $version..."; \ | ||
| curl -fL -o "/tmp/${plugin}.zip" "https://grafana.com/api/plugins/${plugin}/versions/${version}/download"; \ | ||
| unzip -q "/tmp/${plugin}.zip" -d "/plugins/${plugin}"; \ | ||
| rm "/tmp/${plugin}.zip"; \ | ||
| done | ||
|
|
||
| # --- Stage 2: Final Image --- | ||
| FROM grafana/grafana:${GRAFANA_VERSION} | ||
|
|
||
| USER root | ||
|
|
||
| # Copy only the extracted plugins from the downloader stage | ||
| COPY --from=downloader /plugins /opt/grafana/plugins | ||
|
|
||
| # Ensure Grafana owns the plugins directory | ||
| RUN chown -R 472:0 /opt/grafana/plugins | ||
|
|
||
| USER grafana | ||
This file contains hidden or 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,19 @@ | ||
| # Grafana with Pre-installed Plugins | ||
|
|
||
| This is a customized container image of [Grafana](https://grafana.com/), extending the official image to include pre-installed plugins. | ||
|
|
||
| ## What this container does | ||
|
|
||
| The default Grafana image allows installing plugins at runtime via environment variables (e.g., `GF_INSTALL_PLUGINS`). However, downloading plugins at runtime can increase startup time, introduce dependencies on external network availability, and fail in air-gapped environments. | ||
|
|
||
| This image extends `grafana/grafana` with the following adjustments: | ||
|
|
||
| - Uses a multi-stage build to download and extract plugins defined in `plugins.yaml`. | ||
| - Bakes the extracted plugins directly into the `/var/lib/grafana/plugins` directory of the final image. | ||
| - Ensures the correct permissions (`472:0`) are applied so Grafana can read the plugins seamlessly. | ||
|
|
||
| To update or add new plugins, modify the `plugins.yaml` file and rebuild the image. | ||
|
|
||
| ## Base Image | ||
|
|
||
| - `grafana/grafana` |
This file contains hidden or 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,7 @@ | ||
| plugins: | ||
| - name: redis-datasource | ||
| version: 2.2.0 | ||
| - name: redis-app | ||
| version: 2.3.2 | ||
| - name: magnesium-wordcloud-panel | ||
| version: 1.2.11 |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems that /opt will not work, did you check it?
https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/#default-paths:~:text=grafana%2Ddev.-,Default%20paths,-Grafana%20comes%20with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it with the default value removed the existing plugins I installed from the Docker and started all from the default plugins. Only customizing the plugins dir allowed me to deploy Grafana with the desired plugins