Added grafana container

Added grafana repository to base image

Co-Authored-By: zhubingbing <zhubingbing10@gmail.com>

Installed grafana from repository

Change-Id: Ib99195ec4522f185f6fd4cebf10e305bb58f69c4
Partially-Implements: Blueprint performance-monitoring
This commit is contained in:
Mathias Ewald 2016-07-25 08:51:58 +00:00 committed by zhubingbing
parent 8c0f8daa22
commit 6417595b9f
7 changed files with 53 additions and 2 deletions

View File

@ -37,7 +37,8 @@ RUN if [ $(awk '{match($0, /[0-9]+/,version)}END{print version[0]}' /etc/system-
'elasticsearch.repo', 'elasticsearch.repo',
'kibana.yum.repo', 'kibana.yum.repo',
'MariaDB.repo', 'MariaDB.repo',
'influxdb.repo' 'influxdb.repo',
'grafana.repo'
] %} ] %}
{% for repo_file in base_yum_repo_files | customizable('yum_repo_files') %} {% for repo_file in base_yum_repo_files | customizable('yum_repo_files') %}
COPY {{ repo_file }} /etc/yum.repos.d/{{ repo_file }} COPY {{ repo_file }} /etc/yum.repos.d/{{ repo_file }}
@ -51,7 +52,9 @@ COPY {{ repo_file }} /etc/yum.repos.d/{{ repo_file }}
'http://yum.mariadb.org/RPM-GPG-KEY-MariaDB', 'http://yum.mariadb.org/RPM-GPG-KEY-MariaDB',
'/etc/pki/rpm-gpg/RPM-GPG-KEY-Percona ', '/etc/pki/rpm-gpg/RPM-GPG-KEY-Percona ',
'https://packages.elastic.co/GPG-KEY-elasticsearch', 'https://packages.elastic.co/GPG-KEY-elasticsearch',
'https://repos.influxdata.com/influxdb.key' 'https://repos.influxdata.com/influxdb.key',
'https://packagecloud.io/gpg.key',
'https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana'
] %} ] %}
RUN true {% for key in base_yum_repo_keys | customizable('yum_repo_keys') %}&& rpm --import {{ key }} {% endfor %} RUN true {% for key in base_yum_repo_keys | customizable('yum_repo_keys') %}&& rpm --import {{ key }} {% endfor %}
@ -231,6 +234,7 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences
'46095ACC8548582C1A2699A9D27D666CD88E42B4', '46095ACC8548582C1A2699A9D27D666CD88E42B4',
'58118E89F3A912897C070ADBF76221572C52609D', '58118E89F3A912897C070ADBF76221572C52609D',
'05CE15085FC09D18E99EFB22684A14CF2582E0C5', '05CE15085FC09D18E99EFB22684A14CF2582E0C5',
'418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB',
] %} ] %}
{% elif base_distro == 'debian' %} {% elif base_distro == 'debian' %}
{% set base_apt_keys = [ {% set base_apt_keys = [
@ -239,6 +243,7 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences
'0xcbcb082a1bb943db', '0xcbcb082a1bb943db',
'D27D666CD88E42B4', 'D27D666CD88E42B4',
'05CE15085FC09D18E99EFB22684A14CF2582E0C5', '05CE15085FC09D18E99EFB22684A14CF2582E0C5',
'418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB',
] %} ] %}
{% set base_apt_packages = base_apt_packages + {% set base_apt_packages = base_apt_packages +
['sudo',] ['sudo',]

7
docker/base/grafana.repo Normal file
View File

@ -0,0 +1,7 @@
[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana

View File

@ -27,3 +27,6 @@ deb http://apt.dockerproject.org/repo debian-jessie main
# InfluxDB repo # InfluxDB repo
deb https://repos.influxdata.com/debian jessie stable deb https://repos.influxdata.com/debian jessie stable
# Grafana repo
deb https://packagecloud.io/grafana/stable/debian/ jessie main

View File

@ -30,3 +30,6 @@ deb http://apt.dockerproject.org/repo ubuntu-xenial main
# InfluxDB repo # InfluxDB repo
deb https://repos.influxdata.com/ubuntu xenial stable deb https://repos.influxdata.com/ubuntu xenial stable
# Grafana repo
deb https://packagecloud.io/grafana/stable/debian/ jessie main

View File

@ -0,0 +1,22 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
MAINTAINER {{ maintainer }}
{% block grafana_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% set grafana_packages = ['grafana'] %}
{{ macros.install_packages(grafana_packages | customizable("packages")) }}
RUN usermod -a -G kolla grafana
WORKDIR /usr/share/grafana
COPY grafana_sudoers /etc/sudoers.d/kolla_grafana_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
{% block grafana_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }}
USER grafana

View File

@ -0,0 +1,9 @@
#!/bin/bash
if [[ ! -d "/var/log/kolla/grafana" ]]; then
mkdir -p /var/log/kolla/grafana
fi
if [[ $(stat -c %a /var/log/kolla/grafana) != "755" ]]; then
chmod 755 /var/log/kolla/grafana
fi

View File

@ -0,0 +1,2 @@
%kolla ALL=(root) NOPASSWD: /usr/bin/chown -R grafana\: /var/lib/grafana/, /bin/chown -R grafana\: /var/lib/grafana/