Initial add-on code

This commit is contained in:
Franck Nijhof 2022-06-13 00:29:56 +02:00
parent 76bf5df90c
commit a4d01f56dd
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
29 changed files with 2685 additions and 0 deletions

72
uptime-kuma/.README.j2 Normal file
View file

@ -0,0 +1,72 @@
# Home Assistant Community Add-on: Uptime Kuma
[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield]
[![Discord][discord-shield]][discord] [![Community Forum][forum-shield]][forum]
[![Sponsor Frenck via GitHub Sponsors][github-sponsors-shield]][github-sponsors]
[![Support Frenck on Patreon][patreon-shield]][patreon]
It is a self-hosted monitoring tool like "Uptime Robot".
## About
Uptime Kuma is an open source monitor tools, which can be best
compared to a self-hosted variant of a commercial service like "Uptime Robot".
It enables you to monitor services over HTTP/S, TCP, DNS, and other protocols
and it can send you notifications of downtime or trigger an Home Assistant
automation webhook.
{% if channel == "edge" %}
## WARNING! THIS IS AN EDGE VERSION!
This Home Assistant Add-ons repository contains edge builds of add-ons.
Edge builds add-ons are based upon the latest development version.
- They may not work at all.
- They might stop working at any time.
- They could have a negative impact on your system.
This repository was created for:
- Anybody willing to test.
- Anybody interested in trying out upcoming add-ons or add-on features.
- Developers.
If you are more interested in stable releases of our add-ons:
<https://github.com/hassio-addons/repository>
{% endif %}
{% if channel == "beta" %}
## WARNING! THIS IS A BETA VERSION!
This Home Assistant Add-ons repository contains beta releases of add-ons.
- They might stop working at any time.
- They could have a negative impact on your system.
This repository was created for:
- Anybody willing to test.
- Anybody interested in trying out upcoming add-ons or add-on features.
If you are more interested in stable releases of our add-ons:
<https://github.com/hassio-addons/repository>
{% endif %}
[discord-shield]: https://img.shields.io/discord/478094546522079232.svg
[discord]: https://discord.me/hassioaddons
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
[forum]: https://community.home-assistant.io/?
[github-sponsors-shield]: https://frenck.dev/wp-content/uploads/2019/12/github_sponsor.png
[github-sponsors]: https://github.com/sponsors/frenck
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg
[patreon-shield]: https://frenck.dev/wp-content/uploads/2019/12/patreon.png
[patreon]: https://www.patreon.com/frenck
[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg
[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg
[release]: {{ repo }}/tree/{{ version }}

107
uptime-kuma/DOCS.md Normal file
View file

@ -0,0 +1,107 @@
# Home Assistant Community Add-on: Uptime Kuma
Uptime Kuma is an open source monitor tools, which can be best
compared to a self-hosted variant of a commercial service like "Uptime Robot".
It enables you to monitor services over HTTP/S, TCP, DNS, and other protocols
and it can send you notifications of downtime or trigger an Home Assistant
automation webhook.
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Home Assistant add-on.
1. Click the Home Assistant My button below to open the add-on on your Home
Assistant instance.
[![Open this add-on in your Home Assistant instance.][addon-badge]][addon]
1. Click the "Install" button to install the add-on.
1. Start the "Uptime Kuma" add-on.
1. Check the logs of "Uptime Kuma" to see if everything went well.
1. Click on the "OPEN WEB UI" button to jump into Uptime Kuma.
Please read the rest of this document further instructions.
## Configuration
This add-on has no configuration options, everything can be managed
and configured via the Uptime Kuma interface.
## Known issues and limitations
- Cloudflare is not installed in this add-on and thus not available as
an option inside Uptime Kuma as of yet.
## Changelog & Releases
This repository keeps a change log using [GitHub's releases][releases]
functionality. The format of the log is based on
[Keep a Changelog][keepchangelog].
Releases are based on [Semantic Versioning][semver], and use the format
of `MAJOR.MINOR.PATCH`. In a nutshell, the version will be incremented
based on the following:
- `MAJOR`: Incompatible or major changes.
- `MINOR`: Backwards-compatible new features and enhancements.
- `PATCH`: Backwards-compatible bugfixes and package updates.
## Support
Got questions?
You have several options to get them answered:
- The [Home Assistant Community Add-ons Discord chat server][discord] for add-on
support and feature requests.
- The [Home Assistant Discord chat server][discord-ha] for general Home
Assistant discussions and questions.
- The Home Assistant [Community Forum][forum].
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
You could also [open an issue here][issue] GitHub.
## Authors & contributors
The original setup of this repository is by [Franck Nijhof][frenck].
For a full list of all authors and contributors,
check [the contributor's page][contributors].
## License
MIT License
Copyright (c) 2022 Franck Nijhof
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[addon-badge]: https://my.home-assistant.io/badges/supervisor_addon.svg
[addon]: https://my.home-assistant.io/redirect/supervisor_addon/?addon=a0d7b954_uptime-kuma&repository_url=https%3A%2F%2Fgithub.com%2Fhassio-addons%2Frepository
[contributors]: https://github.com/hassio-addons/addon-uptime-kuma/graphs/contributors
[discord-ha]: https://discord.gg/c5DvZ4e
[discord]: https://discord.me/hassioaddons
[forum]: https://community.home-assistant.io/?u=frenck
[frenck]: https://github.com/frenck
[issue]: https://github.com/hassio-addons/addon-uptime-kuma/issues
[reddit]: https://reddit.com/r/homeassistant
[releases]: https://github.com/hassio-addons/addon-uptime-kuma/releases
[semver]: http://semver.org/spec/v2.0.0.htm

88
uptime-kuma/Dockerfile Normal file
View file

@ -0,0 +1,88 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:12.0.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
# Set workdir
WORKDIR /opt
# Copy Python requirements file
COPY requirements.txt /opt/
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup base
RUN \
apk add --no-cache --virtual .build-dependencies \
build-base=0.5-r2 \
py3-pip=22.1.1-r0 \
python3-dev=3.10.4-r0 \
\
&& apk add --no-cache \
nodejs=16.15.0-r1 \
npm=8.10.0-r0 \
python3=3.10.4-r0 \
iputils=20211215-r0 \
setpriv=2.38-r1 \
\
&& npm config set unsafe-perm true \
\
&& mkdir -p /opt/uptime-kuma \
&& curl -L -s "https://github.com/louislam/uptime-kuma/archive/refs/tags/1.16.1.tar.gz" \
| tar zxvf - --strip-components 1 -C /opt/uptime-kuma \
\
&& cd /opt/uptime-kuma \
\
&& pip install --no-cache-dir -r /opt/requirements.txt \
\
&& npm ci \
--production \
--no-audit \
--no-optional \
--no-update-notifier \
--only=production \
--unsafe-perm \
&& npm run download-dist \
\
&& npm cache clear --force \
\
&& apk del --no-cache --purge .build-dependencies \
&& rm -fr \
/tmp/* \
/root/.cache \
/root/.npm \
/root/.npmrc
# Copy root filesystem
COPY rootfs /
# Build arguments
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
# Labels
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="Franck Nijhof <frenck@addons.community>" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="Home Assistant Community Add-ons" \
org.opencontainers.image.authors="Franck Nijhof <frenck@addons.community>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://addons.community" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}

10
uptime-kuma/build.yaml Normal file
View file

@ -0,0 +1,10 @@
---
build_from:
aarch64: ghcr.io/hassio-addons/base/aarch64:12.0.0
amd64: ghcr.io/hassio-addons/base/amd64:12.0.0
armhf: ghcr.io/hassio-addons/base/armhf:12.0.0
armv7: ghcr.io/hassio-addons/base/armv7:12.0.0
i386: ghcr.io/hassio-addons/base/i386:12.0.0
codenotary:
base_image: codenotary@frenck.dev
signer: codenotary@frenck.dev

20
uptime-kuma/config.yaml Normal file
View file

@ -0,0 +1,20 @@
---
name: Uptime Kuma
version: dev
slug: uptime-kuma
description: It is a self-hosted monitoring tool like "Uptime Robot"
url: https://github.com/hassio-addons/addon-uptime-kuma
codenotary: codenotary@frenck.dev
codenotary: codenotary@frenck.dev
webui: http://[HOST]:[PORT:3001]
init: false
arch:
- aarch64
- amd64
- armhf
- armv7
- i386
ports:
3001/tcp: 3001
ports_description:
3001/tcp: Web interface

BIN
uptime-kuma/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
uptime-kuma/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -0,0 +1 @@
apprise==0.9.8.3

View file

@ -0,0 +1,11 @@
#!/command/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Uptime Kuma
# Take down the S6 supervision tree when Uptime Kuma fails
# ==============================================================================
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
bashio::log.warning "Uptime Kuma crashed, halting add-on"
exec /run/s6/basedir/bin/halt
fi
bashio::log.info "Uptime Kuma stopped, restarting..."

View file

@ -0,0 +1,12 @@
#!/command/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Uptime Kuma
# Starts Uptime Kuma
# ==============================================================================
export NODE_PATH=/opt/node_modules
cd /opt/uptime-kuma || bashio::exit.nok "Could not change directory to Uptime Kume"
bashio::log.info "Starting Uptime Kuma..."
exec node server/server.js --data-dir="/data/"