From 8d2aac09366ba674663761cb16af31f319ab174c Mon Sep 17 00:00:00 2001 From: Ali Anwar Date: Sat, 11 Aug 2018 23:42:31 -0700 Subject: [PATCH 01/12] Fix typo --- docs/sources/http_api/folder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/http_api/folder.md b/docs/sources/http_api/folder.md index fb318ecf58e..e8845c3b125 100644 --- a/docs/sources/http_api/folder.md +++ b/docs/sources/http_api/folder.md @@ -223,7 +223,7 @@ Status Codes: - **404** – Folder not found - **412** – Precondition failed -The **412** status code is used for explaing that you cannot update the folder and why. +The **412** status code is used for explaining that you cannot update the folder and why. There can be different reasons for this: - The folder has been changed by someone else, `status=version-mismatch` From 5fd8849d656d4ee90d24c394924010ce49f8089d Mon Sep 17 00:00:00 2001 From: Ali Anwar Date: Sat, 11 Aug 2018 23:44:15 -0700 Subject: [PATCH 02/12] Update dashboard.md --- docs/sources/http_api/dashboard.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/http_api/dashboard.md b/docs/sources/http_api/dashboard.md index ea1bd7f2ef7..3df36894901 100644 --- a/docs/sources/http_api/dashboard.md +++ b/docs/sources/http_api/dashboard.md @@ -85,7 +85,7 @@ Status Codes: - **403** – Access denied - **412** – Precondition failed -The **412** status code is used for explaing that you cannot create the dashboard and why. +The **412** status code is used for explaining that you cannot create the dashboard and why. There can be different reasons for this: - The dashboard has been changed by someone else, `status=version-mismatch` From 2459b177f914a12438424cf068638b9ce107d115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 13 Aug 2018 18:09:01 +0200 Subject: [PATCH 03/12] change: Set User-Agent to Grafana/%Version% Proxied-DS-Request %DS-Type% in all proxied ds requests --- pkg/api/pluginproxy/ds_proxy.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/api/pluginproxy/ds_proxy.go b/pkg/api/pluginproxy/ds_proxy.go index b420398f9a9..74ad4e226fd 100644 --- a/pkg/api/pluginproxy/ds_proxy.go +++ b/pkg/api/pluginproxy/ds_proxy.go @@ -203,6 +203,7 @@ func (proxy *DataSourceProxy) getDirector() func(req *http.Request) { req.Header.Del("X-Forwarded-Host") req.Header.Del("X-Forwarded-Port") req.Header.Del("X-Forwarded-Proto") + req.Header.Set("User-Agent", fmt.Sprintf("Grafana/%s Proxied-DS-Request %s", setting.BuildVersion, proxy.ds.Type)) // set X-Forwarded-For header if req.RemoteAddr != "" { From 4f704cec532529542dbc8c1912e666e168d4b36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 14 Aug 2018 09:18:04 +0200 Subject: [PATCH 04/12] fix: ds_proxy test not initiating header --- pkg/api/pluginproxy/ds_proxy_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/pluginproxy/ds_proxy_test.go b/pkg/api/pluginproxy/ds_proxy_test.go index bb553b4d075..9b768c3d32a 100644 --- a/pkg/api/pluginproxy/ds_proxy_test.go +++ b/pkg/api/pluginproxy/ds_proxy_test.go @@ -219,7 +219,7 @@ func TestDSRouteRule(t *testing.T) { proxy := NewDataSourceProxy(ds, plugin, ctx, "/render") requestURL, _ := url.Parse("http://grafana.com/sub") - req := http.Request{URL: requestURL} + req := http.Request{URL: requestURL, Header: http.Header{}} proxy.getDirector()(&req) @@ -244,7 +244,7 @@ func TestDSRouteRule(t *testing.T) { proxy := NewDataSourceProxy(ds, plugin, ctx, "") requestURL, _ := url.Parse("http://grafana.com/sub") - req := http.Request{URL: requestURL} + req := http.Request{URL: requestURL, Header: http.Header{}} proxy.getDirector()(&req) From ad1cf6c2b80ddc85e02d933740c3b7f1c090fb18 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 14 Aug 2018 14:55:07 +0200 Subject: [PATCH 05/12] changelog: add notes about closing #5623 [skip ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bd9cb917d7..34d3c82916e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 5.3.0 (unreleased) +* **OAuth**: Gitlab OAuth with support for filter by groups [#5623](https://github.com/grafana/grafana/issues/5623), thx [@BenoitKnecht](https://github.com/BenoitKnecht) * **Dataproxy**: Pass configured/auth headers to a Datasource [#10971](https://github.com/grafana/grafana/issues/10971), thx [@mrsiano](https://github.com/mrsiano) * **Cleanup**: Make temp file time to live configurable [#11607](https://github.com/grafana/grafana/issues/11607), thx [@xapon](https://github.com/xapon) * **LDAP**: Define Grafana Admin permission in ldap group mappings [#2469](https://github.com/grafana/grafana/issues/2496), PR [#12622](https://github.com/grafana/grafana/issues/12622) From c5c518fd177459a7a2711d28c01c1f4c162e7edd Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 14 Aug 2018 15:17:29 +0200 Subject: [PATCH 06/12] docs: remove message property in response from get alerts http api Fixes #12524 --- docs/sources/http_api/alerting.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sources/http_api/alerting.md b/docs/sources/http_api/alerting.md index e4fe0dad3ff..80b6e283be3 100644 --- a/docs/sources/http_api/alerting.md +++ b/docs/sources/http_api/alerting.md @@ -59,7 +59,6 @@ Content-Type: application/json "panelId": 1, "name": "fire place sensor", "state": "alerting", - "message": "Someone is trying to break in through the fire place", "newStateDate": "2018-05-14T05:55:20+02:00", "evalDate": "0001-01-01T00:00:00Z", "evalData": null, From 6a8b1e14cc9620b586273f47175b4c30f0f7079d Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Tue, 14 Aug 2018 16:37:38 +0200 Subject: [PATCH 07/12] docs: cloudwatch dimensions reference link. --- docs/sources/features/datasources/cloudwatch.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sources/features/datasources/cloudwatch.md b/docs/sources/features/datasources/cloudwatch.md index d178c176602..7adc6ebe4fb 100644 --- a/docs/sources/features/datasources/cloudwatch.md +++ b/docs/sources/features/datasources/cloudwatch.md @@ -115,6 +115,8 @@ and `dimension keys/values`. In place of `region` you can specify `default` to use the default region configured in the datasource for the query, e.g. `metrics(AWS/DynamoDB, default)` or `dimension_values(default, ..., ..., ...)`. +Read more about the available dimensions in the [CloudWatch Metrics and Dimensions Reference](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html). + Name | Description ------- | -------- *regions()* | Returns a list of regions AWS provides their service. From 13921902b5bd988735967697d103f2bb4ee10293 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Wed, 15 Aug 2018 09:46:59 +0200 Subject: [PATCH 08/12] Set User-Agent header in all proxied datasource requests Header value will be Grafana/%version%, i.e. Grafana/5.3.0 --- pkg/api/pluginproxy/ds_proxy.go | 2 +- pkg/api/pluginproxy/ds_proxy_test.go | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/api/pluginproxy/ds_proxy.go b/pkg/api/pluginproxy/ds_proxy.go index 74ad4e226fd..c8056040d24 100644 --- a/pkg/api/pluginproxy/ds_proxy.go +++ b/pkg/api/pluginproxy/ds_proxy.go @@ -203,7 +203,7 @@ func (proxy *DataSourceProxy) getDirector() func(req *http.Request) { req.Header.Del("X-Forwarded-Host") req.Header.Del("X-Forwarded-Port") req.Header.Del("X-Forwarded-Proto") - req.Header.Set("User-Agent", fmt.Sprintf("Grafana/%s Proxied-DS-Request %s", setting.BuildVersion, proxy.ds.Type)) + req.Header.Set("User-Agent", fmt.Sprintf("Grafana/%s", setting.BuildVersion)) // set X-Forwarded-For header if req.RemoteAddr != "" { diff --git a/pkg/api/pluginproxy/ds_proxy_test.go b/pkg/api/pluginproxy/ds_proxy_test.go index 9b768c3d32a..ad331113f46 100644 --- a/pkg/api/pluginproxy/ds_proxy_test.go +++ b/pkg/api/pluginproxy/ds_proxy_test.go @@ -212,20 +212,21 @@ func TestDSRouteRule(t *testing.T) { }) Convey("When proxying graphite", func() { + setting.BuildVersion = "5.3.0" plugin := &plugins.DataSourcePlugin{} ds := &m.DataSource{Url: "htttp://graphite:8080", Type: m.DS_GRAPHITE} ctx := &m.ReqContext{} proxy := NewDataSourceProxy(ds, plugin, ctx, "/render") + req, err := http.NewRequest(http.MethodGet, "http://grafana.com/sub", nil) + So(err, ShouldBeNil) - requestURL, _ := url.Parse("http://grafana.com/sub") - req := http.Request{URL: requestURL, Header: http.Header{}} - - proxy.getDirector()(&req) + proxy.getDirector()(req) Convey("Can translate request url and path", func() { So(req.URL.Host, ShouldEqual, "graphite:8080") So(req.URL.Path, ShouldEqual, "/render") + So(req.Header.Get("User-Agent"), ShouldEqual, "Grafana/5.3.0") }) }) @@ -243,10 +244,10 @@ func TestDSRouteRule(t *testing.T) { ctx := &m.ReqContext{} proxy := NewDataSourceProxy(ds, plugin, ctx, "") - requestURL, _ := url.Parse("http://grafana.com/sub") - req := http.Request{URL: requestURL, Header: http.Header{}} + req, err := http.NewRequest(http.MethodGet, "http://grafana.com/sub", nil) + So(err, ShouldBeNil) - proxy.getDirector()(&req) + proxy.getDirector()(req) Convey("Should add db to url", func() { So(req.URL.Path, ShouldEqual, "/db/site/") From 713fac8e7810f886aff8b511f9df8c33fdb5fac9 Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Wed, 15 Aug 2018 10:32:17 +0200 Subject: [PATCH 09/12] build: duplicate docker run-script removed. --- scripts/docker/run.sh | 67 ------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100755 scripts/docker/run.sh diff --git a/scripts/docker/run.sh b/scripts/docker/run.sh deleted file mode 100755 index df64ce3adf4..00000000000 --- a/scripts/docker/run.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -e - -PERMISSIONS_OK=0 - -if [ ! -r "$GF_PATHS_CONFIG" ]; then - echo "GF_PATHS_CONFIG='$GF_PATHS_CONFIG' is not readable." - PERMISSIONS_OK=1 -fi - -if [ ! -w "$GF_PATHS_DATA" ]; then - echo "GF_PATHS_DATA='$GF_PATHS_DATA' is not writable." - PERMISSIONS_OK=1 -fi - -if [ ! -r "$GF_PATHS_HOME" ]; then - echo "GF_PATHS_HOME='$GF_PATHS_HOME' is not readable." - PERMISSIONS_OK=1 -fi - -if [ $PERMISSIONS_OK -eq 1 ]; then - echo "You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later" -fi - -if [ ! -d "$GF_PATHS_PLUGINS" ]; then - mkdir "$GF_PATHS_PLUGINS" -fi - - -if [ ! -z ${GF_AWS_PROFILES+x} ]; then - > "$GF_PATHS_HOME/.aws/credentials" - - for profile in ${GF_AWS_PROFILES}; do - access_key_varname="GF_AWS_${profile}_ACCESS_KEY_ID" - secret_key_varname="GF_AWS_${profile}_SECRET_ACCESS_KEY" - region_varname="GF_AWS_${profile}_REGION" - - if [ ! -z "${!access_key_varname}" -a ! -z "${!secret_key_varname}" ]; then - echo "[${profile}]" >> "$GF_PATHS_HOME/.aws/credentials" - echo "aws_access_key_id = ${!access_key_varname}" >> "$GF_PATHS_HOME/.aws/credentials" - echo "aws_secret_access_key = ${!secret_key_varname}" >> "$GF_PATHS_HOME/.aws/credentials" - if [ ! -z "${!region_varname}" ]; then - echo "region = ${!region_varname}" >> "$GF_PATHS_HOME/.aws/credentials" - fi - fi - done - - chmod 600 "$GF_PATHS_HOME/.aws/credentials" -fi - -if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then - OLDIFS=$IFS - IFS=',' - for plugin in ${GF_INSTALL_PLUGINS}; do - IFS=$OLDIFS - grafana-cli --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${plugin} - done -fi - -exec grafana-server \ - --homepath="$GF_PATHS_HOME" \ - --config="$GF_PATHS_CONFIG" \ - "$@" \ - cfg:default.log.mode="console" \ - cfg:default.paths.data="$GF_PATHS_DATA" \ - cfg:default.paths.logs="$GF_PATHS_LOGS" \ - cfg:default.paths.plugins="$GF_PATHS_PLUGINS" \ - cfg:default.paths.provisioning="$GF_PATHS_PROVISIONING" \ No newline at end of file From d244b59cc19f28bf5ccd7a7da4a89ba9ce83c2bd Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Thu, 16 Aug 2018 13:15:50 +0200 Subject: [PATCH 10/12] docs: docker and restarts. Closes #10784 --- docs/sources/installation/docker.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sources/installation/docker.md b/docs/sources/installation/docker.md index 1f755625699..2a6af952a2b 100644 --- a/docs/sources/installation/docker.md +++ b/docs/sources/installation/docker.md @@ -38,6 +38,8 @@ The back-end web server has a number of configuration options. Go to the [Configuration]({{< relref "configuration.md" >}}) page for details on all those options. +> For any changes to `conf/grafana.ini` (or corresponding environment variables) to take effect you need to restart Grafana by restarting the Docker container. + ## Running a Specific Version of Grafana ```bash From 0ce8a6a69d11dfb53415e16cf789d7598a52f219 Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Thu, 16 Aug 2018 13:32:21 +0200 Subject: [PATCH 11/12] docs: cleanup. --- docs/sources/installation/docker.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/sources/installation/docker.md b/docs/sources/installation/docker.md index 2a6af952a2b..6bf25ad8232 100644 --- a/docs/sources/installation/docker.md +++ b/docs/sources/installation/docker.md @@ -51,10 +51,13 @@ $ docker run \ grafana/grafana:5.1.0 ``` -## Running of the master branch +## Running the master branch -For every successful commit we publish a Grafana container to [`grafana/grafana`](https://hub.docker.com/r/grafana/grafana/tags/) and [`grafana/grafana-dev`](https://hub.docker.com/r/grafana/grafana-dev/tags/). In `grafana/grafana` container we will always overwrite the `master` tag with the latest version. In `grafana/grafana-dev` we will include -the git commit in the tag. If you run Grafana master in production we **strongly** recommend that you use the later since different machines might run different version of grafana if they pull the master tag at different times. +For every successful build of the master branch we update the `grafana/grafana:master` tag and create a new tag `grafana/grafana-dev:master-` with the hash of the git commit that was built. This means you can always get the latest version of Grafana. + +When running Grafana master in production we **strongly** recommend that you use the `grafana/grafana-dev:master-` tag as that will guarantee that you use a specific version of Grafana instead of whatever was the most recent commit at the time. + +For a list of available tags, check out [grafana/grafana](https://hub.docker.com/r/grafana/grafana/tags/) and [grafana/grafana-dev](https://hub.docker.com/r/grafana/grafana-dev/tags/). ## Installing Plugins for Grafana From cc50cfd9d37bfda4e355e82e322af0659ca7e4fd Mon Sep 17 00:00:00 2001 From: Leonard Gram Date: Thu, 16 Aug 2018 11:14:12 +0200 Subject: [PATCH 12/12] build: beta versions no longer tagged as latest. Closes #12862 --- packaging/docker/push_to_docker_hub.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/docker/push_to_docker_hub.sh b/packaging/docker/push_to_docker_hub.sh index 3cf97d580ca..526c216f8fa 100755 --- a/packaging/docker/push_to_docker_hub.sh +++ b/packaging/docker/push_to_docker_hub.sh @@ -15,10 +15,10 @@ fi echo "pushing ${_docker_repo}:${_grafana_version}" docker push "${_docker_repo}:${_grafana_version}" -if echo "$_grafana_tag" | grep -q "^v"; then +if echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -vq "beta"; then echo "pushing ${_docker_repo}:latest" docker push "${_docker_repo}:latest" -else +elif echo "$_grafana_tag" | grep -q "master"; then echo "pushing grafana/grafana:master" docker push grafana/grafana:master fi