diff --git a/acct-group/graphite-web/graphite-web-0.ebuild b/acct-group/graphite-web/graphite-web-0.ebuild new file mode 100644 index 0000000..07369c9 --- /dev/null +++ b/acct-group/graphite-web/graphite-web-0.ebuild @@ -0,0 +1,9 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-group + +DESCRIPTION="Group for net-analyzer/graphite-web(-gunicorn)" +ACCT_GROUP_ID=-1 diff --git a/acct-group/graphite-web/metadata.xml b/acct-group/graphite-web/metadata.xml new file mode 100644 index 0000000..905e59c --- /dev/null +++ b/acct-group/graphite-web/metadata.xml @@ -0,0 +1,9 @@ + + + + + github@fischl-online.de + Anton Fischl + + + diff --git a/acct-user/graphite-web/graphite-web-0.ebuild b/acct-user/graphite-web/graphite-web-0.ebuild new file mode 100644 index 0000000..21cbf0f --- /dev/null +++ b/acct-user/graphite-web/graphite-web-0.ebuild @@ -0,0 +1,11 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-user + +ACCT_USER_ID=-1 +ACCT_USER_GROUPS=( "${PN}" ) + +acct-user_add_deps diff --git a/acct-user/graphite-web/metadata.xml b/acct-user/graphite-web/metadata.xml new file mode 100644 index 0000000..905e59c --- /dev/null +++ b/acct-user/graphite-web/metadata.xml @@ -0,0 +1,9 @@ + + + + + github@fischl-online.de + Anton Fischl + + + diff --git a/net-analyzer/graphite-web-gunicorn/files/graphite-web.confd b/net-analyzer/graphite-web-gunicorn/files/graphite-web.confd new file mode 100644 index 0000000..ea45730 --- /dev/null +++ b/net-analyzer/graphite-web-gunicorn/files/graphite-web.confd @@ -0,0 +1,6 @@ +# IP-Address and Port to bind to +GRAPHITE_WEB_PORT="127.0.0.1:8081" + +# Number of Workers +GRAPHITE_WEB_WORKERS="1" + diff --git a/net-analyzer/graphite-web-gunicorn/files/graphite-web.initd b/net-analyzer/graphite-web-gunicorn/files/graphite-web.initd new file mode 100644 index 0000000..7c54422 --- /dev/null +++ b/net-analyzer/graphite-web-gunicorn/files/graphite-web.initd @@ -0,0 +1,23 @@ +#!/sbin/openrc-run + +description="Graphite-Web Daemon" +supervisor=supervise-daemon +respawn_period="${respawn_period:-30}" +term_type="${term_type:-linux}" +command=/usr/bin/gunicorn +pidfile="/run/${RC_SVCNAME}.pid" +command_user="graphite-web:graphite-web" +command_args="graphite.wsgi --pythonpath=/usr/share/graphite-web/webapp/ -w${GRAPHITE_WEB_WORKERS:-1} -b ${GRAPHITE_WEB_PORT:-127.0.0.1:8081}" + +depend() { + need net +} + +start_pre() { + export EINFO_QUIET="${quiet:-yes}" +} + +stop_pre() +{ + export EINFO_QUIET="${quiet:-yes}" +} diff --git a/net-analyzer/graphite-web-gunicorn/files/graphite-web.logrotate b/net-analyzer/graphite-web-gunicorn/files/graphite-web.logrotate new file mode 100644 index 0000000..dc167f8 --- /dev/null +++ b/net-analyzer/graphite-web-gunicorn/files/graphite-web.logrotate @@ -0,0 +1,8 @@ +/var/log/graphite-web/*.log { + missingok + notifempty + sharedscripts + postrotate + /etc/init.d/graphite-web restart > /dev/null 2>&1 || true + endscript +} diff --git a/net-analyzer/graphite-web-gunicorn/graphite-web-gunicorn-1.0.0.ebuild b/net-analyzer/graphite-web-gunicorn/graphite-web-gunicorn-1.0.0.ebuild new file mode 100644 index 0000000..48a2bcf --- /dev/null +++ b/net-analyzer/graphite-web-gunicorn/graphite-web-gunicorn-1.0.0.ebuild @@ -0,0 +1,58 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="meta package for installing graphite-web and running it with gunicorn" +HOMEPAGE="https://github.com/antonfischl1980/icinga" +SRC_URI="" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND=" + acct-user/graphite-web + net-analyzer/graphite-web[sqlite] + www-servers/gunicorn + " +RDEPEND="${DEPEND}" +BDEPEND="" + +src_unpack(){ + mkdir -p "${S}" +} + +src_install(){ + default + + newinitd "${FILESDIR}/graphite-web.initd" "graphite-web" + newconfd "${FILESDIR}/graphite-web.confd" "graphite-web" + keepdir /etc/graphite-web/ + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/graphite-web.logrotate" "graphite-web" + + keepdir /var/log/graphite-web/ + fowners graphite-web:graphite-web /var/log/graphite-web/ +} + +pkg_preinst(){ + if [ "$(grep -L '^SECRET_KEY' "${EROOT}/etc/graphite-web/local_settings.py"|wc -l)" -gt 0 ]; then + # Probably the first time we are installed + # set some more sane default settings in /etc/graphite-web/local_settings.py + + sed -E " + s/^(#SECRET_KEY = 'UNSAFE_DEFAULT')/\1\nSECRET_KEY = '$(openssl rand -base64 12|tr -d '/')'/ + s#^(\#TIME_ZONE = 'America/Los_Angeles')#\1\nTIME_ZONE = '$(head -1 /etc/timezone)'# + s#^(STORAGE_DIR = '/var/lib/carbon')#\#\1\nSTORAGE_DIR = '/var/lib/graphite'# + s#^(WHISPER_DIR = '/var/lib/carbon/whisper')#\#\1\nWHISPER_DIR = '/var/lib/graphite/whisper/'# + s#^(RRD_DIR = '/var/lib/carbon/rrd')#\#\1\nRRD_DIR = '/var/lib/graphite/rrd'# + s#^(\#LOG_ROTATION = True)#\1\nLOG_ROTATION = False# + " < "${EROOT}/etc/graphite-web/local_settings.py" > "${D}/etc/graphite-web/local_settings.py" + fi +} + +pkg_postinst(){ + chown -R graphite-web:graphite-web "${EROOT}/var/log/graphite-web/" +} diff --git a/net-analyzer/graphite-web-gunicorn/metadata.xml b/net-analyzer/graphite-web-gunicorn/metadata.xml new file mode 100644 index 0000000..1bf204c --- /dev/null +++ b/net-analyzer/graphite-web-gunicorn/metadata.xml @@ -0,0 +1,8 @@ + + + + + github@fischl-online.de + Anton Fischl + +