From 4bf6278ce00b2cb13173da3bb3ccc1c61e2268ba Mon Sep 17 00:00:00 2001 From: Martin Sekera Date: Thu, 18 Feb 2021 00:38:15 +0100 Subject: [PATCH] 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 --- acct-group/healthchecks/healthchecks-0.ebuild | 10 +++ acct-user/healthchecks/healthchecks-0.ebuild | 14 ++++ dev-python/apprise/apprise-0.9.0.ebuild | 36 +++++++++ .../cron-descriptor-1.2.24.ebuild | 20 +++++ dev-python/fido2/fido2-0.9.1.ebuild | 50 ++++++++++++ dev-python/oauthlib/oauthlib-3.1.0-r1.ebuild | 29 +++++++ .../requests-oauthlib-1.3.0-r1.ebuild | 36 +++++++++ dev-python/statsd/statsd-3.3.0-r1.ebuild | 22 +++++ .../files/healthchecks-monitor.service | 23 ++++++ .../files/healthchecks-server.service | 23 ++++++ www-apps/healthchecks/files/local_settings.py | 28 +++++++ .../healthchecks/healthchecks-1.19.0.ebuild | 80 +++++++++++++++++++ 12 files changed, 371 insertions(+) create mode 100644 acct-group/healthchecks/healthchecks-0.ebuild create mode 100644 acct-user/healthchecks/healthchecks-0.ebuild create mode 100644 dev-python/apprise/apprise-0.9.0.ebuild create mode 100644 dev-python/cron-descriptor/cron-descriptor-1.2.24.ebuild create mode 100644 dev-python/fido2/fido2-0.9.1.ebuild create mode 100644 dev-python/oauthlib/oauthlib-3.1.0-r1.ebuild create mode 100644 dev-python/requests-oauthlib/requests-oauthlib-1.3.0-r1.ebuild create mode 100644 dev-python/statsd/statsd-3.3.0-r1.ebuild create mode 100644 www-apps/healthchecks/files/healthchecks-monitor.service create mode 100644 www-apps/healthchecks/files/healthchecks-server.service create mode 100644 www-apps/healthchecks/files/local_settings.py create mode 100644 www-apps/healthchecks/healthchecks-1.19.0.ebuild diff --git a/acct-group/healthchecks/healthchecks-0.ebuild b/acct-group/healthchecks/healthchecks-0.ebuild new file mode 100644 index 0000000..0f62b06 --- /dev/null +++ b/acct-group/healthchecks/healthchecks-0.ebuild @@ -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" diff --git a/acct-user/healthchecks/healthchecks-0.ebuild b/acct-user/healthchecks/healthchecks-0.ebuild new file mode 100644 index 0000000..96ff14c --- /dev/null +++ b/acct-user/healthchecks/healthchecks-0.ebuild @@ -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 diff --git a/dev-python/apprise/apprise-0.9.0.ebuild b/dev-python/apprise/apprise-0.9.0.ebuild new file mode 100644 index 0000000..6f50bd0 --- /dev/null +++ b/dev-python/apprise/apprise-0.9.0.ebuild @@ -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 +} + diff --git a/dev-python/cron-descriptor/cron-descriptor-1.2.24.ebuild b/dev-python/cron-descriptor/cron-descriptor-1.2.24.ebuild new file mode 100644 index 0000000..5272b2b --- /dev/null +++ b/dev-python/cron-descriptor/cron-descriptor-1.2.24.ebuild @@ -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 diff --git a/dev-python/fido2/fido2-0.9.1.ebuild b/dev-python/fido2/fido2-0.9.1.ebuild new file mode 100644 index 0000000..73181f2 --- /dev/null +++ b/dev-python/fido2/fido2-0.9.1.ebuild @@ -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 +} diff --git a/dev-python/oauthlib/oauthlib-3.1.0-r1.ebuild b/dev-python/oauthlib/oauthlib-3.1.0-r1.ebuild new file mode 100644 index 0000000..2dcdad9 --- /dev/null +++ b/dev-python/oauthlib/oauthlib-3.1.0-r1.ebuild @@ -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 diff --git a/dev-python/requests-oauthlib/requests-oauthlib-1.3.0-r1.ebuild b/dev-python/requests-oauthlib/requests-oauthlib-1.3.0-r1.ebuild new file mode 100644 index 0000000..4ec2193 --- /dev/null +++ b/dev-python/requests-oauthlib/requests-oauthlib-1.3.0-r1.ebuild @@ -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 +} diff --git a/dev-python/statsd/statsd-3.3.0-r1.ebuild b/dev-python/statsd/statsd-3.3.0-r1.ebuild new file mode 100644 index 0000000..4aa0355 --- /dev/null +++ b/dev-python/statsd/statsd-3.3.0-r1.ebuild @@ -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 diff --git a/www-apps/healthchecks/files/healthchecks-monitor.service b/www-apps/healthchecks/files/healthchecks-monitor.service new file mode 100644 index 0000000..a564d8f --- /dev/null +++ b/www-apps/healthchecks/files/healthchecks-monitor.service @@ -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 diff --git a/www-apps/healthchecks/files/healthchecks-server.service b/www-apps/healthchecks/files/healthchecks-server.service new file mode 100644 index 0000000..3b7321b --- /dev/null +++ b/www-apps/healthchecks/files/healthchecks-server.service @@ -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 diff --git a/www-apps/healthchecks/files/local_settings.py b/www-apps/healthchecks/files/local_settings.py new file mode 100644 index 0000000..ac2e566 --- /dev/null +++ b/www-apps/healthchecks/files/local_settings.py @@ -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 diff --git a/www-apps/healthchecks/healthchecks-1.19.0.ebuild b/www-apps/healthchecks/healthchecks-1.19.0.ebuild new file mode 100644 index 0000000..b92e711 --- /dev/null +++ b/www-apps/healthchecks/healthchecks-1.19.0.ebuild @@ -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 +}