grafana/pkg
Giuseppe Guerra af1e2d68da
Plugins: Allow loading panel plugins from a CDN (#59096)
* POC: Plugins CDN reverse proxy

* CDN proxy POC: changed env var names

* Add authorization: false for /public path in frontend plugin loader

* Moved CDN settings to Cfg, add some comments

* Fix error 500 in asset fetch if plugin is not using CDN

* Fix EnterpriseLicensePath declared twice

* Fix linter complaining about whitespaces

* Plugins CDN: Skip signature verification for CDN plugins

* Plugins CDN: Skip manifest and signature check for cdn plugins

* Plugins: use IsValid() and IsInternal() rather than equality checks

* Plugins CDN: remove comment

* Plugins CDN: Fix seeker can't seek when serving plugins from local fs

* Plugins CDN: add back error codes in getLocalPluginAssets

* Plugins CDN: call asset.Close() rather than asset.readSeekCloser.Close()

* Plugins CDN: Fix panic in JsonApiErr when errorMessageCoder wraps a nil error

* Plugins CDN: Add error handling to proxyCDNPluginAsset

* Plugins CDN: replace errorMessageCoder with errutil

* Plugins CDN POC: expose cdn plugin paths to frontend for system.js

* Plugins CDN: Fix cdn plugins showing as unsigned in frontend

* WIP: Add support for formatted URL

* Fix missing cdnPluginsBaseURLs in GrafanaConfig

* Plugins CDN: Remove reverse proxy mode and reverse proxy references

* Plugins CDN: Simplify asset serving logic

* Plugins CDN: sanitize redirect path

* Plugins CDN: Removed unused pluginAsset type

* Plugins CDN: Removed system.js changes

* Plugins CDN: Return different system.js baseURL and module for cdn plugins

* Plugins CDN: Ensure CDN is disabled for non-external plugins

* lint

* Plugins CDN: serve images and screenshots from CDN, refactoring

* Lint

* Plugins CDN: Fix URLs for system.js (baseUrl and module)

* Plugins CDN: Add more tests for RelativeURLForSystemJS

* Plugins CDN: Iterate only on apps when preloading

* Plugins CDN: Refactoring

* Plugins CDN: Add comments to url_constructor.go

* Plugins CDN: Update defaultHGPluginsCDNBaseURL

* Plugins CDN: undo extract meta from system js config

* refactor(plugins): migrate systemjs css plugin to typescript

* feat(plugins): introduce systemjs cdn loader plugin

* feat(plugins): add systemjs load type

* Plugins CDN: Removed RelativeURLForSystemJS

* Plugins CDN: Log backend redirect hits along with plugin info

* Plugins CDN: Add pluginsCDNBasePath to getFrontendSettingsMap

* feat(plugins): introduce cdn loading for angular plugins

* refactor(plugins): move systemjs cache buster into systemjsplugins directory

* Plugins CDN: Rename pluginsCDNBasePath to pluginsCDNBaseURL

* refactor(plugins): introduce pluginsCDNBaseURL to the frontend

* Plugins CDN: Renamed "cdn base path" to "cdn url template" in backend

* Plugins CDN: lint

* merge with main

* Instrumentation: Add prometheus counter for backend hits, log from Info to Warn

* Config: Changed key from plugins_cdn.url to plugins.plugins_cdn_base_url

* CDN: Add backend tests

* Lint: goimports

* Default CDN URL to empty string,

* Do not use CDN in setImages and module if the url template is empty

* CDN: Backend: Add test for frontend settings

* CDN: Do not log missing module.js warn if plugin is being loaded from CDN

* CDN: Add backend test for CDN plugin loader

* Removed 'cdn' signature level, switch to 'valid'

* Fix pfs.TestParseTreeTestdata for cdn plugin testdata dir

* Fix TestLoader_Load

* Fix gocyclo complexity of loadPlugins

* Plugins CDN: Moved prometheus metric to api package, removed asset_path label

* Fix missing  in config

* Changes after review

* Add pluginscdn.Service

* Fix tests

* Refactoring

* Moved all remaining CDN checks inside pluginscdn.Service

* CDN url constructor: Renamed stringURLFor to stringPath

* CDN: Moved asset URL functionality to assetpath service

* CDN: Renamed HasCDN() to IsEnabled()

* CDN: Replace assert with require

* CDN: Changes after review

* Assetpath: Handle url.Parse error

* Fix plugin_resource_test

* CDN: Change fallback redirect from 302 to 307

* goimports

* Fix tests

* Switch to contextmodel.ReqContext in plugins.go

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-01-27 15:08:17 +01:00
..
api Plugins: Allow loading panel plugins from a CDN (#59096) 2023-01-27 15:08:17 +01:00
build Packages: Fix upload-packages case for Enterprise2 mode (#61772) 2023-01-26 11:52:15 +02:00
bus Chore: Upgrade golangci-lint to v1.50.1 (#60379) 2022-12-15 12:58:48 +01:00
cmd k8s: add feature toggle and stub to save dashboards k8s (#62053) 2023-01-25 11:10:16 -08:00
codegen Kindsys: Simpler PascalCase name handling (#62150) 2023-01-25 20:29:10 +00:00
components Loki: Push support for multi-tenancy mode (#60866) 2023-01-23 16:24:22 +01:00
cuectx Kindsys: Unify plugins, pfs with kind framework (#61192) 2023-01-20 09:41:35 +00:00
events Alerting: Update rules version when folder title is updated (#53013) 2022-08-01 19:28:38 -04:00
expr Chore: Fix random indices for slices in test files (#61884) 2023-01-24 15:07:37 -03:00
extensions Dependencies: Clean up gofrs/uuid (#51615) 2022-06-30 10:55:33 -08:00
ifaces/gcsifaces Chore: Upgrade Go to 1.19.1 (#54902) 2022-09-12 12:03:49 +02:00
infra Chore: Move ReqContext to contexthandler service (#62102) 2023-01-27 08:50:36 +01:00
kinds Schema: Create PublicDashboard core kind (#62155) 2023-01-26 10:51:00 -03:00
kindsys NodeGraph: Schema for panel options (#62121) 2023-01-26 18:02:41 +01:00
login Server: Remove unused services (#62015) 2023-01-26 16:13:22 +01:00
middleware Chore: Move ReqContext to contexthandler service (#62102) 2023-01-27 08:50:36 +01:00
mocks/mock_gcsifaces Plugins: Requests validator (#30445) 2021-02-03 20:47:45 +01:00
models Chore: Move ReqContext to contexthandler service (#62102) 2023-01-27 08:50:36 +01:00
plugins Plugins: Allow loading panel plugins from a CDN (#59096) 2023-01-27 15:08:17 +01:00
registry Schema: Create PublicDashboard core kind (#62155) 2023-01-26 10:51:00 -03:00
server Server: Remove unused services (#62015) 2023-01-26 16:13:22 +01:00
services Plugins: Allow loading panel plugins from a CDN (#59096) 2023-01-27 15:08:17 +01:00
setting Plugins: Allow loading panel plugins from a CDN (#59096) 2023-01-27 15:08:17 +01:00
tests TestData: Introduce schema types (#62130) 2023-01-26 15:31:34 +00:00
tsdb TestData: Introduce schema types (#62130) 2023-01-26 15:31:34 +00:00
util [Xorm] remove oracle driver + unused function (#62125) 2023-01-26 22:24:11 +08:00
web Chore: Move ReqContext to contexthandler service (#62102) 2023-01-27 08:50:36 +01:00
README.md Chore: Move all backend contribution documents to a single directory (#61140) 2023-01-11 11:16:52 +01:00
ruleguard.rules.go Chore: update all +build statements (#38782) 2021-09-01 17:38:56 +03:00

This directory contains the code for the Grafana backend.

The contributor documentation for Grafana's backend is in /contribute/backend/README.md.