200 lines
8.0 KiB
RPMSpec
200 lines
8.0 KiB
RPMSpec
#
|
|
# spec file for package graphite-web
|
|
#
|
|
# Copyright (c) 2022 SUSE LLC
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%define pythons python3
|
|
Name: graphite-web
|
|
Version: 1.1.10
|
|
Release: 0
|
|
Summary: Enterprise scalable realtime graphing
|
|
License: Apache-2.0
|
|
Group: Development/Languages/Python
|
|
URL: https://github.com/graphite-project/graphite-web
|
|
Source: https://github.com/graphite-project/graphite-web/archive/%{version}/%{name}-%{version}.tar.gz
|
|
Source99: %{name}-rpmlintrc
|
|
Source100: README.SUSE
|
|
Patch0: %{name}-path.patch
|
|
Patch1: %{name}-fix_invalide_theme.patch
|
|
BuildRequires: %{python_module devel <= 3.10}
|
|
BuildRequires: %{python_module setuptools}
|
|
BuildRequires: apache2
|
|
BuildRequires: python-rpm-macros
|
|
# SECTION test requirements
|
|
BuildRequires: %{python_module cairocffi}
|
|
BuildRequires: %{python_module django >= 1.8}
|
|
BuildRequires: %{python_module django-tagging >= 0.4.3}
|
|
BuildRequires: %{python_module pyparsing}
|
|
BuildRequires: %{python_module pytz}
|
|
BuildRequires: %{python_module six}
|
|
BuildRequires: %{python_module urllib3}
|
|
# /SECTION
|
|
Requires: apache2
|
|
Requires: python-carbon >= %{version}
|
|
Requires: python-whisper >= %{version}
|
|
Requires: %{python_flavor}-cairo
|
|
Requires: %{python_flavor}-cairocffi
|
|
# Requires: python3-ceres <- optional for whisper, but does not exists in suse
|
|
Requires: %{python_flavor}-django >= 1.8
|
|
Requires: %{python_flavor}-django-tagging >= 0.4.3
|
|
Requires: %{python_flavor}-pyparsing
|
|
Requires: %{python_flavor}-pytz
|
|
Requires: %{python_flavor}-six
|
|
Requires: %{python_flavor}-urllib3
|
|
Suggests: %{python_flavor}-scandir
|
|
Requires: %{python_flavor}-whitenoise
|
|
Requires: timezone
|
|
Recommends: %{python_flavor}-ldap
|
|
Recommends: %{python_flavor}-python-memcached >= 1.58
|
|
Recommends: %{python_flavor}-rrdtool
|
|
BuildArch: noarch
|
|
%if %{?suse_version} > 1500
|
|
Requires: apache2-mod_wsgi
|
|
%else
|
|
Requires: apache2-mod_wsgi-python3
|
|
%endif
|
|
|
|
%description
|
|
Graphite consists of a storage backend and a web-based visualization frontend.
|
|
Client applications send streams of numeric time-series data to the Graphite
|
|
backend (called carbon), where it gets stored in fixed-size database files
|
|
similar in design to RRD. The web frontend provides user interfaces
|
|
for visualizing this data in graphs as well as a simple URL-based API for
|
|
direct graph generation.
|
|
|
|
Graphite's design is focused on providing simple interfaces (both to users and
|
|
applications), real-time visualization, high-availability, and enterprise
|
|
scalability.
|
|
|
|
%prep
|
|
%setup -q
|
|
%patch -P 0 -p1
|
|
%patch -P 1 -p1
|
|
install -m644 %{SOURCE100} .
|
|
chmod +x examples/example-client.py
|
|
sed -i 's|\/usr\/bin\/python.*|\/usr\/bin\/python%{python_bin_suffix}|' examples/example-client.py
|
|
|
|
%build
|
|
%python_build
|
|
|
|
%install
|
|
%python_exec setup.py install --root=%{buildroot} --install-scripts=%{_prefix}/lib/graphite --install-lib=%{python_sitelib} --install-data=%{_localstatedir}/lib/graphite
|
|
|
|
# Create directories
|
|
mkdir -p %{buildroot}%{_localstatedir}/log/graphite/webapp
|
|
mkdir -p %{buildroot}%{_localstatedir}/lib/graphite/static
|
|
# for wsgi
|
|
mkdir -p %{buildroot}/srv/www/run
|
|
|
|
# empty files for graphite with correct rights
|
|
touch %{buildroot}%{_localstatedir}/log/graphite/exception.log
|
|
touch %{buildroot}%{_localstatedir}/log/graphite/info.log
|
|
|
|
# install missing manage.py, check-dependencies.py
|
|
install webapp/manage.py %{buildroot}%{_prefix}/lib/graphite/manage.py
|
|
install check-dependencies.py %{buildroot}%{_prefix}/lib/graphite/check-dependencies.py
|
|
sed -i 's|\/usr\/bin\/env python.*|\/usr\/bin\/python%{python_bin_suffix}|' %{buildroot}%{_prefix}/lib/graphite/manage.py
|
|
sed -i 's|\/usr\/bin\/env python.*|\/usr\/bin\/python%{python_bin_suffix}|' %{buildroot}%{_prefix}/lib/graphite/check-dependencies.py
|
|
|
|
# Install some default configurations and wsgi
|
|
mkdir -p %{buildroot}%{_sysconfdir}/graphite
|
|
mv %{buildroot}%{_localstatedir}/lib/graphite/conf/*.example %{buildroot}%{_sysconfdir}/graphite
|
|
mv %{buildroot}%{python_sitelib}/graphite/*.example %{buildroot}%{_sysconfdir}/graphite
|
|
#
|
|
for file in %{buildroot}%{_sysconfdir}/graphite/*.example; do
|
|
bn=$(basename $file .example)
|
|
cp $file %{buildroot}%{_sysconfdir}/graphite/$bn
|
|
done
|
|
|
|
# apache.conf
|
|
mkdir -p %{buildroot}%{_sysconfdir}/apache2/vhosts.d
|
|
cp -r examples/example-graphite-vhost.conf %{buildroot}%{_sysconfdir}/apache2/vhosts.d/graphite-web.conf
|
|
sed -i 's|@DJANGO_ROOT@|%{python_sitelib}\/django|g' %{buildroot}%{_sysconfdir}/apache2/vhosts.d/graphite-web.conf
|
|
sed -i 's|modules\/mod_wsgi.so|%{_libdir}\/apache2\/mod_wsgi.so|' %{buildroot}%{_sysconfdir}/apache2/vhosts.d/graphite-web.conf
|
|
|
|
# Create local_settings symlink
|
|
pushd %{buildroot}%{python_sitelib}/graphite
|
|
ln -s %{_sysconfdir}/graphite/local_settings.py
|
|
popd
|
|
pushd %{buildroot}%{_localstatedir}/lib/graphite/conf
|
|
ln -s %{_sysconfdir}/graphite/dashboard.conf
|
|
ln -s %{_sysconfdir}/graphite/graphTemplates.conf
|
|
ln -s %{_sysconfdir}/graphite/graphite.wsgi
|
|
popd
|
|
|
|
# Configure django /media/ location
|
|
sed -i 's|\/opt|\/var\/lib|' %{buildroot}%{_sysconfdir}/graphite/graphite.wsgi
|
|
sed -i 's|\/opt|\/var\/lib|' %{buildroot}%{_sysconfdir}/graphite/local_settings.py
|
|
sed -i 's|\/opt|\/var\/lib|' %{buildroot}%{_prefix}/lib/graphite/build-index.sh
|
|
# TODO: If you use prefix in wsgi. You must also adjusted graphite-web.conf
|
|
#sed -i 's|#URL_PEFIX|URL_PREIX|g' %%{buildroot}%%{_sysconfdir}/graphite/local_settings.py
|
|
|
|
chmod -x %{buildroot}%{_sysconfdir}/graphite/graphite.wsgi
|
|
chmod -x %{buildroot}%{_sysconfdir}/graphite/graphite.wsgi.example
|
|
# does not apply
|
|
rm docs/install*
|
|
|
|
%post
|
|
if [ $1 -eq 1 ]; then
|
|
# random secret key
|
|
K=$(dd if=/dev/urandom count=1 bs=64 2>/dev/null | base64 -w 0)
|
|
sed -i 's|^#SECRET_KEY.*$|SECRET_KEY = "'$K'"|' %{_sysconfdir}/graphite/local_settings.py
|
|
# initialize database
|
|
%if 0%{?suse_version} >= 1500
|
|
django-admin migrate --pythonpath='%{_localstatedir}/lib/graphite/webapp' \
|
|
--settings=graphite.settings \
|
|
--run-syncdb \
|
|
--noinput
|
|
%else
|
|
django-admin syncdb --pythonpath='%{_localstatedir}/lib/graphite/webapp' \
|
|
--settings=graphite.settings \
|
|
--noinput
|
|
%endif
|
|
chown wwwrun:www %{_localstatedir}/lib/graphite/storage/graphite.db
|
|
fi
|
|
|
|
%check
|
|
#nosetests
|
|
|
|
%files
|
|
%license LICENSE
|
|
%doc README.md README.SUSE docs
|
|
|
|
%dir %{python_sitelib}/graphite
|
|
%{python_sitelib}/graphite/*
|
|
%{python_sitelib}/graphite_web-%{version}-py%{python_version}.egg-info
|
|
%pycache_only %{python_sitelib}/graphite/__pycache__/*.pyc
|
|
|
|
%dir %{_sysconfdir}/graphite
|
|
%config(noreplace) %{_sysconfdir}/apache2/vhosts.d/graphite-web.conf
|
|
%config(noreplace) %{_sysconfdir}/graphite/local_settings.py
|
|
%config(noreplace) %{_sysconfdir}/graphite/dashboard.conf
|
|
%config(noreplace) %{_sysconfdir}/graphite/graphTemplates.conf
|
|
%attr(-,wwwrun,www) %config(noreplace) %{_sysconfdir}/graphite/graphite.wsgi
|
|
%config(noreplace) %{_sysconfdir}/graphite/dashboard.conf
|
|
%attr(-,wwwrun,www) %dir /srv/www/run
|
|
%attr(-,wwwrun,www) %dir %{_localstatedir}/log/graphite
|
|
%attr(-,wwwrun,www) %dir %{_localstatedir}/log/graphite/webapp
|
|
%attr(-,wwwrun,www) %dir %{_localstatedir}/lib/graphite
|
|
%attr(-,wwwrun,www) %{_sysconfdir}/graphite/*.example
|
|
%attr(-,wwwrun,www) %{_sysconfdir}/graphite/*.conf
|
|
%attr(-,wwwrun,www) %{_localstatedir}/log/graphite/exception.log
|
|
%attr(-,wwwrun,www) %{_localstatedir}/log/graphite/info.log
|
|
%attr(-,wwwrun,www) %{_localstatedir}/lib/graphite
|
|
%{_prefix}/lib/graphite
|
|
|
|
%changelog
|