net-analyzer/graphite-web-gunicorn: first commit
Signed-off-by: Anton Fischl <github@fischl-online.de>
This commit is contained in:
parent
f2ef571064
commit
6b0a1fd672
|
@ -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
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<maintainer type="person">
|
||||||
|
<email>github@fischl-online.de</email>
|
||||||
|
<name>Anton Fischl</name>
|
||||||
|
</maintainer>
|
||||||
|
<stabilize-allarches/>
|
||||||
|
</pkgmetadata>
|
|
@ -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
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<maintainer type="person">
|
||||||
|
<email>github@fischl-online.de</email>
|
||||||
|
<name>Anton Fischl</name>
|
||||||
|
</maintainer>
|
||||||
|
<stabilize-allarches/>
|
||||||
|
</pkgmetadata>
|
|
@ -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"
|
||||||
|
|
|
@ -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}"
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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/"
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<maintainer type="person">
|
||||||
|
<email>github@fischl-online.de</email>
|
||||||
|
<name>Anton Fischl</name>
|
||||||
|
</maintainer>
|
||||||
|
</pkgmetadata>
|
Loading…
Reference in New Issue