diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e36241 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/grafana-6.2.2.tar.gz +SOURCES/grafana_webpack-6.2.2.tar.gz diff --git a/.grafana.metadata b/.grafana.metadata new file mode 100644 index 0000000..9548389 --- /dev/null +++ b/.grafana.metadata @@ -0,0 +1,2 @@ +5714b94192991450fe8b370851c1f9dc1427eb3b SOURCES/grafana-6.2.2.tar.gz +c346463f7f726d4e3127e80c00a28904a3239c63 SOURCES/grafana_webpack-6.2.2.tar.gz diff --git a/SOURCES/001-login-oauth-use-oauth2-exchange.patch b/SOURCES/001-login-oauth-use-oauth2-exchange.patch new file mode 100644 index 0000000..d62067d --- /dev/null +++ b/SOURCES/001-login-oauth-use-oauth2-exchange.patch @@ -0,0 +1,13 @@ +diff --git a/pkg/api/login_oauth.go b/pkg/api/login_oauth.go +index a3599bc7a..0c6579847 100644 +--- a/pkg/api/login_oauth.go ++++ b/pkg/api/login_oauth.go +@@ -125,7 +125,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *m.ReqContext) { + oauthCtx := context.WithValue(context.Background(), oauth2.HTTPClient, oauthClient) + + // get token from provider +- token, err := connect.Exchange(oauthCtx, code) ++ token, err := connect.Exchange(oauthCtx, code, oauth2.AccessTypeOnline) + if err != nil { + ctx.Handle(500, "login.OAuthLogin(NewTransportWithCode)", err) + return diff --git a/SOURCES/002-remove-jaeger-tracing.patch b/SOURCES/002-remove-jaeger-tracing.patch new file mode 100644 index 0000000..1f624cc --- /dev/null +++ b/SOURCES/002-remove-jaeger-tracing.patch @@ -0,0 +1,189 @@ +diff --git a/pkg/cmd/grafana-server/server.go b/pkg/cmd/grafana-server/server.go +index 2ac326ed3..20943918c 100644 +--- a/pkg/cmd/grafana-server/server.go ++++ b/pkg/cmd/grafana-server/server.go +@@ -21,7 +21,6 @@ import ( + _ "github.com/grafana/grafana/pkg/infra/metrics" + _ "github.com/grafana/grafana/pkg/infra/remotecache" + _ "github.com/grafana/grafana/pkg/infra/serverlock" +- _ "github.com/grafana/grafana/pkg/infra/tracing" + _ "github.com/grafana/grafana/pkg/infra/usagestats" + "github.com/grafana/grafana/pkg/log" + "github.com/grafana/grafana/pkg/login" +diff --git a/pkg/infra/tracing/tracing.go b/pkg/infra/tracing/tracing.go +deleted file mode 100644 +index fd7258b7a..000000000 +--- a/pkg/infra/tracing/tracing.go ++++ /dev/null +@@ -1,129 +0,0 @@ +-package tracing +- +-import ( +- "context" +- "io" +- "strings" +- +- "github.com/grafana/grafana/pkg/log" +- "github.com/grafana/grafana/pkg/registry" +- "github.com/grafana/grafana/pkg/setting" +- +- opentracing "github.com/opentracing/opentracing-go" +- jaegercfg "github.com/uber/jaeger-client-go/config" +-) +- +-func init() { +- registry.RegisterService(&TracingService{}) +-} +- +-type TracingService struct { +- enabled bool +- address string +- customTags map[string]string +- samplerType string +- samplerParam float64 +- log log.Logger +- closer io.Closer +- +- Cfg *setting.Cfg `inject:""` +-} +- +-func (ts *TracingService) Init() error { +- ts.log = log.New("tracing") +- ts.parseSettings() +- +- if ts.enabled { +- ts.initGlobalTracer() +- } +- +- return nil +-} +- +-func (ts *TracingService) parseSettings() { +- var section, err = ts.Cfg.Raw.GetSection("tracing.jaeger") +- if err != nil { +- return +- } +- +- ts.address = section.Key("address").MustString("") +- if ts.address != "" { +- ts.enabled = true +- } +- +- ts.customTags = splitTagSettings(section.Key("always_included_tag").MustString("")) +- ts.samplerType = section.Key("sampler_type").MustString("") +- ts.samplerParam = section.Key("sampler_param").MustFloat64(1) +-} +- +-func (ts *TracingService) initGlobalTracer() error { +- cfg := jaegercfg.Configuration{ +- ServiceName: "grafana", +- Disabled: !ts.enabled, +- Sampler: &jaegercfg.SamplerConfig{ +- Type: ts.samplerType, +- Param: ts.samplerParam, +- }, +- Reporter: &jaegercfg.ReporterConfig{ +- LogSpans: false, +- LocalAgentHostPort: ts.address, +- }, +- } +- +- jLogger := &jaegerLogWrapper{logger: log.New("jaeger")} +- +- options := []jaegercfg.Option{} +- options = append(options, jaegercfg.Logger(jLogger)) +- +- for tag, value := range ts.customTags { +- options = append(options, jaegercfg.Tag(tag, value)) +- } +- +- tracer, closer, err := cfg.NewTracer(options...) +- if err != nil { +- return err +- } +- +- opentracing.InitGlobalTracer(tracer) +- +- ts.closer = closer +- +- return nil +-} +- +-func (ts *TracingService) Run(ctx context.Context) error { +- <-ctx.Done() +- +- if ts.closer != nil { +- ts.log.Info("Closing tracing") +- ts.closer.Close() +- } +- +- return nil +-} +- +-func splitTagSettings(input string) map[string]string { +- res := map[string]string{} +- +- tags := strings.Split(input, ",") +- for _, v := range tags { +- kv := strings.Split(v, ":") +- if len(kv) > 1 { +- res[kv[0]] = kv[1] +- } +- } +- +- return res +-} +- +-type jaegerLogWrapper struct { +- logger log.Logger +-} +- +-func (jlw *jaegerLogWrapper) Error(msg string) { +- jlw.logger.Error(msg) +-} +- +-func (jlw *jaegerLogWrapper) Infof(msg string, args ...interface{}) { +- jlw.logger.Info(msg, args) +-} +diff --git a/pkg/infra/tracing/tracing_test.go b/pkg/infra/tracing/tracing_test.go +deleted file mode 100644 +index 27e4de777..000000000 +--- a/pkg/infra/tracing/tracing_test.go ++++ /dev/null +@@ -1,36 +0,0 @@ +-package tracing +- +-import "testing" +- +-func TestGroupSplit(t *testing.T) { +- tests := []struct { +- input string +- expected map[string]string +- }{ +- { +- input: "tag1:value1,tag2:value2", +- expected: map[string]string{ +- "tag1": "value1", +- "tag2": "value2", +- }, +- }, +- { +- input: "", +- expected: map[string]string{}, +- }, +- { +- input: "tag1", +- expected: map[string]string{}, +- }, +- } +- +- for _, test := range tests { +- tags := splitTagSettings(test.input) +- for k, v := range test.expected { +- value, exists := tags[k] +- if !exists || value != v { +- t.Errorf("tags does not match %v ", test) +- } +- } +- } +-} diff --git a/SOURCES/003-new-files.patch b/SOURCES/003-new-files.patch new file mode 100644 index 0000000..0701856 --- /dev/null +++ b/SOURCES/003-new-files.patch @@ -0,0 +1,1627 @@ +diff --git a/conf/distro-defaults.ini b/conf/distro-defaults.ini +new file mode 100644 +index 000000000..eeb974369 +--- /dev/null ++++ b/conf/distro-defaults.ini +@@ -0,0 +1,601 @@ ++##################### Grafana Configuration Defaults for distros ##################### ++# ++# Do not modify this file in grafana installs ++# ++ ++# possible values : production, development ++app_mode = production ++ ++# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty ++instance_name = ${HOSTNAME} ++ ++#################################### Paths ############################### ++[paths] ++# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) ++data = /var/lib/grafana ++ ++# Temporary files in `data` directory older than given duration will be removed ++temp_data_lifetime = 24h ++ ++# Directory where grafana can store logs ++logs = /var/log/grafana ++ ++# Directory where grafana will automatically scan and look for plugins ++plugins = /var/lib/grafana/plugins ++ ++# folder that contains provisioning config files that grafana will apply on startup and while running. ++provisioning = conf/provisioning ++ ++#################################### Server ############################## ++[server] ++# Protocol (http, https, socket) ++protocol = http ++ ++# The ip address to bind to, empty will bind to all interfaces ++http_addr = ++ ++# The http port to use ++http_port = 3000 ++ ++# The public facing domain name used to access grafana from a browser ++domain = localhost ++ ++# Redirect to correct domain if host header does not match domain ++# Prevents DNS rebinding attacks ++enforce_domain = false ++ ++# The full public facing url ++root_url = %(protocol)s://%(domain)s:%(http_port)s/ ++ ++# Log web requests ++router_logging = false ++ ++# the path relative working path ++static_root_path = public ++ ++# enable gzip ++enable_gzip = false ++ ++# https certs & key file ++cert_file = ++cert_key = ++ ++# Unix socket path ++socket = /tmp/grafana.sock ++ ++#################################### Database ############################ ++[database] ++# You can configure the database connection by specifying type, host, name, user and password ++# as separate properties or as on string using the url property. ++ ++# Either "mysql", "postgres" or "sqlite3", it's your choice ++type = sqlite3 ++host = 127.0.0.1:3306 ++name = grafana ++user = root ++# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" ++password = ++# Use either URL or the previous fields to configure the database ++# Example: mysql://user:secret@host:port/database ++url = ++ ++# Max idle conn setting default is 2 ++max_idle_conn = 2 ++ ++# Max conn setting default is 0 (mean not set) ++max_open_conn = ++ ++# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) ++conn_max_lifetime = 14400 ++ ++# Set to true to log the sql calls and execution times. ++log_queries = ++ ++# For "postgres", use either "disable", "require" or "verify-full" ++# For "mysql", use either "true", "false", or "skip-verify". ++ssl_mode = disable ++ ++ca_cert_path = ++client_key_path = ++client_cert_path = ++server_cert_name = ++ ++# For "sqlite3" only, path relative to data_path setting ++path = grafana.db ++ ++# For "sqlite3" only. cache mode setting used for connecting to the database ++cache_mode = private ++ ++#################################### Cache server ############################# ++[remote_cache] ++# Either "redis", "memcached" or "database" default is "database" ++type = database ++ ++# cache connectionstring options ++# database: will use Grafana primary database. ++# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana` ++# memcache: 127.0.0.1:11211 ++connstr = ++ ++#################################### Data proxy ########################### ++[dataproxy] ++ ++# This enables data proxy logging, default is false ++logging = false ++ ++# How long the data proxy should wait before timing out default is 30 (seconds) ++timeout = 30 ++ ++# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. ++send_user_header = false ++ ++#################################### Analytics ########################### ++[analytics] ++# Server reporting, sends usage counters to stats.grafana.org every 24 hours. ++# No ip addresses are being tracked, only simple counters to track ++# running instances, dashboard and error counts. It is very helpful to us. ++# Change this option to false to disable reporting. ++reporting_enabled = false ++ ++# Set to false to disable all checks to https://grafana.com ++# for new versions (grafana itself and plugins), check is used ++# in some UI views to notify that grafana or plugin update exists ++# This option does not cause any auto updates, nor send any information ++# only a GET request to https://grafana.com to get latest versions ++check_for_updates = false ++ ++# Google Analytics universal tracking code, only enabled if you specify an id here ++google_analytics_ua_id = ++ ++# Google Tag Manager ID, only enabled if you specify an id here ++google_tag_manager_id = ++ ++#################################### Security ############################ ++[security] ++# default admin user, created on startup ++admin_user = admin ++ ++# default admin password, can be changed before first start of grafana, or in profile settings ++admin_password = admin ++ ++# used for signing ++secret_key = SW2YcwTIb9zpOOhoPsMm ++ ++# disable gravatar profile images ++disable_gravatar = false ++ ++# data source proxy whitelist (ip_or_domain:port separated by spaces) ++data_source_proxy_whitelist = ++ ++# disable protection against brute force login attempts ++disable_brute_force_login_protection = false ++ ++# set to true if you host Grafana behind HTTPS. default is false. ++cookie_secure = false ++ ++# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict" and "none" ++cookie_samesite = lax ++ ++# set to true if you want to allow browsers to render Grafana in a ,