Add www-apps/healthchecks and its dependencies:

www-apps/healthchecks
dev-python/statsd
dev-python/requests-oauthlib
dev-python/oauthlib
dev-python/fido2
dev-python/cron-descriptor
dev-python/apprise
This commit is contained in:
Martin Sekera 2021-02-18 00:38:15 +01:00
parent 3ec318fe9c
commit 4bf6278ce0
12 changed files with 371 additions and 0 deletions

View file

@ -0,0 +1,10 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit acct-group
DESCRIPTION="A group for Healthchecks.io"
ACCT_GROUP_ID="-1"

View file

@ -0,0 +1,14 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit acct-user
DESCRIPTION="A user for Healthchecks.io"
ACCT_USER_GROUPS=( "${PN}" )
ACCT_USER_HOME="/var/lib/${PN}"
ACCT_USER_ID="-1"
acct-user_add_deps

View file

@ -0,0 +1,36 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
PYTHON_COMPAT=( python3_{7..9} pypy3 )
inherit distutils-r1
DESCRIPTION="Push Notifications that work with just about every platform!"
HOMEPAGE="https://github.com/caronc/apprise https://pypi.org/project/apprise/"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""
BDEPEND="dev-python/Babel[${PYTHON_USEDEP}]"
RDEPEND="dev-python/cryptography[${PYTHON_USEDEP}]
dev-python/requests[${PYTHON_USEDEP}]
dev-python/requests-oauthlib[${PYTHON_USEDEP}]
dev-python/six[${PYTHON_USEDEP}]
>=dev-python/click-5.0[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
dev-python/markdown[${PYTHON_USEDEP}]
"
DEPEND="${REDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
"
src_prepare() {
# tries to download stuff
sed -i "s/setup_requires=\['pytest-runner', 'babel', \]/setup_requires=\['babel'\]/" setup.py || die
distutils-r1_src_prepare
}

View file

@ -0,0 +1,20 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
inherit distutils-r1
DESCRIPTION="A Python library that converts cron expressions into human readable strings."
HOMEPAGE="https://github.com/Salamek/cron-descriptor https://pypi.org/project/cron-descriptor/"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P/-/_}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~arm arm64 x86"
S="${WORKDIR}/${P/-/_}"
distutils_enable_tests unittest

View file

@ -0,0 +1,50 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7..9} )
inherit distutils-r1
DESCRIPTION="Python based FIDO 2.0 library"
HOMEPAGE="https://github.com/Yubico/python-fido2"
SRC_URI="https://github.com/Yubico/python-fido2/releases/download/${PV}/${P}.tar.gz"
LICENSE="Apache-2.0 BSD-2 MIT MPL-2.0"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="examples test"
RESTRICT="!test? ( test )"
RDEPEND="
dev-python/six[${PYTHON_USEDEP}]
dev-python/cryptography[${PYTHON_USEDEP}]
dev-python/pyscard[${PYTHON_USEDEP}]
examples? (
dev-python/flask[${PYTHON_USEDEP}]
dev-python/pyopenssl[${PYTHON_USEDEP}]
)
"
DEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
test? (
${RDEPEND}
dev-python/mock[${PYTHON_USEDEP}]
>=dev-python/pyfakefs-3.4[${PYTHON_USEDEP}]
)
"
python_test() {
esetup.py test
}
python_install_all() {
distutils-r1_python_install_all
if use examples; then
docinto examples
dodoc -r "${S}"/examples/.
docompress -x "/usr/share/doc/${PF}/examples"
fi
}

View file

@ -0,0 +1,29 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
inherit distutils-r1
DESCRIPTION="Spec-compliant and thorough implementation of the OAuth request-signing logic"
HOMEPAGE="https://github.com/oauthlib/oauthlib https://pypi.org/project/oauthlib/"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~arm arm64 x86"
# optional extras hard set as RDEPs. See setup.py
RDEPEND="
>=dev-python/pyjwt-1.0.0[${PYTHON_USEDEP}]
dev-python/blinker[${PYTHON_USEDEP}]
dev-python/cryptography[${PYTHON_USEDEP}]
"
BDEPEND="
test? (
dev-python/mock[${PYTHON_USEDEP}]
)"
distutils_enable_tests unittest

View file

@ -0,0 +1,36 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
inherit distutils-r1
DESCRIPTION="This project provides first-class OAuth library support for Requests"
HOMEPAGE="https://github.com/requests/requests-oauthlib"
SRC_URI="https://github.com/requests/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
SLOT="0"
LICENSE="ISC"
KEYWORDS="amd64 ~arm x86"
RDEPEND="
>=dev-python/requests-2.0.0[${PYTHON_USEDEP}]
>=dev-python/oauthlib-3.0.0[${PYTHON_USEDEP}]"
BDEPEND="
test? (
dev-python/requests-mock[${PYTHON_USEDEP}]
)"
distutils_enable_tests unittest
src_prepare() {
# require Internet access
sed -e 's:testCanPostBinaryData:_&:' \
-e 's:test_content_type_override:_&:' \
-e 's:test_url_is_native_str:_&:' \
-i tests/test_core.py || die
distutils-r1_src_prepare
}

View file

@ -0,0 +1,22 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
inherit distutils-r1
DESCRIPTION="A simple statsd client"
HOMEPAGE="https://github.com/jsocol/pystatsd https://pypi.org/project/statsd"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm64 x86 ~amd64-linux ~x86-linux"
BDEPEND="
test? (
dev-python/mock[${PYTHON_USEDEP}]
)"
distutils_enable_tests nose

View file

@ -0,0 +1,23 @@
[Unit]
Description=Healthchecks.io alerting process
Requires=network-online.target
After=network-online.target healthchecks-server.service
[Service]
User=healthchecks
Group=healthchecks
WorkingDirectory=/usr/share/healthchecks
PrivateDevices=true
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
ExecStart=/usr/bin/python3 -u ./manage.py sendalerts --no-threads
Restart=always
RestartSec=20
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,23 @@
[Unit]
Description=Healthchecks.io application server
Requires=network-online.target
After=network-online.target
[Service]
User=healthchecks
Group=healthchecks
WorkingDirectory=/usr/share/healthchecks
PrivateDevices=true
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
ExecStart=/usr/bin/gunicorn --pythonpath . --bind 127.0.0.1:3004 --log-level debug hc.wsgi
Restart=always
RestartSec=20
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,28 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "healthchecksdb"
}
}
SECRET_KEY = "__RANDOM__"
DEBUG = True
ALLOWED_HOSTS = ["127.0.0.1"]
REGISTRATION_OPEN = False
TIME_ZONE = "Europe/Prague"
SITE_ROOT = "https://ping.example.com"
SITE_NAME = "Example Healthchecks"
PING_ENDPOINT = SITE_ROOT + "/ping/"
APPRISE_ENABLED = False
MSTEAMS_ENABLED = False
MATTERMOST_ENABLED = True
OPSGENIE_ENABLED = False
PD_ENABLED = False
PROMETHEUS_ENABLED = False
SLACK_ENABLED = False
SPIKE_ENABLED = False
TELEGRAM_BOT_NAME = "BotName"
TELEGRAM_TOKEN = "BotToken"
VICTOROPS_ENABLED = False
WEBHOOKS_ENABLED = True
ZULIP_ENABLED = False

View file

@ -0,0 +1,80 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
inherit python-single-r1 systemd
DESCRIPTION="Periodic task monitoring."
HOMEPAGE="https://github.com/${PN}/${PN}"
SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="apprise"
REQUIRED_USE=${PYTHON_REQUIRED_USE}
RDEPEND="
acct-group/healthchecks
acct-user/healthchecks
${PYTHON_DEPS}
$(python_gen_cond_dep '
>=dev-python/django-3.1[${PYTHON_MULTI_USEDEP}]
>=dev-python/django-compressor-2.4[${PYTHON_MULTI_USEDEP}]
>=dev-python/fido2-0.9.1[${PYTHON_MULTI_USEDEP}]
dev-python/cron-descriptor[${PYTHON_MULTI_USEDEP}]
dev-python/croniter[${PYTHON_MULTI_USEDEP}]
dev-python/psycopg[${PYTHON_MULTI_USEDEP}]
dev-python/pytz[${PYTHON_MULTI_USEDEP}]
dev-python/requests[${PYTHON_MULTI_USEDEP}]
dev-python/statsd[${PYTHON_MULTI_USEDEP}]
www-servers/gunicorn[${PYTHON_MULTI_USEDEP}]
apprise? ( dev-python/apprise[${PYTHON_MULTI_USEDEP}] )
')"
DEPEND="${RDEPEND}"
src_install() {
TD=/usr/share/${PN}
insinto /etc/${PN}
newins ${FILESDIR}/local_settings.py local_settings.py.example
fowners root:${PN} /etc/${PN}/local_settings.py.example
fperms 640 /etc/${PN}/local_settings.py.example
dosym /etc/${PN}/local_settings.py ${TD}/hc/local_settings.py
SECRET=$(python3 -c "import random; print(random.randbytes(25).hex())")
sed -i "s/__RANDOM__/${SECRET}/" "${ED}/etc/${PN}/local_settings.py.example"
insinto ${TD}
doins -r *
systemd_dounit ${FILESDIR}/${PN}-server.service
systemd_dounit ${FILESDIR}/${PN}-monitor.service
}
pkg_config() {
if [[ ! -a "/etc/${PN}/local_settings.py" ]]; then
eerror "Create /etc/${PN}/local_settings.py with your configuration first."
return 1
fi
cd /usr/share/${PN}
einfo "This will apply migrations and/or create a superuser. You can skip any step."
einfo "Apply migrations? [y/N]"
read CHOICE
if [[ ${CHOICE:0:1} == "y" ]]; then
ebegin "Running migrations"
sudo -u ${PN} python3 manage.py migrate || die
eend 0
fi
einfo "Createa a new superuser? [y/N]"
read CHOICE
if [[ ${CHOICE:0:1} == "y" ]]; then
ebegin "Creating a superuser"
sudo -u ${PN} python3 manage.py createsuperuser || die
eend 0
fi
}