[v9.3.x] Server: Switch from separate server & cli to a unified grafana binary (#62443)

* Server: Switch from separate server & cli to a unified grafana binary (#58286)

* avoid the need for a second bulky binary for grafana-cli

* look for grafana-server in $PATH as well as same directory

* implement unified "grafana" command

* update dockerfiles, fix grafana-cli -v

* update packaging to work with single binary

- add wrapper scripts for grafana and grafana-server
- update and sync package files
- implement --sign flag of build package command
- stop packaging scripts folder, they are not useful for end users
- add support for --configOverrides in server command
- remove unused nfpm.yaml config file

* windows support

(cherry picked from commit de99ce139c)

* Build: don't remove grafana-server and grafana-cli binaries from deb and rpm packages (#59890)

* don't remove grafana-server and grafana-cli binaries from /usr/share/grafana/bin in deb and rpm packages

* don't add config overrides in /usr/sbin/grafana-server

---------

Co-authored-by: Dan Cech <dcech@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2023-02-02 10:41:18 +02:00
committed by GitHub
co-authored by Dan Cech
parent d3a33de503
commit e7c8704090
28 changed files with 447 additions and 331 deletions
+10 -7
View File
@@ -31,12 +31,9 @@ func Package(c *cli.Context) error {
}
cfg := config.Config{
NumWorkers: c.Int("jobs"),
NumWorkers: c.Int("jobs"),
SignPackages: c.Bool("sign"),
}
if err := gpg.LoadGPGKeys(&cfg); err != nil {
return cli.Exit(err, 1)
}
defer gpg.RemoveGPGFiles(cfg)
ctx := context.Background()
@@ -57,8 +54,14 @@ func Package(c *cli.Context) error {
log.Printf("Packaging Grafana version %q, version mode %s, %s edition, variants %s", metadata.GrafanaVersion, releaseMode.Mode,
edition, strings.Join(variantStrs, ","))
if err := gpg.Import(cfg); err != nil {
return cli.Exit(err, 1)
if cfg.SignPackages {
if err := gpg.LoadGPGKeys(&cfg); err != nil {
return cli.Exit(err, 1)
}
defer gpg.RemoveGPGFiles(cfg)
if err := gpg.Import(cfg); err != nil {
return cli.Exit(err, 1)
}
}
p := syncutil.NewWorkerPool(cfg.NumWorkers)