🔨Rewrite of add-on (#214)

* ⬆️ Upgrades add-on base image to 12.0.0

* 🔨 Rewrite add-on

* 📚 Docs adjustments

* Tweak

* Remove now obsolete pyopenssl

* 🔒 Sign add-on with Codenotary Community Attestation Service (CAS)

* Add build deps
This commit is contained in:
Franck Nijhof 2022-06-10 16:27:25 +02:00 committed by GitHub
parent 628a5f6703
commit 0f768da930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 68 additions and 184 deletions

View file

@ -16,4 +16,5 @@ jobs:
workflows:
uses: hassio-addons/workflows/.github/workflows/addon-deploy.yaml@main
secrets:
CAS_API_KEY: ${{ secrets.CAS_API_KEY }}
DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}

View file

@ -1,6 +1,7 @@
# MIT License
Copyright (c) 2018-2021 Joakim Sørensen
Copyright (c) 2018-2019 Joakim Sørensen
Copyright (c) 2019-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

View file

@ -76,8 +76,8 @@ our [GitHub Repository][repository].
MIT License
Copyright (c) 2018-2019 Joakim Sørensen
Copyright (c) 2019-2022 Franck Nijhof
- Copyright (c) 2018-2019 Joakim Sørensen
- Copyright (c) 2019-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
@ -116,7 +116,7 @@ SOFTWARE.
[issue]: https://github.com/hassio-addons/addon-tautulli/issues
[license-shield]: https://img.shields.io/github/license/hassio-addons/addon-tautulli.svg
[ludeeus]: https://github.com/ludeeus
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg
[maintenance-shield]: https://img.shields.io/maintenance/yes/2022.svg
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
[reddit]: https://reddit.com/r/homeassistant
[releases-shield]: https://img.shields.io/github/release/hassio-addons/addon-tautulli.svg

View file

@ -13,8 +13,12 @@ which makes it easy to brag about your server to everyone else.
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Home Assistant add-on.
1. Search for the "Tautulli" add-on in the Supervisor add-on store
and install it.
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 "Tautulli" add-on
1. Check the logs of the "Tautulli" add-on to see if everything went well.
1. Click "OPEN WEB UI" to open the Tautulli website and follow the wizard.
@ -30,15 +34,8 @@ Example add-on configuration:
```yaml
log_level: info
username: MarryPoppins
password: Supercalifragilisticexpialidocious
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
```
**Note**: _This is just an example, don't copy and past it! Create your own!_
### Option: `log_level`
The `log_level` option controls the level of log output by the addon and can
@ -57,46 +54,6 @@ more severe level, e.g., `debug` also shows `info` messages. By default,
the `log_level` is set to `info`, which is the recommended setting unless
you are troubleshooting.
### Option: `username`
Username for authenticating with the Tautulli interface.
Setting a username/password can be added as an extra line of defense,
to prevent users from using your installation for themselves.
This option is HIGHLY recommended in case you expose this add-on to the outside
world.
### Option: `password`
Password for authenticating with Tautulli interface.
### Option: `ssl`
Enables/Disables SSL (HTTPS) on the web interface of Tautulli. Set it `true`
to enable it, `false` otherwise.
### Option: `certfile`
The certificate file to use for SSL.
**Note**: _The file MUST be stored in `/ssl/`, which is the default_
### Option: `keyfile`
The private key file to use for SSL.
**Note**: _The file MUST be stored in `/ssl/`, which is the default_
### Option: `leave_front_door_open`
Adding this option to the add-on configuration allows you to disable
authentication on the add-on by setting it to `true` and leaving the
username and password empty.
**Note**: _We STRONGLY suggest, not to use this, even if this add-on is
only exposed to your internal network. USE AT YOUR OWN RISK!_
## Embedding into Home Assistant
It is possible to embed Tautulli directly into Home Assistant, allowing you to
@ -114,17 +71,6 @@ panel_iframe:
url: http://addres.to.your.home.assistant:8181
```
## Use an existing database
**NB!: This is considered advanced usage.**
If you want to import an existing Tautulli database to this addon, you first
need to extract the `tautulli.db` file from your existing installation.
Place this file in this directory `/share/tautulli`, you can use samba,
Cloud9 or any other method to move it there.
You need to restart the add-on for it to start using this database.
_if the directory `/share/tautulli` does not exist you need to create it._
## Changelog & Releases
This repository keeps a change log using [GitHub's releases][releases]
@ -164,8 +110,8 @@ check [the contributor's page][contributors].
MIT License
Copyright (c) 2018-2019 Joakim Sørensen
Copyright (c) 2019-2022 Franck Nijhof
- Copyright (c) 2018-2019 Joakim Sørensen
- Copyright (c) 2019-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
@ -185,6 +131,8 @@ 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_tautulli&repository_url=https%3A%2F%2Fgithub.com%2Fhassio-addons%2Frepository
[contributors]: https://github.com/hassio-addons/addon-tautulli/graphs/contributors
[discord-ha]: https://discord.gg/c5DvZ4e
[discord]: https://discord.me/hassioaddons

View file

@ -1,4 +1,4 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:11.0.0
ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base/amd64:6.0.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
@ -17,27 +17,18 @@ COPY requirements.txt /tmp/
# Setup base
ARG BUILD_ARCH=amd64
RUN \
apk add --no-cache --virtual .build-dependencies \
g++=10.3.1_git20211027-r0 \
gcc=10.3.1_git20211027-r0 \
libffi-dev=3.4.2-r1 \
openssl-dev=1.1.1l-r7 \
make=4.3-r0 \
python3-dev=3.9.7-r4 \
\
&& apk add --no-cache \
git=2.34.1-r0 \
openssl=1.1.1l-r7 \
patch=2.7.6-r7 \
py3-cryptography=3.3.2-r3 \
py3-pip=20.3.4-r1 \
python3=3.9.7-r4 \
wget=1.21.2-r2 \
apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential=12.9 \
git=1:2.30.2-1 \
python3-dev=3.9.2-3 \
python3-pip=20.3.4-4+deb11u1 \
python3=3.9.2-3\
\
&& pip install \
--no-cache-dir \
--prefer-binary \
--find-links "https://wheels.home-assistant.io/alpine-3.15/${BUILD_ARCH}/" \
--extra-index-url "https://www.piwheels.org/simple" \
-r /tmp/requirements.txt \
\
&& git clone --branch "${TAUTULLI_VERSION}" --depth=1 \
@ -48,8 +39,17 @@ RUN \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
\
&& apk del --no-cache --purge .build-dependencies \
&& rm -f -r /tmp/*
&& apt-get purge -y --auto-remove \
build-essential \
git \
python3-dev \
python3-pip \
\
&& rm -fr \
/opt/{.git,.github,init-scripts} \
/tmp/* \
/var/{cache,log}/* \
/var/lib/apt/lists/*
# Copy root filesystem
COPY rootfs /

View file

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

View file

@ -4,6 +4,7 @@ version: dev
slug: tautulli
description: Monitoring and tracking tool for Plex Media Server
url: https://github.com/hassio-addons/addon-tautulli/tree/main/README.md
codenotary: codenotary@frenck.dev
webui: "[PROTO:ssl]://[HOST]:[PORT:8181]"
arch:
- aarch64
@ -11,25 +12,14 @@ arch:
- armhf
- armv7
- i386
init: false
hassio_api: true
ports:
8181/tcp: 8181
ports_description:
8181/tcp: Tautulli web interface
map:
- ssl
- share:rw
options:
username: ""
password: ""
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
- backup:rw
schema:
log_level: list(trace|debug|info|notice|warning|error|fatal)?
username: str
password: password
ssl: bool
certfile: str
keyfile: str
leave_front_door_open: bool?

View file

@ -1,4 +1,4 @@
crudini==0.9.3
plexapi==4.11.2
pycryptodomex==3.14.1
crudini==0.9.3
pyOpenSSL==22.0.0
setuptools==62.3.3

56
tautulli/rootfs/etc/cont-init.d/tautulli.sh Normal file → Executable file
View file

@ -1,18 +1,10 @@
#!/usr/bin/with-contenv bashio
#!/command/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Tautulli
# Preparing configuration for Tautulli
# ==============================================================================
readonly ADDON=/data/addon.ini
readonly CONFIG=/data/config.ini
readonly DATABASE=/share/tautulli/tautulli.db
readonly SHARE=/share/tautulli
# Require username / password
if ! bashio::config.true 'leave_front_door_open'; then
bashio::config.require.username;
bashio::config.require.password;
fi
# Check SSL cerrificate
bashio::config.require.ssl
@ -20,12 +12,16 @@ bashio::config.require.ssl
# If config.ini does not exist, create it.
if ! bashio::fs.file_exists "$CONFIG"; then
bashio::log.info "Creating default configuration..."
crudini --set "$CONFIG" Advanced system_analytics 0
crudini --set "$CONFIG" General backup_dir "/backup/tautulli"
crudini --set "$CONFIG" General first_run_complete 0
crudini --set "$CONFIG" General update_show_changelog 0
crudini --set "$CONFIG" Advanced system_analytics 0
crudini --set "$ADDON" Addon version "$TAUTULLI_VERSION"
fi
# Create backup directory
mkdir -p /backup/tautulli
bashio::log.info "Updating running configuration..."
# Temporrary changing config.ini to be valid during additions
@ -50,46 +46,6 @@ crudini --set "$ADDON" Addon version "$TAUTULLI_VERSION"
crudini --set "$CONFIG" General check_github 0
crudini --set "$CONFIG" General check_github_on_startup 0
# Update SSL info in configuration
if bashio::config.true 'ssl'; then
bashio::log.info "Ensure SSL is active in the configuration..."
crudini --set "$CONFIG" General enable_https 1
crudini --set "$CONFIG" General https_cert_chain "\"/ssl/$(bashio::config 'certfile')\""
crudini --set "$CONFIG" General https_cert "\"/ssl/$(bashio::config 'certfile')\""
crudini --set "$CONFIG" General https_key "\"/ssl/$(bashio::config 'keyfile')\""
else
bashio::log.info "Ensure SSL is not active in the configuration..."
crudini --set "$CONFIG" General enable_https 0
crudini --set "$CONFIG" General https_cert_chain "\"\""
crudini --set "$CONFIG" General https_cert "\"\""
crudini --set "$CONFIG" General https_key "\"\""
fi
# Update username and password in configuration
if bashio::config.has_value 'username' && bashio::config.has_value 'password'; then
bashio::log.info "Ensure authentication is enabled in the configuration..."
crudini --set "$CONFIG" General http_username "\"$(bashio::config 'username')\""
crudini --set "$CONFIG" General http_password "\"$(bashio::config 'password')\""
else
bashio::log.info "Ensure authentication is not enabled in the configuration..."
crudini --set "$CONFIG" General http_username "\"\""
crudini --set "$CONFIG" General http_password "\"\""
fi
# Changing config.ini back.
## This has to be done because Tautulli added a ini header with [[header]]
sed -i "s/\\[get_file_sizes_hold\\]/\\[\\[get_file_sizes_hold\\]\\]/" "$CONFIG"
# Create /share/tautulli if it does not exist.
if ! bashio::fs.directory_exists "$SHARE"; then
mkdir "$SHARE"
fi
# Use databasefile from /share/tautulli if it exist.
if bashio::fs.file_exists "$DATABASE"; then
bashio::log.info "Using database from $DATABASE"
ln -sf "$DATABASE" /data/tautulli.db
fi
# Adds add-on support information in the settings of Tautulli
patch /opt/data/interfaces/default/configuration_table.html /patches/support

10
tautulli/rootfs/etc/services.d/tautulli/finish Normal file → Executable file
View file

@ -1,9 +1,11 @@
#!/usr/bin/execlineb -S0
#!/command/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Tautulli
# Take down the S6 supervision tree when Tautulli fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
if [[ "${1}" -ne 0 ]] && [[ "${1}" -ne 256 ]]; then
bashio::log.warning "Tautulli crashed, halting add-on"
/run/s6/basedir/bin/halt
fi
s6-svscanctl -t /var/run/s6/services
bashio::log.info "Tautulli stopped, restarting..."

2
tautulli/rootfs/etc/services.d/tautulli/run Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/command/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Tautulli
# Runs Tautulli

View file

@ -1,17 +0,0 @@
--- /opt/data/interfaces/default/configuration_table.html
+++ /opt/data/interfaces/default/configuration_table.html
@@ -93,6 +79,14 @@
<a class="no-highlight support-modal-link" href="${anon_url('https://forums.plex.tv/t/tautulli-monitor-your-plex-media-server/225242')}" target="_blank">Plex Forums</a>
</td>
</tr>
+ <tr>
+ <td>Add-on Support:</td>
+ <td>
+ <a class="no-highlight" href="https://discord.me/hassioaddons" target="_blank">Home Assistant Community Add-ons Discord Server</a> |
+ <a class="no-highlight" href="https://github.com/hassio-addons/addon-tautulli/issues" target="_blank">GitHub issues for this add-on</a> |
+ <a class="no-highlight" href="https://community.home-assistant.io/t/home-assistant-community-add-on-tautulli/68745" target="_blank">Home Assistant forum</a>
+ </td>
+ </tr>
</tbody>
</table>