Skip to content

Commit

Permalink
PMM-12045 transition to unified grafana binary (#2368)
Browse files Browse the repository at this point in the history
* PMM-12045 transition to unified grafana binary

* PMM-12045 make log.format explicit vs implicit

* PMM-12045 use the FB image to test pmm-managed

* PMM-12045 change `root_url` back to the default value

* PMM-12045 revert root_url override

* PMM-12045 use dev-latest for tests

* PMM-12045 revert all configs

* PMM-12045 test grafana server

* PMM-12045 remove the log overrides

* PMM-12045 remove the paths overrides

* PMM-12045 fix grafana-cli

* PMM-12045 add root_url to grafana.ini

* PMM-12045 remove the root_url override

* PMM-12045 set the domain in grafana.ini

* PMM-12045 trigger the build
  • Loading branch information
Alex Tymchuk authored Jul 27, 2023
1 parent 46ecd31 commit a668208
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 29 deletions.
9 changes: 1 addition & 8 deletions build/ansible/roles/pmm2-images/files/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@
[program:grafana]
priority = 3
command =
/usr/sbin/grafana-server
/usr/sbin/grafana server
--homepath=/usr/share/grafana
--config=/etc/grafana/grafana.ini
cfg:default.paths.data=/srv/grafana
cfg:default.paths.plugins=/srv/grafana/plugins
cfg:default.paths.logs=/srv/logs
cfg:default.log.mode=console
cfg:default.log.console.format=console
cfg:default.server.root_url="https://%%(domain)s/graph"

user = grafana
directory = /usr/share/grafana
autorestart = true
Expand Down
2 changes: 1 addition & 1 deletion build/packages/deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ case "$1" in
;;

*)
echo "postinst called with unknown argument \`$1'" >&2
echo "postinst called with unknown argument '$1'" >&2
exit 1
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/build-server-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ build() {
sleep 1
done
sudo yum-builddep --randomwait=5 -y SOURCES/${spec_name}.spec
sudo yum-builddep --randomwait=1 -y SOURCES/${spec_name}.spec
spectool -C SOURCES -g SOURCES/${spec_name}.spec
rpmbuild --define '_rpmdir %{_topdir}/RPMS/${spec_name}-${rpm_version}' --define 'dist .${rpmbuild_dist}' -ba SOURCES/${spec_name}.spec
Expand Down
8 changes: 1 addition & 7 deletions managed/services/supervisord/supervisord.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,15 +779,9 @@ redirect_stderr = true
[program:grafana]
priority = 3
command =
/usr/sbin/grafana-server
/usr/sbin/grafana server
--homepath=/usr/share/grafana
--config=/etc/grafana/grafana.ini
cfg:default.paths.data=/srv/grafana
cfg:default.paths.plugins=/srv/grafana/plugins
cfg:default.paths.logs=/srv/logs
cfg:default.log.mode=console
cfg:default.log.console.format=console
cfg:default.server.root_url="https://%%(domain)s/graph"
{{- if .PerconaSSODetails}}
cfg:default.server.domain="{{ .PMMServerAddress }}"
cfg:default.auth.generic_oauth.enabled=true
Expand Down
8 changes: 1 addition & 7 deletions managed/testdata/supervisord.d/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
[program:grafana]
priority = 3
command =
/usr/sbin/grafana-server
/usr/sbin/grafana server
--homepath=/usr/share/grafana
--config=/etc/grafana/grafana.ini
cfg:default.paths.data=/srv/grafana
cfg:default.paths.plugins=/srv/grafana/plugins
cfg:default.paths.logs=/srv/logs
cfg:default.log.mode=console
cfg:default.log.console.format=console
cfg:default.server.root_url="https://%%(domain)s/graph"
environment =
PERCONA_TEST_POSTGRES_ADDR="",
PERCONA_TEST_POSTGRES_DBNAME="",
Expand Down
2 changes: 1 addition & 1 deletion update/ansible/playbook/tasks/files/change-admin-password
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# Change password for default admin user in PMM

grafana-cli --config=/etc/grafana/grafana.ini --homepath /usr/share/grafana --configOverrides cfg:default.paths.data=/srv/grafana admin reset-admin-password $1
grafana cli --config=/etc/grafana/grafana.ini --homepath /usr/share/grafana admin reset-admin-password $1
18 changes: 18 additions & 0 deletions update/ansible/playbook/tasks/roles/grafana/files/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,29 @@
[paths]
# Directory where grafana will automatically scan and look for plugins
plugins = /srv/grafana/plugins
# Directory where grafana can store logs
logs = /srv/logs
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
data = /srv/grafana

#################################### Logging ##########################
[log]
# Either "console", "file", "syslog". Default is console and file
mode = console

# For "console" mode only
[log.console]
# log line format, valid options are text, console and json
format = console

#################################### Server ####################################
[server]
# enable gzip
enable_gzip = true
# The public facing domain name used to access grafana from a browser
domain = 127.0.0.1
# The full public facing url
root_url = https://%(domain)s/graph

#################################### Snapshots ###########################
[snapshots]
Expand Down
8 changes: 4 additions & 4 deletions update/ansible/playbook/tasks/roles/grafana/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
state: directory
owner: grafana
group: grafana
mode: '0775'
mode: "0775"
loop:
- /srv/grafana
- /srv/grafana/plugins

- name: Set Grafana folder for plugins on /srv partition for all users
lineinfile:
path: /etc/bashrc
line: 'export GF_PLUGIN_DIR=/srv/grafana/plugins'
line: "export GF_PLUGIN_DIR=/srv/grafana/plugins"

- name: Copy new version of grafana.ini
copy:
src: grafana.ini
dest: /etc/grafana/grafana.ini
owner: grafana
group: grafana
mode: '0444'
mode: "0444"

- name: Create provisioning directory
file:
Expand All @@ -46,5 +46,5 @@
- dashboards

- name: Upgrade grafana database (Get the latest schema)
command: grafana-cli --homepath=/usr/share/grafana admin data-migration encrypt-datasource-passwords
command: grafana cli --homepath=/usr/share/grafana admin data-migration encrypt-datasource-passwords
changed_when: True

0 comments on commit a668208

Please sign in to comment.