summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshley Bone2021-05-30 21:52:59 -0400
committerAshley Bone2021-05-30 21:52:59 -0400
commit822d99fb40f34037ce2613381f4c826f59b0bc68 (patch)
tree07f2f6fdab9557de9124026287060f858fde9d2c
downloadaur-822d99fb40f34037ce2613381f4c826f59b0bc68.tar.gz
initial upload
-rw-r--r--.SRCINFO47
-rw-r--r--PKGBUILD87
-rwxr-xr-xhc-clean-db7
-rwxr-xr-xhc-manage3
-rw-r--r--healthchecks-clean-db.service36
-rw-r--r--healthchecks-clean-db.timer11
-rw-r--r--healthchecks-nginx.conf21
-rw-r--r--healthchecks.ini30
-rw-r--r--healthchecks.install58
-rw-r--r--healthchecks.service15
-rw-r--r--healthchecks.sysusers2
-rw-r--r--healthchecks.tmpfiles2
-rw-r--r--local_settings.py147
13 files changed, 466 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c9bc2548a863
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,47 @@
+pkgbase = healthchecks
+ pkgdesc = A cron monitoring service with a web-based dashboard, API, and notification integrations.
+ pkgver = 1.20.0
+ pkgrel = 1
+ url = https://github.com/healthchecks/healthchecks
+ install = healthchecks.install
+ arch = any
+ license = BSD
+ depends = python-cron-descriptor
+ depends = python-croniter
+ depends = python-django
+ depends = python-django-compressor
+ depends = python-fido2
+ depends = python-pytz
+ depends = python-requests
+ depends = python-statsd
+ depends = uwsgi
+ depends = uwsgi-plugin-python
+ optdepends = python-psycopg2: Add support for postgreSQL.
+ optdepends = python-apprise: Add support for the Apprise integration.
+ backup = var/lib/healthchecks/local_settings.py
+ backup = etc/uwsgi/healthchecks.ini
+ source = https://github.com/healthchecks/healthchecks/archive/refs/tags/v1.20.0.tar.gz
+ source = hc-clean-db
+ source = hc-manage
+ source = healthchecks-clean-db.service
+ source = healthchecks-clean-db.timer
+ source = healthchecks.ini
+ source = healthchecks-nginx.conf
+ source = healthchecks.service
+ source = healthchecks.sysusers
+ source = healthchecks.tmpfiles
+ source = local_settings.py
+ sha256sums = c4bc7a1a3b09bbfaaf63eae9df8144052174cb424169e4d12e77a51b88491a9b
+ sha256sums = a7b75bdd35c6952e06e1cd3824450f7c613aff5e3fb1d9f4f57f517b57cefbde
+ sha256sums = 355ac237284642e24a3cbe7ddb285bf7dbb802e72ea7fe7c68f0476178ab94fc
+ sha256sums = 9d32c4d1404079cac9b7a4ccbc97e01d867735c2536f915220d2ac5dffc333e7
+ sha256sums = 39d54c71890449a8f114c756cb96c87bf40538f7dbb056eb5c19882cc40e59da
+ sha256sums = d6eba99257afc8f75092af7d018d56618d0930ad2258fa6963d86089b7b3c35a
+ sha256sums = 55af4162848e448233fea8eefa42f4bc8c09f99be9d9fb0c8841a9dd38e95dd5
+ sha256sums = efa32e5bb8ef6dae017e2e196e8a37e42e73c2aade36743905f544c0c8b936b8
+ sha256sums = 2407d81ae0224d5c394b35e20a3b29d138fbde3fdde951de9dfea44d97e73eca
+ sha256sums = c04de046d176958b3705d751ac09cf018d395b6c37f38977ec4048a561d5041f
+ sha256sums = 1b398980c2dacc1a39d8f8d363815e0a5c07ea3b3ca0a7f6431c8d7d79ff212f
+
+pkgname = healthchecks
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ab382f319602
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,87 @@
+# Maintainer: Ashley Bone <ashley DOT bone AT pm DOT me>
+
+pkgname=healthchecks
+pkgver=1.20.0
+pkgrel=1
+pkgdesc="A cron monitoring service with a web-based dashboard, API, and notification integrations."
+arch=('any')
+url="https://github.com/healthchecks/healthchecks"
+license=('BSD')
+depends=('python-cron-descriptor' 'python-croniter' 'python-django' 'python-django-compressor'
+ 'python-fido2' 'python-pytz' 'python-requests' 'python-statsd' 'uwsgi' 'uwsgi-plugin-python')
+optdepends=('python-psycopg2: Add support for postgreSQL.'
+ 'python-apprise: Add support for the Apprise integration.')
+backup=("var/lib/$pkgname/local_settings.py" "etc/uwsgi/$pkgname.ini")
+install="$pkgname.install"
+source=("$url/archive/refs/tags/v$pkgver.tar.gz"
+ "hc-clean-db"
+ "hc-manage"
+ "$pkgname-clean-db.service"
+ "$pkgname-clean-db.timer"
+ "$pkgname.ini"
+ "$pkgname-nginx.conf"
+ "$pkgname.service"
+ "$pkgname.sysusers"
+ "$pkgname.tmpfiles"
+ "local_settings.py")
+sha256sums=('c4bc7a1a3b09bbfaaf63eae9df8144052174cb424169e4d12e77a51b88491a9b'
+ 'a7b75bdd35c6952e06e1cd3824450f7c613aff5e3fb1d9f4f57f517b57cefbde'
+ '355ac237284642e24a3cbe7ddb285bf7dbb802e72ea7fe7c68f0476178ab94fc'
+ '9d32c4d1404079cac9b7a4ccbc97e01d867735c2536f915220d2ac5dffc333e7'
+ '39d54c71890449a8f114c756cb96c87bf40538f7dbb056eb5c19882cc40e59da'
+ 'd6eba99257afc8f75092af7d018d56618d0930ad2258fa6963d86089b7b3c35a'
+ '55af4162848e448233fea8eefa42f4bc8c09f99be9d9fb0c8841a9dd38e95dd5'
+ 'efa32e5bb8ef6dae017e2e196e8a37e42e73c2aade36743905f544c0c8b936b8'
+ '2407d81ae0224d5c394b35e20a3b29d138fbde3fdde951de9dfea44d97e73eca'
+ 'c04de046d176958b3705d751ac09cf018d395b6c37f38977ec4048a561d5041f'
+ '1b398980c2dacc1a39d8f8d363815e0a5c07ea3b3ca0a7f6431c8d7d79ff212f')
+
+build() {
+ cd "$pkgname-$pkgver"
+
+ # create the python compiled files, static-collected files and an initial database
+ python -m compileall .
+ ./manage.py compress --force
+ ./manage.py collectstatic --no-input
+}
+
+check() {
+ cd "$pkgname-$pkgver"
+ ./manage.py test
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+
+ # create directories
+ install -dm755 "$pkgdir/etc/uwsgi"
+ install -dm755 "$pkgdir/usr/bin"
+ install -dm755 "$pkgdir/usr/lib/systemd/system"
+ install -dm755 "$pkgdir/usr/lib/"{healthchecks,sysusers.d,tmpfiles.d}
+ install -dm755 "$pkgdir/usr/share/"{doc,licenses,webapps}/"$pkgname"
+ install -dm755 "$pkgdir/var/lib/$pkgname"
+
+ # install healthchecks
+ cp -r {hc,locale,__pycache__,static,static-collected,stuff,templates} "$pkgdir/usr/share/webapps/$pkgname/"
+ install -Dm755 manage.py "$pkgdir/usr/share/webapps/$pkgname/"
+ install -Dm644 CHANGELOG.md "$pkgdir/usr/share/webapps/$pkgname/"
+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/"
+ install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/"
+
+ # install our package files - config, scripts, uwsgi and nginx config, service files, sysusers/tmpfiles
+ cd "$srcdir"
+ install -Dm644 "$pkgname.ini" "$pkgdir/etc/uwsgi/"
+ install -Dm644 "$pkgname-nginx.conf" "$pkgdir/usr/share/doc/$pkgname/"
+ install -Dm600 "local_settings.py" "$pkgdir/var/lib/$pkgname/"
+ ln -s "/var/lib/$pkgname/local_settings.py" "$pkgdir/usr/share/webapps/$pkgname/hc/local_settings.py"
+
+ install -Dm755 hc-manage "$pkgdir/usr/bin"
+ install -Dm755 hc-clean-db "$pkgdir/usr/lib/$pkgname"
+
+ install -Dm644 "$pkgname-clean-db.service" "$pkgdir/usr/lib/systemd/system/"
+ install -Dm644 "$pkgname-clean-db.timer" "$pkgdir/usr/lib/systemd/system/"
+ install -Dm644 "$pkgname.service" "$pkgdir/usr/lib/systemd/system/"
+
+ install -Dm644 "$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
+ install -Dm644 "$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+}
diff --git a/hc-clean-db b/hc-clean-db
new file mode 100755
index 000000000000..c37d3fef982c
--- /dev/null
+++ b/hc-clean-db
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+hc-manage prunepings
+hc-manage prunenotifications
+hc-manage pruneusers
+hc-manage prunetokenbucket
+hc-manage pruneflips
diff --git a/hc-manage b/hc-manage
new file mode 100755
index 000000000000..e7bec279476a
--- /dev/null
+++ b/hc-manage
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+/usr/share/webapps/healthchecks/manage.py "$@"
diff --git a/healthchecks-clean-db.service b/healthchecks-clean-db.service
new file mode 100644
index 000000000000..6f7079685883
--- /dev/null
+++ b/healthchecks-clean-db.service
@@ -0,0 +1,36 @@
+[Unit]
+Description=Clean healthchecks database
+Documentation=https://github.com/healthchecks/healthchecks
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib/healthchecks/hc-clean-db
+WorkingDirectory=/var/lib/healthchecks
+User=healthchecks
+Group=healthchecks
+
+NoNewPrivileges=yes
+LimitNOFILE=1048576
+LimitNPROC=64
+UMask=0077
+ProtectSystem=strict
+ProtectHome=yes
+ReadWritePaths=/var/lib/healthchecks
+PrivateTmp=yes
+PrivateDevices=yes
+ProtectHostname=yes
+ProtectClock=yes
+ProtectKernelTunables=yes
+ProtectKernelModules=yes
+ProtectKernelLogs=yes
+ProtectControlGroups=yes
+RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
+RestrictNamespaces=yes
+LockPersonality=yes
+MemoryDenyWriteExecute=yes
+RestrictRealtime=yes
+RestrictSUIDSGID=yes
+RemoveIPC=yes
+SystemCallFilter=@system-service
+SystemCallFilter=~@privileged @resources
+SystemCallArchitectures=native
diff --git a/healthchecks-clean-db.timer b/healthchecks-clean-db.timer
new file mode 100644
index 000000000000..ef2a54985686
--- /dev/null
+++ b/healthchecks-clean-db.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Weekly healthchecks database clean-up.
+Documentation=https://github.com/healthchecks/healthchecks
+
+[Timer]
+OnCalendar=weekly
+AccuracySec=1h
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/healthchecks-nginx.conf b/healthchecks-nginx.conf
new file mode 100644
index 000000000000..eb3a8457dae5
--- /dev/null
+++ b/healthchecks-nginx.conf
@@ -0,0 +1,21 @@
+server {
+ listen 80;
+ listen [::]:80;
+ server_name mysite.mydomain.com;
+ return 301 https://$server_name$request_uri;
+}
+
+server {
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+ server_name mysite.mydomain.com;
+
+ ssl_certificate certificates/mycert.crt;
+ ssl_certificate_key certificates/mykey.key;
+
+ location / {
+ include uwsgi_params;
+ uwsgi_pass 127.0.0.1:8000;
+ #uwsgi_pass unix:/run/uwsgi/healthchecks.sock;
+ }
+}
diff --git a/healthchecks.ini b/healthchecks.ini
new file mode 100644
index 000000000000..93975d0b5b54
--- /dev/null
+++ b/healthchecks.ini
@@ -0,0 +1,30 @@
+[uwsgi]
+master
+die-on-term
+vacuuum = true
+post-buffering = 4096
+processes = 4
+enable-threads
+threads = 1
+harakiri = 10
+thunder-lock
+disable-write-exception
+
+plugins = python
+module = hc.wsgi:application
+
+uid = healthchecks
+gid = http
+socket = 0.0.0.0:8000
+#socket = /run/uwsgi/%n.sock
+#chmod-socket = 775
+
+chdir = /usr/share/webapps/healthchecks
+static-map = /static=/usr/share/webapps/healthchecks/static-collected
+
+hook-pre-app = exec:./manage.py makemigrations
+hook-pre-app = exec:./manage.py migrate
+
+attach-daemon = ./manage.py sendalerts
+attach-daemon = ./manage.py sendreports --loop
+attach-daemon = ./manage.py smtpd --port 2525
diff --git a/healthchecks.install b/healthchecks.install
new file mode 100644
index 000000000000..41d73ed02d04
--- /dev/null
+++ b/healthchecks.install
@@ -0,0 +1,58 @@
+# arg1: package version
+post_install() {
+ cat <<EOF
+You may configure healthchecks via /var/lib/healthchecks/local_settings.py.
+Consult the documentation at https://github.com/healthchecks/healthchecks.
+
+Before running healthchecks, create a superuser with the command:
+ sudo hc-manage createsuperuser
+
+Some important settings you may need to modify include:
+- SITE_ROOT,PING_ENDPOINT: server address/port
+- PING_EMAIL_DOMAIN: domain where healthchecks will receive alert e-mails
+- SITE_NAME: name displayed on the healthchecks site
+- Email settings: EMAIL_HOST,EMAIL_PORT,EMAIL_HOST_USER,EMAIL_HOST_PASSWORD,EMAIL_USE_TLS,DEFAULT_FROM_EMAIL,
+ SERVER_EMAIL,ADMINS
+- SECRET_KEY: Django cryptographic setting
+- RP_ID: U2F two-factor authentication
+
+A sample nginx config file is included if you wish to proxy healthchecks.
+The healthchecks database was created at /var/lib/healthchecks/hc.sqlite.
+
+To run healthchecks, enable and start its systemd service and its weekly cleanup timer:
+
+systemctl enable --now healthchecks
+systemctl enable --now healthchecks-clean-db.timer
+
+These processes will be run by the healthchecks user.
+EOF
+ cd /usr/share/webapps/healthchecks
+
+ if [[ -f /var/lib/healthchecks/hc.sqlite ]]; then
+ echo "Existing healthchecks database detected, migrating it to the latest format."
+ ln -s /var/lib/healthchecks/hc.sqlite
+ hc-manage makemigrations > /dev/null
+ hc-manage migrate > /dev/null
+ else
+ echo "Creating healthchecks database."
+ hc-manage makemigrations > /dev/null
+ hc-manage migrate > /dev/null
+ mv hc.sqlite "$pkgdir"/var/lib/healthchecks
+ ln -s /var/lib/healthchecks/hc.sqlite
+ fi
+}
+
+# arg1: new package version
+# arg2: old package version
+post_upgrade() {
+ cat <<EOF
+ NOTE: The healthchecks database format may have changed! Re-starting the healthchecks service
+ will migrate the database to the new format (if any).
+EOF
+}
+
+# arg1: old package version
+post_remove() {
+ # cleanup untracked files in webapps
+ rm -rf /usr/share/webapps/healthchecks
+}
diff --git a/healthchecks.service b/healthchecks.service
new file mode 100644
index 000000000000..bf73b5f6aaa9
--- /dev/null
+++ b/healthchecks.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Healthchecks cron job monitor.
+After=syslog.target
+
+[Service]
+ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/healthchecks.ini
+ExecReload=/bin/kill -HUP $MAINPID
+ExecStop=/bin/kill -INT $MAINPID
+Restart=always
+Type=notify
+NotifyAccess=all
+KillSignal=SIGQUIT
+
+[Install]
+WantedBy=multi-user.target
diff --git a/healthchecks.sysusers b/healthchecks.sysusers
new file mode 100644
index 000000000000..301a0e221195
--- /dev/null
+++ b/healthchecks.sysusers
@@ -0,0 +1,2 @@
+u healthchecks - "healthchecks user"
+m healthchecks http
diff --git a/healthchecks.tmpfiles b/healthchecks.tmpfiles
new file mode 100644
index 000000000000..3efcfbd23d63
--- /dev/null
+++ b/healthchecks.tmpfiles
@@ -0,0 +1,2 @@
+d /var/lib/healthchecks 0755 healthchecks healthchecks
+Z /var/lib/healthchecks - healthchecks healthchecks
diff --git a/local_settings.py b/local_settings.py
new file mode 100644
index 000000000000..46fb0d4d85c5
--- /dev/null
+++ b/local_settings.py
@@ -0,0 +1,147 @@
+#Display name of the healthchecks instance.
+#SITE_NAME="Mychecks"
+
+#Base URL of the healthchecks instance.
+#SITE_ROOT="http://localhost:8000"
+
+#Ping settings.
+#PING_EMAIL_DOMAIN="localhost"
+#PING_ENDPOINT="<SITE_ROOT/ping/>"
+
+#The label for the "Overall Status" status badge. Defaults to SITE_NAME.
+#MASTER_BADGE_LABEL=<SITE_NAME>
+
+#The host/domains that this site can serve. You can specify multiple domain names by separating them with commas.
+#ALLOWED_HOSTS=*
+
+#Allow visitors to create new accounts. If False, the administrator may still invite selected users.
+#REGISTRATION_OPEN=True
+
+#Request header for external authentication.
+#REMOTE_USER_HEADER=
+
+#Relying Party Identifier. Set to your site's domain. Required by WebAuthn 2fa.
+#RP_ID=
+
+#Django cryptographic setting.
+#SECRET_KEY=
+
+#Upper limit (in bytes) of logged ping request bodies.
+#PING_BODY_LIMIT=10000
+
+#Turn billing features on/off.
+#USE_PAYMENTS=False
+
+#Email settings.
+#DEFAULT_FROM_EMAIL="noreply@my-monitoring-project.com"
+#SERVER_EMAIL="noreply@my-monitoring-admin.com"
+#SUPPORT_EMAIL = "pleasereply@my-monitoring-support.com"
+#EMAIL_HOST="your-smtp-server-here.com"
+#EMAIL_PORT=587
+#EMAIL_HOST_USER="username"
+#EMAIL_HOST_PASSWORD="password"
+#EMAIL_USE_TLS=True
+
+#Send a verification email when adding an email integration.
+#EMAIL_USE_VERIFICATION=True
+
+#The database engine to use. Possible values: sqlite, postgres, mysql.
+#DB="sqlite"
+
+#Database settings.
+#DB_CONN_MAX_AGE=0
+#DB_HOST=""
+#DB_PORT=""
+#DB_USER=""
+#DB_PASSWORD=""
+
+#Set this to hc (or your database name, if something different) for PostgreSQL or MySQL.
+#DB_NAME="/usr/share/webapps/healthchecks/hc.sqlite"
+
+#Postgres DB settings
+#DB_SSLMODE="prefer"
+#DB_TARGET_SESSION_ATTRS="read-write"
+
+#A boolean that turns on/off debug mode.
+DEBUG=False
+
+#A boolean that turns on/off the Apprise integration.
+#APPRISE_ENABLED=False
+
+#Discord integration.
+#DISCORD_CLIENT_ID=
+#DISCORD_CLIENT_SECRET=
+
+#No clue what these are.
+#LINENOTIFY_CLIENT_ID=
+#LINENOTIFY_CLIENT_SECRET=
+
+#Matrix integration.
+#MATRIX_ACCESS_TOKEN=
+#MATRIX_HOMESERVER=
+#MATRIX_USER_ID=
+
+#Mattermost integration.
+#MATTERMOST_ENABLED=True
+
+#Microsoft Teams integration.
+#MSTEAMS_ENABLED=True
+
+#Opsgenie integration.
+#OPSGENIE_ENABLED=True
+
+#PagerTree integratino.
+#PAGERTREE_ENABLED=True
+
+#PagerDuty integration.
+#PD_ENABLED=True
+#PD_VENDOR_KEY=
+
+#Prometheus integration.
+#PROMETHEUS_ENABLED=True
+
+#Pushbullet integration.
+#PUSHBULLET_CLIENT_ID=
+#PUSHBULLET_CLIENT_SECRET=
+
+#Pushover integration.
+#PUSHOVER_API_TOKEN=
+#PUSHOVER_EMERGENCY_EXPIRATION=86400
+#PUSHOVER_EMERGENCY_RETRY_DELAY=300
+#PUSHOVER_SUBSCRIPTION_URL=
+
+#Shell commands integration.
+#SHELL_ENABLED=False
+
+#Signal integration.
+#SIGNAL_CLI_ENABLED=False
+
+#Slack integration.
+#SLACK_CLIENT_ID=
+#SLACK_CLIENT_SECRET=
+#SLACK_ENABLED=True
+
+#Spike.sh integration.
+#SPIKE_ENABLED=True
+
+#Telegram integration.
+#TELEGRAM_BOT_NAME="ExampleBot"
+#TELEGRAM_TOKEN=
+
+#Trello integration.
+#TRELLO_APP_KEY=
+
+#Twilio integration.
+#TWILIO_ACCOUNT=
+#TWILIO_AUTH=
+#TWILIO_FROM=
+#TWILIO_USE_WHATSAPP=False
+
+#VictorOps integration.
+#VICTOROPS_ENABLED=True
+
+#Webhooks integration.
+#WEBHOOKS_ENABLED=True
+
+#Zulip integration.
+#ZULIP_ENABLED=True