mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-09 17:31:03 +01:00
Spotbweb by @woutercoppens
This commit is contained in:
@@ -81,6 +81,7 @@ https://github.com/alexbelgium/hassio-addons
|
||||
- [Inadyn](inadyn/) : Inadyn, or In-a-Dyn, is a small and simple Dynamic DNS, DDNS, client with HTTPS support. Commonly available in many GNU/Linux distributions, used in off the shelf routers and Internet gateways to automate the task of keeping your Internet name in sync with your public¹ IP address. It can also be used in installations with redundant (backup) connections to the Internet.
|
||||
- [Portainer](portainer/) ![privileged][privileged-shield] ![ingress][ingress-shield] : Manage your docker environment
|
||||
- [Scrutiny](scrutiny/) ![support][support-shield] ![ingress][ingress-shield]: Scrutiny WebUI for smartd S.M.A.R.T monitoring
|
||||
- [Spotweb by @woutercoppens](spotweb/) : Spotweb is a decentralized usenet community based on the Spotnet protocol
|
||||
- [Teamspeak](teamspeak/): Voice communication for online gaming, education and training.
|
||||
|
||||
## ✓ Multimedia distributors
|
||||
@@ -124,7 +125,7 @@ https://github.com/alexbelgium/hassio-addons
|
||||
## ✓ Web hosting
|
||||
|
||||
- [Grav](grav/) ![smb][smb-shield] : Fast, Simple, and Flexible, file-based Web-platform
|
||||
- [Resioliosync](resiolosync/) ![smb][smb-shield]: Self-hosted file share and collaboration platform on the Web (dev by @TyjTyj)
|
||||
- [Resioliosync by @tyjtyj](resiolosync/) ![smb][smb-shield]: Self-hosted file share and collaboration platform on the Web
|
||||
|
||||
[//]: # "ADDONLIST_END"
|
||||
[smb-shield]: https://img.shields.io/badge/SMB--green?style=plastic.svg
|
||||
|
||||
24
spotweb/.dockerignore
Normal file
24
spotweb/.dockerignore
Normal file
@@ -0,0 +1,24 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
README.md
|
||||
2
spotweb/CHANGELOG.md
Normal file
2
spotweb/CHANGELOG.md
Normal file
@@ -0,0 +1,2 @@
|
||||
## [0.0.1]
|
||||
- Initial version
|
||||
169
spotweb/DOCS.md
Normal file
169
spotweb/DOCS.md
Normal file
@@ -0,0 +1,169 @@
|
||||
# Home Assistant Community Add-on: Bookstack
|
||||
|
||||
[Spotweb][spotweb] is a decentralized usenet community based on the [Spotnet][spotnet] protocol. Please support the developers of this software at
|
||||
[spotweb].
|
||||
|
||||
## Installation
|
||||
|
||||
The installation of this add-on is pretty straightforward and not different in
|
||||
comparison to installing any other Home Assistant add-on.
|
||||
|
||||
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
|
||||
1. Make sure that the MariaDB addon is installed or use a remote MySQL server.
|
||||
1. Install the Spotweb add-on.
|
||||
1. Click the `Save` button to store your configuration.
|
||||
1. Start the add-on.
|
||||
1. Check the logs of the add-on to see if everything went well.
|
||||
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
|
||||
|
||||
## Configuration
|
||||
|
||||
**Note**: _Remember to restart the add-on when the configuration is changed._
|
||||
|
||||
Example add-on configuration:
|
||||
|
||||
```yaml
|
||||
log_level: info
|
||||
ssl: false
|
||||
certfile: fullchain.pem
|
||||
keyfile: privkey.pem
|
||||
```
|
||||
|
||||
**Note**: _This is just an example, don't copy and paste it! Create your own!_
|
||||
|
||||
### Option: `log_level`
|
||||
|
||||
The `log_level` option controls the level of log output by the addon and can
|
||||
be changed to be more or less verbose, which might be useful when you are
|
||||
dealing with an unknown issue. Possible values are:
|
||||
|
||||
- `trace`: Show every detail, like all called internal functions.
|
||||
- `debug`: Shows detailed debug information.
|
||||
- `info`: Normal (usually) interesting events.
|
||||
- `warning`: Exceptional occurrences that are not errors.
|
||||
- `error`: Runtime errors that do not require immediate action.
|
||||
- `fatal`: Something went terribly wrong. Add-on becomes unusable.
|
||||
|
||||
Please note that each level automatically includes log messages from a
|
||||
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: `ssl`
|
||||
|
||||
Enables/Disables SSL (HTTPS) on the web interface of Bookstack
|
||||
Panel. 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: `remote_mysql_host`
|
||||
|
||||
If using an external database, the hostname/address for the MYSQL/MariaDB
|
||||
database.
|
||||
|
||||
### Option: `remote_mysql_database`
|
||||
|
||||
Only applies if a remote MYSQL database is used, the name of the database.
|
||||
|
||||
### Option: `remote_mysql_username`
|
||||
|
||||
Only applies if a remote MYSQL database is used, the username with permissions.
|
||||
|
||||
### Option: `remote_mysql_password`
|
||||
|
||||
Only applies if a remote MYSQL database is used, the password of the above user.
|
||||
|
||||
### Option: `remote_mysql_port`
|
||||
|
||||
Only applies if a remote MYSQL database is used, the port that the database
|
||||
server is listening on.
|
||||
|
||||
## Database usage
|
||||
|
||||
By default, spotweb will automatically use and configure the Home Assistant
|
||||
MariaDB addon which should be installed prior to startup, this can be changed
|
||||
within the configuration to use an external MySql/MariaDB Database. Please note
|
||||
that there is no easy upgrade path between the two options.
|
||||
|
||||
## Known issues and limitations
|
||||
|
||||
## Changelog & Releases
|
||||
|
||||
This repository keeps a change log using [GitHub's releases][releases]
|
||||
functionality.
|
||||
|
||||
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 [Wouter Coppens][woutercoppens].
|
||||
|
||||
For a full list of all authors and contributors,
|
||||
check [the contributor's page][contributors].
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Wouter Coppens
|
||||
|
||||
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.
|
||||
|
||||
[spotnet]: https://github.com/spotnet/spotnet/wiki
|
||||
[spotweb]: https://github.com/spotweb/spotweb
|
||||
[contributors]: https://github.com/alexbelgium/spotweb/graphs/contributors
|
||||
[discord-ha]: https://discord.gg/c5DvZ4e
|
||||
[discord]: https://discord.me/hassioaddons
|
||||
[forum]: https://community.home-assistant.io/t/community-hass-io-xxxxx/xxxxx
|
||||
[woutercoppens]: https://github.com/alexbelgium
|
||||
[issue]: https://github.com/alexbelgium/hassio-addons/issues
|
||||
[reddit]: https://reddit.com/r/homeassistant
|
||||
[releases]: https://github.com/alexbelgium/hassio-addons/releases
|
||||
[semver]: http://semver.org/spec/v2.0.0
|
||||
139
spotweb/Dockerfile
Normal file
139
spotweb/Dockerfile
Normal file
@@ -0,0 +1,139 @@
|
||||
#============================#
|
||||
# ALEXBELGIUM'S DOCKERFILE #
|
||||
#============================#
|
||||
# _.------.
|
||||
# _.-` ('>.-`"""-.
|
||||
# '.--'` _'` _ .--.)
|
||||
# -' '-.-';` `
|
||||
# ' - _.' ``'--.
|
||||
# '---` .-'""`
|
||||
# /`
|
||||
#=== Home Assistant Addon ===#
|
||||
|
||||
#################
|
||||
# 1 Build Image #
|
||||
#################
|
||||
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:11.0.0
|
||||
# hadolint ignore=DL3006
|
||||
FROM $BUILD_FROM
|
||||
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
##################
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# Environment variables
|
||||
ENV APP_ID="spotweb"
|
||||
ENV APP_NAME="Spotweb"
|
||||
ENV APP_DIR="/app"
|
||||
ENV SPOTWEB_RELEASE="1.5.1"
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Setup base
|
||||
# hadolint ignore=DL3003
|
||||
# Install app dependencies
|
||||
RUN apk -U update && \
|
||||
apk -U upgrade && \
|
||||
apk -U add --no-cache \
|
||||
git \
|
||||
nginx \
|
||||
php8 \
|
||||
php8-fpm \
|
||||
php8-curl \
|
||||
php8-dom \
|
||||
php8-gettext \
|
||||
php8-xml \
|
||||
php8-simplexml \
|
||||
php8-zip \
|
||||
php8-zlib \
|
||||
php8-gd \
|
||||
php8-openssl \
|
||||
php8-mysqli \
|
||||
php8-pdo \
|
||||
php8-pdo_mysql \
|
||||
php8-pgsql \
|
||||
php8-pdo_pgsql \
|
||||
php8-sqlite3 \
|
||||
php8-pdo_sqlite \
|
||||
php8-json \
|
||||
php8-mbstring \
|
||||
php8-ctype \
|
||||
php8-opcache \
|
||||
php8-session \
|
||||
mariadb-client \
|
||||
\
|
||||
&& mkdir -p /app \
|
||||
# Install latest Spotweb release
|
||||
&& git clone --depth=1 https://github.com/spotweb/spotweb.git /app \
|
||||
# spotweb needs a timezone set in the php.ini
|
||||
# TODO: Can we dynamically set the correct timezone here ?
|
||||
&& sed -i "s/;date.timezone =/date.timezone = \"Europe\/Amsterdam\"/g" /etc/php8/php.ini \
|
||||
&& mkdir /app/cache \
|
||||
&& mkdir /var/tmp/nginx
|
||||
|
||||
##################
|
||||
# 3 Install apps #
|
||||
##################
|
||||
|
||||
# Copy rootfs
|
||||
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
|
||||
|
||||
# Modules
|
||||
ARG MODULES="00-banner.sh"
|
||||
|
||||
# Automatic modules download
|
||||
RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& mkdir -p /etc/cont-init.d \
|
||||
&& for scripts in $MODULES; do curl -L -f -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" || (echo "script failed to install $scripts" && exit 1); done \
|
||||
&& chmod -R 755 /etc/cont-init.d || printf '%s\n' "${MODULES}" >/MODULESFILE
|
||||
|
||||
# Manual apps
|
||||
ENV PACKAGES=""
|
||||
|
||||
# Automatic apps & bashio
|
||||
RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||
&& chmod 777 /automatic_packages.sh \
|
||||
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||
&& rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE
|
||||
|
||||
################
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
############
|
||||
|
||||
# Labels
|
||||
LABEL \
|
||||
io.hass.name="${APP_NAME}" \
|
||||
io.hass.description="${APP_NAME} Add-on for Home Assistant" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="Wouter" \
|
||||
org.label-schema.description="${APP_NAME} Add-on for Home Assistant" \
|
||||
org.label-schema.build-date=${BUILD_DATE} \
|
||||
org.label-schema.name="${APP_NAME}" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.url="https://github.com/alexbelgium/hassio-addons/${APP_ID}" \
|
||||
org.label-schema.usage="https://github.com/alexbelgium/hassio-addons/tree/master/${APP_ID}/README.md" \
|
||||
org.label-schema.vcs-ref=${BUILD_REF} \
|
||||
org.label-schema.vcs-url="https://github.com/alexbelgium/hassio-addons/${APP_ID}" \
|
||||
org.label-schema.vendor="Wouter's Community Add-ons for Home Assistant"
|
||||
40
spotweb/README.md
Normal file
40
spotweb/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Wouter's Home Assistant Add-ons: Spotweb by @woutercoppens
|
||||
|
||||
## About
|
||||
|
||||
This addon was built by [@woutercoppens](https://github.com/woutercoppens/hassio-addons/tree/main/spotweb) and is hosted on this repository.
|
||||
|
||||
[Spotweb][spotweb] is a decentralized usenet community based on the [Spotnet][spotnet] protocol.
|
||||
|
||||
Spotweb is one of the most-featured Spotnet clients currently available, featuring among other things:
|
||||
|
||||
- Fast.
|
||||
- Customizable filter system from within the system.
|
||||
- Showing and filtering on new spots since the last view.
|
||||
- Watchlist.
|
||||
- Integration with Sick Gear , Sick beard and CouchPotato as a 'newznab' provider.
|
||||
- Sabnzbd and nzbget integration.
|
||||
- Multi-language.
|
||||
- Multiple-user ready.
|
||||
|
||||
## Installation
|
||||
|
||||
Note: This addon requires a mysql database. Make sure you have the MariaDB addon running of use a remote MySQL server.
|
||||
A database and user will be auto created if the MariaDB addon is detected.
|
||||
|
||||
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
|
||||
1. Make sure that the MariaDB addon is installed or use a remote MySQL server.
|
||||
1. Install the Spotweb add-on.
|
||||
1. Click the `Save` button to store your configuration.
|
||||
1. Start the add-on.
|
||||
1. Check the logs of the add-on to see if everything went well.
|
||||
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
|
||||
|
||||
Thanks to Ingress support, security and authentication is handled by Home Assistant. Therefore authentication in Spotweb is disabled by default. Spotweb is ready to use after installation through Ingress WebUI.
|
||||
|
||||
Spots are retrieved every hour by a background task.
|
||||
Restart the addon after entering your credentials to force the first sync of spots.
|
||||
|
||||
[repository]: https://github.com/alexbelgium/hassio-addons
|
||||
[spotnet]: https://github.com/spotnet/spotnet/wiki
|
||||
[spotweb]: https://github.com/spotweb/spotweb
|
||||
7
spotweb/build.yaml
Normal file
7
spotweb/build.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
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
|
||||
36
spotweb/config.json
Normal file
36
spotweb/config.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"arch": ["aarch64", "amd64", "armhf", "armv7", "i386"],
|
||||
"name": "Spotweb by @woutercoppens",
|
||||
"image": "ghcr.io/alexbelgium/spotweb-{arch}",
|
||||
"version": "dev",
|
||||
"slug": "spotweb",
|
||||
"description": "Spotweb is a decentralized usenet community based on the Spotnet protocol",
|
||||
"url": "https://github.com/alexbelgium/hassio-addons/spotweb",
|
||||
"init": false,
|
||||
"ingress": true,
|
||||
"ingress_port": 8099,
|
||||
"panel_icon": "mdi:chart-timeline",
|
||||
"panel_title": "Spotweb",
|
||||
"map": ["ssl", "config:rw", "backup:rw"],
|
||||
"options": {
|
||||
"ssl": false,
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem"
|
||||
},
|
||||
"ports": { "80/tcp": null },
|
||||
"ports_description": { "80/tcp": "Not required for Ingress" },
|
||||
"schema": {
|
||||
"remote_mysql_host": "str?",
|
||||
"remote_mysql_database": "str?",
|
||||
"remote_mysql_username": "str?",
|
||||
"remote_mysql_password": "password?",
|
||||
"remote_mysql_port": "int?",
|
||||
"log_level": "list(trace|debug|info|notice|warning|error|fatal)?",
|
||||
"certfile": "str",
|
||||
"keyfile": "str",
|
||||
"ssl": "bool"
|
||||
},
|
||||
"services": ["mysql:want"],
|
||||
"startup": "services",
|
||||
"hassio_api": true
|
||||
}
|
||||
BIN
spotweb/icon.png
Normal file
BIN
spotweb/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
spotweb/logo.png
Normal file
BIN
spotweb/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
112
spotweb/rootfs/etc/cont-init.d/90-spotweb
Normal file
112
spotweb/rootfs/etc/cont-init.d/90-spotweb
Normal file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: spotweb
|
||||
# This file validates config and creates the database
|
||||
# ==============================================================================
|
||||
|
||||
declare host
|
||||
declare username
|
||||
declare password
|
||||
declare port
|
||||
declare dbname
|
||||
|
||||
|
||||
if bashio::config.has_value 'remote_mysql_host'; then
|
||||
if ! bashio::config.has_value 'remote_mysql_database'; then
|
||||
bashio::exit.nok \
|
||||
"Remote database has been specified but no database is configured"
|
||||
fi
|
||||
|
||||
if ! bashio::config.has_value 'remote_mysql_username'; then
|
||||
bashio::exit.nok \
|
||||
"Remote database has been specified but no username is configured"
|
||||
fi
|
||||
|
||||
if ! bashio::config.has_value 'remote_mysql_password'; then
|
||||
bashio::log.fatal \
|
||||
"Remote database has been specified but no password is configured"
|
||||
fi
|
||||
|
||||
if ! bashio::config.exists 'remote_mysql_port'; then
|
||||
bashio::exit.nok \
|
||||
"Remote database has been specified but no port is configured"
|
||||
fi
|
||||
|
||||
host=$(bashio::config "remote_mysql_host")
|
||||
password=$(bashio::config "remote_mysql_password")
|
||||
port=$(bashio::config "remote_mysql_port")
|
||||
username=$(bashio::config "remote_mysql_username")
|
||||
dbname=$(bashio::config "remote_mysql_database")
|
||||
|
||||
else
|
||||
# Require MySQL service to be available
|
||||
if ! bashio::services.available mysql; then
|
||||
bashio::log.fatal \
|
||||
"Local database access should be provided by the MariaDB addon"
|
||||
bashio::exit.nok \
|
||||
"Please ensure it is installed and started"
|
||||
fi
|
||||
|
||||
dbname="spotweb"
|
||||
host=$(bashio::services mysql "host")
|
||||
port=$(bashio::services mysql "port")
|
||||
username=$(bashio::services mysql "username")
|
||||
password=$(bashio::services mysql "password")
|
||||
# password='spotweb'
|
||||
# username='spotweb'
|
||||
|
||||
bashio::log.warning "Spotweb is using the Maria DB addon"
|
||||
bashio::log.warning "Please ensure this is included in your backups"
|
||||
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
||||
|
||||
fi
|
||||
|
||||
# write db config file for spotweb
|
||||
{
|
||||
echo "<?php"
|
||||
echo "\$dbsettings['engine'] = 'pdo_mysql';"
|
||||
echo "\$dbsettings['host'] = '${host}';"
|
||||
echo "\$dbsettings['dbname'] = '${dbname}';"
|
||||
echo "\$dbsettings['user'] = '${username}';"
|
||||
echo "\$dbsettings['pass'] = '${password}';"
|
||||
echo "\$dbsettings['port'] = '${port}';"
|
||||
} > /app/dbsettings.inc.php
|
||||
|
||||
|
||||
# cat /app/dbsettings.inc.php
|
||||
|
||||
# wait for mysql server to be available
|
||||
until nc -z -v -w30 $host $port
|
||||
do
|
||||
bashio::log.info "Waiting for database connection at host '${host}:${port}'..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Check if database already exists
|
||||
RESULT=`mysql -u "${username}" -p"${password}" -h "${host}" -P "${port}" --skip-column-names -e "SHOW DATABASES LIKE '${dbname}'"`
|
||||
if [ "$RESULT" == "$dbname" ]; then
|
||||
# database already exists, do healthcheck with upgrade-db
|
||||
bashio::log.info "Existing database, checking health with upgrade-db...."
|
||||
s6-setuidgid nginx php8 /app/bin/upgrade-db.php>/dev/null
|
||||
else
|
||||
# database does not yet exist
|
||||
bashio::log.info "Creating database with default settings...."
|
||||
mysql \
|
||||
-u "${username}" -p"${password}" \
|
||||
-h "${host}" -P "${port}" \
|
||||
-e "CREATE DATABASE ${dbname};"
|
||||
# init database with default values
|
||||
s6-setuidgid nginx php8 /app/bin/upgrade-db.php
|
||||
# set systemtype to public (as we're behind ingress)
|
||||
s6-setuidgid nginx php8 /app/bin/upgrade-db.php --set-systemtype public
|
||||
# we also set some sane default settings
|
||||
mysql \
|
||||
-u "${username}" -p"${password}" \
|
||||
-h "${host}" -P "${port}" \
|
||||
-D "${dbname}" \
|
||||
-e "REPLACE INTO usergroups(userid, groupid) VALUES (1, 2); \
|
||||
REPLACE INTO usergroups(userid, groupid) VALUES (1, 3); \
|
||||
REPLACE INTO usergroups(userid, groupid) VALUES (1, 4); \
|
||||
REPLACE INTO usergroups(userid, groupid) VALUES (1, 5); \
|
||||
UPDATE usersettings SET otherprefs='a:27:{s:17:\"template_specific\";a:1:{s:6:\"we1rdo\";a:1:{s:15:\"example_setting\";i:1;}}s:7:\"perpage\";i:25;s:15:\"date_formatting\";s:5:\"human\";s:15:\"normal_template\";s:6:\"we1rdo\";s:15:\"mobile_template\";s:6:\"we1rdo\";s:15:\"tablet_template\";s:6:\"we1rdo\";s:14:\"count_newspots\";s:2:\"on\";s:17:\"mouseover_subcats\";s:2:\"on\";s:13:\"keep_seenlist\";s:2:\"on\";s:15:\"auto_markasread\";s:2:\"on\";s:17:\"keep_downloadlist\";s:2:\"on\";s:14:\"keep_watchlist\";s:2:\"on\";s:17:\"nzb_search_engine\";s:8:\"nzbindex\";s:13:\"show_filesize\";s:2:\"on\";s:16:\"show_reportcount\";s:2:\"on\";s:19:\"minimum_reportcount\";s:1:\"1\";s:14:\"show_nzbbutton\";s:2:\"on\";s:13:\"show_multinzb\";s:2:\"on\";s:9:\"customcss\";s:0:\"\";s:18:\"newspotdefault_tag\";s:9:\"anonymous\";s:19:\"newspotdefault_body\";s:0:\"\";s:13:\"user_language\";s:5:\"en_US\";s:12:\"show_avatars\";s:2:\"on\";s:27:\"usemailaddress_for_gravatar\";b:1;s:11:\"nzbhandling\";a:7:{s:6:\"action\";s:6:\"nzbget\";s:9:\"local_dir\";s:4:\"/tmp\";s:14:\"prepare_action\";s:5:\"merge\";s:7:\"command\";s:0:\"\";s:7:\"sabnzbd\";a:4:{s:3:\"url\";s:0:\"\";s:6:\"apikey\";s:0:\"\";s:8:\"username\";s:0:\"\";s:8:\"password\";s:0:\"\";}s:6:\"nzbget\";a:6:{s:4:\"host\";s:28:\"addon_62c7908d_nzbget_docker\";s:4:\"port\";s:5:\"46836\";s:3:\"ssl\";s:0:\"\";s:8:\"username\";s:6:\"nzbget\";s:8:\"password\";s:0:\"\";s:7:\"timeout\";s:2:\"30\";}s:9:\"nzbvortex\";a:3:{s:4:\"host\";s:0:\"\";s:4:\"port\";s:0:\"\";s:6:\"apikey\";s:0:\"\";}}s:13:\"notifications\";a:6:{s:6:\"boxcar\";a:3:{s:5:\"email\";s:0:\"\";s:7:\"enabled\";b:0;s:6:\"events\";a:7:{s:17:\"watchlist_handled\";b:0;s:11:\"nzb_handled\";b:0;s:18:\"retriever_finished\";b:0;s:13:\"report_posted\";b:0;s:11:\"spot_posted\";b:0;s:10:\"user_added\";b:0;s:19:\"newspots_for_filter\";b:0;}}s:5:\"growl\";a:4:{s:4:\"host\";s:0:\"\";s:8:\"password\";s:0:\"\";s:7:\"enabled\";b:0;s:6:\"events\";a:7:{s:17:\"watchlist_handled\";b:0;s:11:\"nzb_handled\";b:0;s:18:\"retriever_finished\";b:0;s:13:\"report_posted\";b:0;s:11:\"spot_posted\";b:0;s:10:\"user_added\";b:0;s:19:\"newspots_for_filter\";b:0;}}s:3:\"nma\";a:3:{s:3:\"api\";s:0:\"\";s:7:\"enabled\";b:0;s:6:\"events\";a:7:{s:17:\"watchlist_handled\";b:0;s:11:\"nzb_handled\";b:0;s:18:\"retriever_finished\";b:0;s:13:\"report_posted\";b:0;s:11:\"spot_posted\";b:0;s:10:\"user_added\";b:0;s:19:\"newspots_for_filter\";b:0;}}s:5:\"prowl\";a:3:{s:6:\"apikey\";s:0:\"\";s:7:\"enabled\";b:0;s:6:\"events\";a:7:{s:17:\"watchlist_handled\";b:0;s:11:\"nzb_handled\";b:0;s:18:\"retriever_finished\";b:0;s:13:\"report_posted\";b:0;s:11:\"spot_posted\";b:0;s:10:\"user_added\";b:0;s:19:\"newspots_for_filter\";b:0;}}s:7:\"twitter\";a:7:{s:11:\"screen_name\";s:0:\"\";s:13:\"request_token\";s:0:\"\";s:20:\"request_token_secret\";s:0:\"\";s:12:\"access_token\";s:0:\"\";s:19:\"access_token_secret\";s:0:\"\";s:7:\"enabled\";b:0;s:6:\"events\";a:7:{s:17:\"watchlist_handled\";b:0;s:11:\"nzb_handled\";b:0;s:18:\"retriever_finished\";b:0;s:13:\"report_posted\";b:0;s:11:\"spot_posted\";b:0;s:10:\"user_added\";b:0;s:19:\"newspots_for_filter\";b:0;}}s:5:\"email\";a:2:{s:7:\"enabled\";b:0;s:6:\"events\";a:7:{s:17:\"watchlist_handled\";b:0;s:11:\"nzb_handled\";b:0;s:18:\"retriever_finished\";b:0;s:13:\"report_posted\";b:0;s:11:\"spot_posted\";b:0;s:10:\"user_added\";b:0;s:19:\"newspots_for_filter\";b:0;}}}s:16:\"defaultsortfield\";s:0:\"\";}' WHERE 1;"
|
||||
fi
|
||||
3
spotweb/rootfs/etc/fix-attrs.d/nginx
Normal file
3
spotweb/rootfs/etc/fix-attrs.d/nginx
Normal file
@@ -0,0 +1,3 @@
|
||||
/app/cache true nginx:nginx 0644 0755
|
||||
/var/tmp/nginx true nginx:nginx 0644 0755
|
||||
/var/lib/nginx true nginx:nginx 0644 0755
|
||||
96
spotweb/rootfs/etc/nginx/includes/mime.types
Normal file
96
spotweb/rootfs/etc/nginx/includes/mime.types
Normal file
@@ -0,0 +1,96 @@
|
||||
types {
|
||||
text/html html htm shtml;
|
||||
text/css css;
|
||||
text/xml xml;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
application/javascript js;
|
||||
application/atom+xml atom;
|
||||
application/rss+xml rss;
|
||||
|
||||
text/mathml mml;
|
||||
text/plain txt;
|
||||
text/vnd.sun.j2me.app-descriptor jad;
|
||||
text/vnd.wap.wml wml;
|
||||
text/x-component htc;
|
||||
|
||||
image/png png;
|
||||
image/svg+xml svg svgz;
|
||||
image/tiff tif tiff;
|
||||
image/vnd.wap.wbmp wbmp;
|
||||
image/webp webp;
|
||||
image/x-icon ico;
|
||||
image/x-jng jng;
|
||||
image/x-ms-bmp bmp;
|
||||
|
||||
font/woff woff;
|
||||
font/woff2 woff2;
|
||||
|
||||
application/java-archive jar war ear;
|
||||
application/json json;
|
||||
application/mac-binhex40 hqx;
|
||||
application/msword doc;
|
||||
application/pdf pdf;
|
||||
application/postscript ps eps ai;
|
||||
application/rtf rtf;
|
||||
application/vnd.apple.mpegurl m3u8;
|
||||
application/vnd.google-earth.kml+xml kml;
|
||||
application/vnd.google-earth.kmz kmz;
|
||||
application/vnd.ms-excel xls;
|
||||
application/vnd.ms-fontobject eot;
|
||||
application/vnd.ms-powerpoint ppt;
|
||||
application/vnd.oasis.opendocument.graphics odg;
|
||||
application/vnd.oasis.opendocument.presentation odp;
|
||||
application/vnd.oasis.opendocument.spreadsheet ods;
|
||||
application/vnd.oasis.opendocument.text odt;
|
||||
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||
pptx;
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||
xlsx;
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||
docx;
|
||||
application/vnd.wap.wmlc wmlc;
|
||||
application/x-7z-compressed 7z;
|
||||
application/x-cocoa cco;
|
||||
application/x-java-archive-diff jardiff;
|
||||
application/x-java-jnlp-file jnlp;
|
||||
application/x-makeself run;
|
||||
application/x-perl pl pm;
|
||||
application/x-pilot prc pdb;
|
||||
application/x-rar-compressed rar;
|
||||
application/x-redhat-package-manager rpm;
|
||||
application/x-sea sea;
|
||||
application/x-shockwave-flash swf;
|
||||
application/x-stuffit sit;
|
||||
application/x-tcl tcl tk;
|
||||
application/x-x509-ca-cert der pem crt;
|
||||
application/x-xpinstall xpi;
|
||||
application/xhtml+xml xhtml;
|
||||
application/xspf+xml xspf;
|
||||
application/zip zip;
|
||||
|
||||
application/octet-stream bin exe dll;
|
||||
application/octet-stream deb;
|
||||
application/octet-stream dmg;
|
||||
application/octet-stream iso img;
|
||||
application/octet-stream msi msp msm;
|
||||
|
||||
audio/midi mid midi kar;
|
||||
audio/mpeg mp3;
|
||||
audio/ogg ogg;
|
||||
audio/x-m4a m4a;
|
||||
audio/x-realaudio ra;
|
||||
|
||||
video/3gpp 3gpp 3gp;
|
||||
video/mp2t ts;
|
||||
video/mp4 mp4;
|
||||
video/mpeg mpeg mpg;
|
||||
video/quicktime mov;
|
||||
video/webm webm;
|
||||
video/x-flv flv;
|
||||
video/x-m4v m4v;
|
||||
video/x-mng mng;
|
||||
video/x-ms-asf asx asf;
|
||||
video/x-ms-wmv wmv;
|
||||
video/x-msvideo avi;
|
||||
}
|
||||
63
spotweb/rootfs/etc/nginx/nginx.conf
Normal file
63
spotweb/rootfs/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,63 @@
|
||||
# Run nginx in foreground.
|
||||
daemon off;
|
||||
|
||||
# This is run inside Docker.
|
||||
user nginx;
|
||||
|
||||
# Pid storage location.
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
# Set number of worker processes.
|
||||
worker_processes 1;
|
||||
|
||||
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||
pcre_jit on;
|
||||
|
||||
# Write error log to the add-on log.
|
||||
error_log /proc/1/fd/1 error;
|
||||
|
||||
# Load allowed environment vars
|
||||
env SUPERVISOR_TOKEN;
|
||||
|
||||
# Load dynamic modules.
|
||||
include /etc/nginx/modules/*.conf;
|
||||
|
||||
# Max num of simultaneous connections by a worker process.
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/includes/mime.types;
|
||||
|
||||
log_format homeassistant '[$time_local] $status '
|
||||
'$http_x_forwarded_for($remote_addr) '
|
||||
'$http_x_ingress_path '
|
||||
'$request ($http_user_agent)';
|
||||
|
||||
access_log off;
|
||||
client_max_body_size 100m;
|
||||
default_type application/octet-stream;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_proxied any;
|
||||
keepalive_timeout 2;
|
||||
sendfile on;
|
||||
server_tokens off;
|
||||
tcp_nodelay on;
|
||||
tcp_nopush on;
|
||||
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
|
||||
|
||||
map $http_x_forwarded_proto $fastcgi_https {
|
||||
default off;
|
||||
"~https" on;
|
||||
}
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
include /etc/nginx/servers/*.conf;
|
||||
}
|
||||
37
spotweb/rootfs/etc/nginx/servers/ingress.conf
Normal file
37
spotweb/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,37 @@
|
||||
server {
|
||||
listen 8099 default_server;
|
||||
|
||||
root /dev/null;
|
||||
server_name $hostname;
|
||||
|
||||
# server params
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
|
||||
# proxy params
|
||||
proxy_http_version 1.1;
|
||||
proxy_ignore_client_abort off;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_redirect off;
|
||||
proxy_send_timeout 86400s;
|
||||
proxy_max_temp_file_size 0;
|
||||
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
proxy_set_header X-Forwarded-Uri $http_x_ingress_path;
|
||||
proxy_set_header X-SSL true;
|
||||
|
||||
location / {
|
||||
allow 172.30.32.2;
|
||||
deny all;
|
||||
proxy_pass http://127.0.0.1:80;
|
||||
}
|
||||
}
|
||||
44
spotweb/rootfs/etc/nginx/servers/spotweb.conf
Normal file
44
spotweb/rootfs/etc/nginx/servers/spotweb.conf
Normal file
@@ -0,0 +1,44 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
|
||||
root /app;
|
||||
index index.php;
|
||||
|
||||
# Make site accessible from http://localhost/
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /api {
|
||||
rewrite ^/api/?$ /index.php?page=newznabapi last;
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on socket
|
||||
#
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_buffers 32 4k;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param HTTPS $fastcgi_https;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
|
||||
expires 5d;
|
||||
}
|
||||
|
||||
# deny access to . files, for security
|
||||
#
|
||||
location ~ /\. {
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
6
spotweb/rootfs/etc/periodic/hourly/spotweb
Normal file
6
spotweb/rootfs/etc/periodic/hourly/spotweb
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Runs the hourly task to update spots
|
||||
# ==============================================================================
|
||||
|
||||
s6-setuidgid nginx php8 /app/retrieve.php
|
||||
12
spotweb/rootfs/etc/php8/conf.d/zzz_custom_opcache.ini
Normal file
12
spotweb/rootfs/etc/php8/conf.d/zzz_custom_opcache.ini
Normal file
@@ -0,0 +1,12 @@
|
||||
[opcache]
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
; 0 means it will check on every request
|
||||
; 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production
|
||||
opcache.revalidate_freq=0
|
||||
opcache.validate_timestamps=1
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=192
|
||||
opcache.max_wasted_percentage=10
|
||||
opcache.interned_strings_buffer=16
|
||||
opcache.fast_shutdown=1
|
||||
6
spotweb/rootfs/etc/php8/conf.d/zzz_custom_other.ini
Normal file
6
spotweb/rootfs/etc/php8/conf.d/zzz_custom_other.ini
Normal file
@@ -0,0 +1,6 @@
|
||||
; Make sure _ENV is populated to use it in spotweb database settings
|
||||
variables_order = "EGPCS"
|
||||
|
||||
date.timezone = Europe/Amsterdam
|
||||
|
||||
memory_limit = 1G
|
||||
18
spotweb/rootfs/etc/php8/php-fpm.d/www.conf
Normal file
18
spotweb/rootfs/etc/php8/php-fpm.d/www.conf
Normal file
@@ -0,0 +1,18 @@
|
||||
[www]
|
||||
user = nginx
|
||||
group = nginx
|
||||
|
||||
listen = 127.0.0.1:9000
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 50
|
||||
pm.start_servers = 20
|
||||
pm.min_spare_servers = 5
|
||||
pm.max_spare_servers = 20
|
||||
pm.max_requests = 1024
|
||||
;pm.status_path = /status
|
||||
|
||||
; if we send this to /proc/self/fd/1, it never appears
|
||||
access.log = /proc/self/fd/1
|
||||
|
||||
clear_env = no
|
||||
3
spotweb/rootfs/etc/services.d/cron/run
Normal file
3
spotweb/rootfs/etc/services.d/cron/run
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/with-contenv sh
|
||||
|
||||
/usr/sbin/crond -f -S -l 0
|
||||
9
spotweb/rootfs/etc/services.d/nginx/finish
Normal file
9
spotweb/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: spotweb
|
||||
# Take down the S6 supervision tree when Nginx fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
12
spotweb/rootfs/etc/services.d/nginx/run
Normal file
12
spotweb/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: spotweb
|
||||
# Runs the Nginx daemon
|
||||
# ==============================================================================
|
||||
|
||||
# Wait for PHP-FPM to become available
|
||||
bashio::net.wait_for 9000
|
||||
|
||||
bashio::log.info "Starting NGinx..."
|
||||
|
||||
nginx -c /etc/nginx/nginx.conf
|
||||
9
spotweb/rootfs/etc/services.d/phpfpm/finish
Normal file
9
spotweb/rootfs/etc/services.d/phpfpm/finish
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Bookstack
|
||||
# Take down the S6 supervision tree when PHP FPM fails
|
||||
# ==============================================================================
|
||||
if -n { s6-test $# -ne 0 }
|
||||
if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
6
spotweb/rootfs/etc/services.d/phpfpm/run
Normal file
6
spotweb/rootfs/etc/services.d/phpfpm/run
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.info "Starting PHP-FPM..."
|
||||
|
||||
#/usr/sbin/php-fpm8 -F
|
||||
exec php-fpm8 --nodaemonize
|
||||
Reference in New Issue
Block a user