2020-06-17 05:20:45 +00:00
|
|
|
|
2023-12-06 06:26:44 +00:00
|
|
|
GRAFANA_VERSION ?= 9.4.12-1
|
2022-04-06 09:54:41 +00:00
|
|
|
PIECHART_VERSION ?= "1.6.2"
|
|
|
|
STATUS_PANEL_VERSION ?= "1.0.11"
|
2021-11-23 08:30:38 +00:00
|
|
|
DASHBOARD_DIR := "../../ceph-mixin/dashboards_out"
|
2020-06-17 05:20:45 +00:00
|
|
|
DASHBOARD_PROVISIONING := "ceph-dashboard.yml"
|
2022-03-21 12:10:03 +00:00
|
|
|
IMAGE := "docker.io/redhat/ubi8:8.5"
|
2020-06-17 05:20:45 +00:00
|
|
|
PKGMGR := "dnf"
|
|
|
|
GF_CONFIG := "/etc/grafana/grafana.ini"
|
2021-05-26 02:44:02 +00:00
|
|
|
# clip off "-<whatever> from the end of GRAFANA_VERSION
|
|
|
|
CONTAINER_VERSION := $(shell /bin/echo $(GRAFANA_VERSION) | /bin/sed 's/-.*//')
|
2020-06-17 05:20:45 +00:00
|
|
|
|
2021-04-28 03:01:36 +00:00
|
|
|
ARCH ?= x86_64
|
|
|
|
ifeq "$(ARCH)" "arm64"
|
|
|
|
override ARCH := aarch64
|
|
|
|
endif
|
|
|
|
|
2021-05-26 02:44:02 +00:00
|
|
|
LOCALTAG=ceph-grafana:$(CONTAINER_VERSION)-$(ARCH)
|
|
|
|
TAG=ceph/ceph-grafana:$(CONTAINER_VERSION)-$(ARCH)
|
|
|
|
|
2020-06-17 05:20:45 +00:00
|
|
|
# Build a grafana instance - preconfigured for use within Ceph's dashboard UI
|
|
|
|
|
2021-04-28 03:31:51 +00:00
|
|
|
build :
|
2020-06-17 05:20:45 +00:00
|
|
|
echo "Creating base container"
|
2021-04-28 03:33:38 +00:00
|
|
|
$(eval CONTAINER := $(shell sudo buildah from ${IMAGE}))
|
2020-06-17 05:20:45 +00:00
|
|
|
# Using upstream grafana build
|
2021-04-28 23:34:00 +00:00
|
|
|
curl -fLO https://dl.grafana.com/oss/release/grafana-${GRAFANA_VERSION}.${ARCH}.rpm
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah copy $(CONTAINER) grafana-${GRAFANA_VERSION}.${ARCH}.rpm /tmp/grafana-${GRAFANA_VERSION}.${ARCH}.rpm
|
|
|
|
sudo buildah run $(CONTAINER) ${PKGMGR} install -y --setopt install_weak_deps=false --setopt=tsflags=nodocs /tmp/grafana-${GRAFANA_VERSION}.${ARCH}.rpm
|
|
|
|
sudo buildah run $(CONTAINER) ${PKGMGR} clean all
|
|
|
|
sudo buildah run $(CONTAINER) rm -f /tmp/grafana*.rpm
|
|
|
|
sudo buildah run $(CONTAINER) grafana-cli plugins install grafana-piechart-panel ${PIECHART_VERSION}
|
|
|
|
sudo buildah run $(CONTAINER) grafana-cli plugins install vonage-status-panel ${STATUS_PANEL_VERSION}
|
|
|
|
sudo buildah run $(CONTAINER) mkdir -p /etc/grafana/dashboards/ceph-dashboard
|
|
|
|
sudo buildah copy $(CONTAINER) ${DASHBOARD_DIR}/*.json /etc/grafana/dashboards/ceph-dashboard
|
2020-06-17 05:20:45 +00:00
|
|
|
|
|
|
|
@/bin/echo -e "\
|
|
|
|
apiVersion: 1 \\n\
|
|
|
|
providers: \\n\
|
|
|
|
- name: 'Ceph Dashboard' \\n\
|
|
|
|
torgId: 1 \\n\
|
|
|
|
folder: 'ceph-dashboard' \\n\
|
|
|
|
type: file \\n\
|
|
|
|
disableDeletion: false \\n\
|
|
|
|
updateIntervalSeconds: 3 \\n\
|
|
|
|
editable: false \\n\
|
|
|
|
options: \\n\
|
|
|
|
path: '/etc/grafana/dashboards/ceph-dashboard'" >> ${DASHBOARD_PROVISIONING}
|
|
|
|
|
|
|
|
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah copy $(CONTAINER) ${DASHBOARD_PROVISIONING} /etc/grafana/provisioning/dashboards/${DASHBOARD_PROVISIONING}
|
2020-06-17 05:20:45 +00:00
|
|
|
|
|
|
|
# expose tcp/3000 for grafana
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah config --port 3000 $(CONTAINER)
|
2020-06-17 05:20:45 +00:00
|
|
|
|
|
|
|
# set working dir
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah config --workingdir /usr/share/grafana $(CONTAINER)
|
2020-06-17 05:20:45 +00:00
|
|
|
|
|
|
|
# set environment overrides from the default locations in /usr/share
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah config --env GF_PATHS_LOGS="/var/log/grafana" $(CONTAINER)
|
|
|
|
sudo buildah config --env GF_PATHS_PLUGINS="/var/lib/grafana/plugins" $(CONTAINER)
|
|
|
|
sudo buildah config --env GF_PATHS_PROVISIONING="/etc/grafana/provisioning" $(CONTAINER)
|
|
|
|
sudo buildah config --env GF_PATHS_DATA="/var/lib/grafana" $(CONTAINER)
|
2020-06-17 05:20:45 +00:00
|
|
|
|
|
|
|
# entrypoint
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah config --entrypoint "grafana-server --config=${GF_CONFIG}" $(CONTAINER)
|
2020-06-17 05:20:45 +00:00
|
|
|
|
|
|
|
# finalize
|
2021-04-28 03:33:38 +00:00
|
|
|
sudo buildah config --label maintainer="Paul Cuzner <pcuzner@redhat.com>" $(CONTAINER)
|
|
|
|
sudo buildah config --label description="Ceph Grafana Container" $(CONTAINER)
|
|
|
|
sudo buildah config --label summary="Grafana Container configured for Ceph mgr/dashboard integration" $(CONTAINER)
|
2021-05-26 02:44:02 +00:00
|
|
|
sudo buildah commit --format docker --squash $(CONTAINER) $(LOCALTAG)
|
|
|
|
|
|
|
|
push:
|
2022-03-23 08:29:28 +00:00
|
|
|
sudo podman tag ${LOCALTAG} quay.io/${TAG}
|
2021-05-26 19:47:36 +00:00
|
|
|
# sudo podman has issues with auth.json; just override it
|
|
|
|
sudo podman login --authfile=auth.json -u $(CONTAINER_REPO_USERNAME) -p $(CONTAINER_REPO_PASSWORD) quay.io
|
|
|
|
sudo podman push --authfile=auth.json --format v2s2 quay.io/${TAG}
|
2021-05-26 02:44:02 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
sudo podman rmi ${LOCALTAG} || true
|
|
|
|
sudo podman rmi quay.io/${TAG} || true
|
2021-05-26 19:47:36 +00:00
|
|
|
rm -f grafana-*.rpm* auth.json
|
2020-06-17 05:20:45 +00:00
|
|
|
rm -f ${DASHBOARD_PROVISIONING}
|