This commit is contained in:
2021-08-24 14:35:11 +03:00
parent d8fba9335d
commit 4f37cb59b1
107 changed files with 3941 additions and 66 deletions

View File

@@ -0,0 +1,16 @@
# Changelog
## 2.1.1
- bump hassio-addon-base to V10.0.1
## 2.1.0
- bump hassio-addon-base to V10.0.0
## 2.0.3
- Enable Apache Foreground Logging
## 2.0.2
- ability to set a username and password to access the webfiles
## 2.0.0
- Initial release of the minimal Version

View File

@@ -0,0 +1,20 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.1
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
ENV LANG C.UTF-8
# Create directory for apache2 to store PID file
RUN mkdir /run/apache2
RUN apk --no-cache add apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl
#Configure Logging
RUN sed -i -r 's@Errorlog .*@Errorlog /dev/stderr@i' /etc/apache2/httpd.conf
RUN echo "Transferlog /dev/stdout" >> /etc/apache2/httpd.conf
# Copy data for add-on
COPY run.sh /
COPY index.html /
RUN chmod a+x /run.sh
RUN chmod a+x /index.html
CMD [ "/run.sh" ]

View File

@@ -0,0 +1,2 @@
Have a look at the README for Apache2 full Addon for more informations.
[README](https://github.com/FaserF/hassio-addons/blob/master/apache2/README.md)

View File

@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "ghcr.io/hassio-addons/base/aarch64:10.0.1",
"amd64": "ghcr.io/hassio-addons/base/amd64:10.0.1",
"armhf": "ghcr.io/hassio-addons/base/armhf:10.0.1",
"armv7": "ghcr.io/hassio-addons/base/armv7:10.0.1",
"i386": "ghcr.io/hassio-addons/base/i386:10.0.1"
}
}

View File

@@ -0,0 +1,42 @@
{
"name": "Apache2 Minimal",
"version": "2.1.1",
"slug": "apache2-minimal",
"description": "Webserver without PHP and minimal extra modules",
"url": "https://github.com/FaserF/hassio-addons/tree/master/apache2-minimal",
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
"startup": "application",
"boot": "auto",
"webui": "[PROTO:ssl]://[HOST]:[PORT:80]",
"map": ["share:rw", "media:rw", "ssl"],
"ingress": true,
"panel_icon": "mdi:web-box",
"options": {
"document_root": "/share/htdocs",
"default_conf": "default",
"default_ssl_conf": "default",
"website_name":null,
"ssl": true,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
},
"schema": {
"document_root":"str",
"default_conf":"str",
"default_ssl_conf":"str",
"website_name":"str",
"username":"str?",
"password":"str?",
"ssl": "bool",
"certfile": "str",
"keyfile": "str"
},
"ports": {
"80/tcp": 80,
"443": 443
},
"ports_description": {
"80/tcp": "Web interface http",
"443/tcp": "SSL Web interface"
}
}

BIN
apache2-minimal/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

284
apache2-minimal/index.html Normal file
View File

@@ -0,0 +1,284 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Modified from the Debian original for Ubuntu
Last updated: 2014-03-19
See: https://launchpad.net/bugs/1288690
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache2 FaserF Homeassistant Addon Default Page: It works</title>
<style type="text/css" media="screen">
* {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
body, html {
padding: 3px 3px 3px 3px;
background-color: #D8DBE2;
font-family: Verdana, sans-serif;
font-size: 11pt;
text-align: center;
}
div.main_page {
position: relative;
display: table;
width: 800px;
margin-bottom: 3px;
margin-left: auto;
margin-right: auto;
padding: 0px 0px 0px 0px;
border-width: 2px;
border-color: #212738;
border-style: solid;
background-color: #FFFFFF;
text-align: center;
}
div.page_header {
height: 99px;
width: 100%;
background-color: #F5F6F7;
}
div.page_header span {
margin: 15px 0px 0px 50px;
font-size: 180%;
font-weight: bold;
}
div.page_header img {
margin: 3px 0px 0px 40px;
border: 0px 0px 0px;
}
div.table_of_contents {
clear: left;
min-width: 200px;
margin: 3px 3px 3px 3px;
background-color: #FFFFFF;
text-align: left;
}
div.table_of_contents_item {
clear: left;
width: 100%;
margin: 4px 0px 0px 0px;
background-color: #FFFFFF;
color: #000000;
text-align: left;
}
div.table_of_contents_item a {
margin: 6px 0px 0px 6px;
}
div.content_section {
margin: 3px 3px 3px 3px;
background-color: #FFFFFF;
text-align: left;
}
div.content_section_text {
padding: 4px 8px 4px 8px;
color: #000000;
font-size: 100%;
}
div.content_section_text pre {
margin: 8px 0px 8px 0px;
padding: 8px 8px 8px 8px;
border-width: 1px;
border-style: dotted;
border-color: #000000;
background-color: #F5F6F7;
font-style: italic;
}
div.content_section_text p {
margin-bottom: 6px;
}
div.content_section_text ul, div.content_section_text li {
padding: 4px 8px 4px 16px;
}
div.section_header {
padding: 3px 6px 3px 6px;
background-color: #8E9CB2;
color: #FFFFFF;
font-weight: bold;
font-size: 112%;
text-align: center;
}
div.section_header_red {
background-color: #CD214F;
}
div.section_header_grey {
background-color: #9F9386;
}
.floating_element {
position: relative;
float: left;
}
div.table_of_contents_item a,
div.content_section_text a {
text-decoration: none;
font-weight: bold;
}
div.table_of_contents_item a:link,
div.table_of_contents_item a:visited,
div.table_of_contents_item a:active {
color: #000000;
}
div.table_of_contents_item a:hover {
background-color: #000000;
color: #FFFFFF;
}
div.content_section_text a:link,
div.content_section_text a:visited,
div.content_section_text a:active {
background-color: #DCDFE6;
color: #000000;
}
div.content_section_text a:hover {
background-color: #000000;
color: #DCDFE6;
}
div.validator {
}
</style>
</head>
<body>
<div class="main_page">
<div class="page_header floating_element">
<span class="floating_element">
Apache2 FaserF Homeassistant Addon Default Page
</span>
</div>
<!-- <div class="table_of_contents floating_element">
<div class="section_header section_header_grey">
TABLE OF CONTENTS
</div>
<div class="table_of_contents_item floating_element">
<a href="#about">About</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#changes">Changes</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#scope">Scope</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#files">Config files</a>
</div>
</div>
-->
<div class="content_section floating_element">
<div class="section_header section_header_red">
<div id="about"></div>
It works!
</div>
<div class="content_section_text">
<p>
This is the default welcome page used to test the correct
operation of the Apache2 server after the installation of the Homeassistant Addon.
If you can read this page, it means that the Apache HTTP server installed at
this site is working properly. You should <b>replace this file</b> (located at
<tt>/share/htdocs/index.html</tt>) before continuing to operate your HTTP server.
</p>
<p>
If you are a normal user of this web site and don't know what this page is
about, this probably means that the site is currently unavailable due to
maintenance.
If the problem persists, please contact the site's administrator.
</p>
</div>
<div class="section_header">
<div id="changes"></div>
Configuration Overview
</div>
<div class="content_section_text">
<p>
The configuration system is <b>fully documented in
the github repository</b>. Refer to this for the full
documentation. Documentation can be
found by accessing the <a href="https://github.com/FaserF/hassio-addons/tree/master/apache2">manual</a>.
</p>
</div>
<div class="section_header">
<div id="bugs"></div>
Reporting Problems
</div>
<div class="content_section_text">
<p>
Please use the <tt>github issues tracker</tt> tool to report bugs in the
Apache2 Addon with Homeassistant. However, check <a
href="https://github.com/FaserF/hassio-addons/issues">existing
bug reports</a> before reporting a new bug.
</p>
<p>
Please report bugs specific to modules (such as PHP and others)
to respective packages, not to the web server itself.
</p>
</div>
</div>
</div>
<div class="validator">
<p>
<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</p>
</div>
</body>
</html>

166
apache2-minimal/run.sh Normal file
View File

@@ -0,0 +1,166 @@
#!/usr/bin/env bashio
ssl=$(bashio::config 'ssl')
website_name=$(bashio::config 'website_name')
certfile=$(bashio::config 'certfile')
keyfile=$(bashio::config 'keyfile')
DocumentRoot=$(bashio::config 'document_root')
phpini=$(bashio::config 'php_ini')
username=$(bashio::config 'username')
password=$(bashio::config 'password')
default_conf=$(bashio::config 'default_conf')
default_ssl_conf=$(bashio::config 'default_ssl_conf')
webrootdocker=/var/www/localhost/htdocs/
if [ $phpini = "get_file" ]; then
cp /etc/php7/php.ini /share/apache2addon_php.ini
echo "You have requestet a copy of the php.ini file. You will now find your copy at /share/apache2addon_php.ini"
echo "Addon will now be stopped. Please remove the config option and change it to the name of your new config file (for example /share/php.ini)"
exit 1
fi
rm -r $webrootdocker
if [ ! -d $DocumentRoot ]; then
echo "You haven't put your website to $DocumentRoot"
echo "A default website will now be used"
mkdir $webrootdocker
cp /index.html $webrootdocker
else
#Create Shortcut to shared html folder
ln -s $DocumentRoot /var/www/localhost/htdocs
fi
#Set rights to web folders and create user
find $DocumentRoot -type d -exec chmod 771 {} \;
if [ ! -z "$username" ] && [ ! -z "$password" ] && [ ! $username = "null" ] && [ ! $password = "null" ]; then
adduser -S $username -G www-data
echo "$username:$password" | chpasswd $username
find $webrootdocker -type d -exec chown $username:www-data -R {} \;
find $webrootdocker -type f -exec chown $username:www-data -R {} \;
else
echo "No username and/or password was provided. Skipping account set up."
fi
if [ $phpini != "default" ]; then
if [ -f $phpini ]; then
echo "Your custom php.ini at $phpini will be used."
rm /etc/php7/php.ini
cp $phpini /etc/php7/php.ini
else
echo "You have changed the php_ini variable, but the new file could not be found! Default php.ini file will be used instead."
fi
fi
if [ $ssl = "true" ] && [ $default_conf = "default" ]; then
echo "You have activated SSL. SSL Settings will be applied"
if [ ! -f /ssl/$certfile ]; then
echo "Cannot find certificate file $certfile"
exit 1
fi
if [ ! -f /ssl/$keyfile ]; then
echo "Cannot find certificate key file $keyfile"
exit 1
fi
mkdir /etc/apache2/sites-enabled
sed -i '/LoadModule rewrite_module/s/^#//g' /etc/apache2/httpd.conf
echo "Listen 8099" >> /etc/apache2/httpd.conf
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/000-default.conf
echo "ServerName $website_name" >> /etc/apache2/sites-enabled/000-default.conf
echo "ServerAdmin webmaster@localhost" >> /etc/apache2/sites-enabled/000-default.conf
echo "DocumentRoot $webrootdocker" >> /etc/apache2/sites-enabled/000-default.conf
echo "#Redirect http to https" >> /etc/apache2/sites-enabled/000-default.conf
echo " RewriteEngine On" >> /etc/apache2/sites-enabled/000-default.conf
echo " RewriteCond %{HTTPS} off" >> /etc/apache2/sites-enabled/000-default.conf
echo " RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}" >> /etc/apache2/sites-enabled/000-default.conf
echo "#End Redirect http to https" >> /etc/apache2/sites-enabled/000-default.conf
echo " ErrorLog /var/log/error.log" >> /etc/apache2/sites-enabled/000-default.conf
echo " #CustomLog /var/log/access.log combined" >> /etc/apache2/sites-enabled/000-default.conf
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default.conf
echo "<IfModule mod_ssl.c>" > /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "<VirtualHost *:443>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "ServerName $website_name" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "ServerAdmin webmaster@localhost" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "DocumentRoot $webrootdocker" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo " ErrorLog /var/log/error.log" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo " #CustomLog /var/log/access.log combined" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "SSLCertificateFile /ssl/$certfile" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "SSLCertificateKeyFile /ssl/$keyfile" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "</IfModule>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
else
echo "SSL is deactivated and/or you are using a custom config."
fi
if [ "$ssl" = "true" ] || [ "$default_conf" != "default" ]; then
echo "Include /etc/apache2/sites-enabled/*.conf" >> /etc/apache2/httpd.conf
fi
sed -i -e '/AllowOverride/s/None/All/' /etc/apache2/httpd.conf
if [ "$default_conf" = "get_config" ]; then
if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
if [ ! -d /etc/apache2/sites-enabled ]; then
mkdir /etc/apache2/sites-enabled
fi
cp /etc/apache2/sites-enabled/000-default.conf /share/000-default.conf
echo "You have requested a copy of the apache2 config. You can now find it at /share/000-default.conf ."
fi
if [ -f /etc/apache2/httpd.conf ]; then
cp /etc/apache2/httpd.conf /share/httpd.conf
echo "You have requested a copy of the apache2 config. You can now find it at /share/httpd.conf ."
fi
if [ "$default_ssl_conf" != "get_config" ]; then
echo "Exiting now..."
exit 0
fi
fi
if [[ ! $default_conf =~ ^(default|get_config)$ ]]; then
if [ -f $default_conf ]; then
if [ ! -d /etc/apache2/sites-enabled ]; then
mkdir /etc/apache2/sites-enabled
fi
if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
rm /etc/apache2/sites-enabled/000-default.conf
fi
cp -rf $default_conf /etc/apache2/sites-enabled/000-default.conf
echo "Your custom apache config at $default_conf will be used."
else
echo "Cant find your custom 000-default.conf file $default_conf - be sure you have choosen the full path. Exiting now..."
exit 1
fi
fi
if [ "$default_ssl_conf" = "get_config" ]; then
if [ -f /etc/apache2/httpd.conf ]; then
cp /etc/apache2/sites-enabled/000-default-le-ssl.conf /share/000-default-le-ssl.conf
echo "You have requested a copy of the apache2 ssl config. You can now find it at /share/000-default-le-ssl.conf ."
fi
echo "Exiting now..."
exit 0
fi
if [ "$default_ssl_conf" != "default" ]; then
if [ -f $default_ssl_conf ]; then
if [ ! -d /etc/apache2/sites-enabled ]; then
mkdir /etc/apache2/sites-enabled
fi
if [ -f /etc/apache2/sites-enabled/000-default-le-ssl.conf ]; then
rm /etc/apache2/sites-enabled/000-default-le-ssl.conf
fi
cp -rf $default_ssl_conf /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "Your custom apache config at $default_ssl_conf will be used."
else
echo "Cant find your custom 000-default-le-ssl.conf file $default_ssl_conf - be sure you have choosen the full path. Exiting now..."
exit 1
fi
fi
echo "Here is your web file architecture."
ls -l $webrootdocker
echo "Starting Apache2..."
exec /usr/sbin/httpd -D FOREGROUND

84
apache2/CHANGELOG.md Normal file
View File

@@ -0,0 +1,84 @@
# Changelog
## 2.1.1
- bump hassio-addon-base to V10.0.1
## 2.1.0
- bump hassio-addon-base to V10.0.0
- fixed an issue in the php7-locales which resulted in an issue while installing the addon
## 2.0.4
- add php7-ctype support
## 2.0.3
- Enable Apache Foreground Logging
## 2.0.2
- ability to set a username and password to access the webfiles
## 2.0.1
- add php7-locales support
- add Mosquitto-PHP support
## 2.0.0
- add php7-xml support
- this addon is now available in three variants:
Minimal
Minimal with MariaDB
this "normal" version with common used PHP Modules
## 1.7.2
- fixed error: can't find custom config
## 1.7.1
- fixed error: can't find custom web root folder
## 1.7.0
- add php7-session php7-intl php7-soap php7-session php7-fileinfo support
## 1.6.0
- add php7-iconv and php7-dom support
## 1.5.1
- add option to recieve a apache2 config copy
- fix PHP7-PDO syntax error in Dockerfile
## 1.5.0
- add PHP7-PDO package
## 1.4.0
- allow the usage of custom apache2 config files
## 1.3.0
- allow the usage of a custom php.ini file
## 1.2.3
- add /media folder as a root folder option
## 1.2.2
- hotfix update for ssl path not working
## 1.2.1
- enabled use of .htaccess files
## 1.2.0
- new option document_root -> Allowing the user to decide the document root folder
- added default index.html if the user has no webfiles in the correct folder
## 1.1.2
- added php-mcrypt, php-zip
- Ingress is now supported
## 1.1.1
- added mariadb-client to docker image
## 1.1.0
- New Icon
- Prepared Ingress Support
## 1.0.1
- Fixed SSL
- Removed MariaDB Options
## 1.0.0
- Initial release

41
apache2/Dockerfile Normal file
View File

@@ -0,0 +1,41 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.1
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
ENV LANG C.UTF-8
# Create directory for apache2 to store PID file
RUN mkdir /run/apache2
RUN apk --no-cache add apache2 php7-apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl
RUN apk --no-cache add php7 php7-dev php7-fpm php7-mysqli php7-opcache php7-gd php7-zlib php7-curl php7-phar php7-json php7-mbstring php7-mcrypt php7-zip php7-pdo php7-pdo_mysql php7-iconv php7-dom php7-session php7-intl php7-soap php7-fileinfo php7-xml php7-ctype
RUN apk --no-cache add mosquitto mosquitto-dev
RUN apk --no-cache add mariadb-client
#musl-locales/php7-locales
RUN apk add --no-cache cmake make musl-dev gcc gettext-dev libintl
RUN wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
&& unzip musl-locales-master.zip \
&& cd musl-locales-master \
&& cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
&& cd .. && rm -r musl-locales-master
#Mosquitto-PHP
RUN wget https://github.com/mgdm/Mosquitto-PHP/archive/refs/heads/master.zip \
&& unzip master.zip \
&& cd Mosquitto-PHP-master \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& cd .. && rm -r Mosquitto-PHP-master
#Configure Logging
RUN sed -i -r 's@Errorlog .*@Errorlog /dev/stderr@i' /etc/apache2/httpd.conf
RUN echo "Transferlog /dev/stdout" >> /etc/apache2/httpd.conf
# Copy data for add-on
COPY run.sh /
COPY index.html /
RUN chmod a+x /run.sh
RUN chmod a+x /index.html
CMD [ "/run.sh" ]

175
apache2/README.md Normal file
View File

@@ -0,0 +1,175 @@
# Home Assistant Community Add-on: Apache2
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
![Project Maintenance][maintenance-shield]
Apache2 Webserver for Homeassistant OS
![Ingress Support](images/ingress.png)
## About
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.<br />
The Apache HTTP Server ("httpd") was launched in 1995 and it has been the most popular web server on the Internet since April 1996. It has celebrated its 25th birthday as a project in February 2020.<br />
The Apache HTTP Server is a project of The Apache Software Foundation.
## Different Versions
### Full Version
The [full Apache2 Version](https://github.com/FaserF/hassio-addons/tree/master/apache2) with MariaDB and common used PHP modules. <br />
This docker image comes with: apache2 php7-apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl mariadb-client<br />
The following php7 extensions will be installed: php7 php7-dev php7-fpm php7-mysqli php7-opcache php7-gd php7-zlib php7-curl php7-phar php7-json php7-mbstring php7-mcrypt php7-zip php7-pdo php7-pdo_mysql php7-iconv php7-dom php7-session php7-intl php7-soap php7-fileinfo php7-xml<br />
And it comes with php7 locales and [Mosquitto-PHP](https://github.com/mgdm/Mosquitto-PHP).
### Minimal Version
The [Minimal Version](https://github.com/FaserF/hassio-addons/tree/master/apache2-minimal) of the Apache2 Addon without MariaDB and with no PHP modules. <br />
This docker image comes with: apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl
### Minimal Version with MariaDB
The [Minimal Version with MariaDB and some PHP modules](https://github.com/FaserF/hassio-addons/tree/master/apache2-minimal-mariadb) of the Apache2 Addon. <br />
This docker image comes with: apache2 php7-apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl mariadb-client<br />
The following php7 extensions will be installed: php7 php7-mysqli php7-opcache php7-curl php7-json php7-mbstring php7-mcrypt php7-zip
## Installation
[![FaserF Homeassistant Addons](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2FFaserF%2Fhassio-addons)
<br />
The installation of this add-on is pretty straightforward and not different in comparison to installing any other custom Home Assistant add-on.<br />
Just click the link above or add my repo to the hassio addons repositorys: https://github.com/FaserF/hassio-addons
Put your website files to /share/htdocs<br />
Example File where your index.html should be: /share/htdocs/index.html <br />
If you want to integrate your website with a mariadb database. Please ensure that the MariaDB Addon is installed!
## Configuration
**Note**: _Remember to restart the add-on when the configuration is changed._
Example add-on configuration:
```yaml
document_root: /media/apache2
php_ini: /share/apache2/php.ini
default_conf: /share/apache2/000-default.conf
default_ssl_conf: get_file
website_name: itdoesntmatter_as_ssl_is_set_to_false
username: apache
password: mySecretPassword
ssl: false
certfile: itdoesntmatter_as_ssl_is_set_to_false
keyfile: itdoesntmatter_as_ssl_is_set_to_false
```
<br />
Recommended Example add-on configuration:
```yaml
document_root: /share/htdocs
php_ini: default
default_conf: default
default_ssl_conf: default
website_name: mywebsite.ddns.net
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
```
**Note**: _This is just an example, don't copy and paste it! Create your own!_
### Option: `document_root`
This option is needed. Change it depending where your root webfolder is on your homeassistant installation.
Note: it has to be somewhere in the /share or /media folder! Other folders are not visible to this addon.
### Option: `php_ini`
You can choose between the following options:
default -> the default php7 php.ini file will be used
get_file -> copies the default php7 php.ini file from the addon to /share/apache2addon_php.ini
path/to/your/new/php.ini -> Please change the location depending where your custom php.ini file is, f.e.: /share/apache2/php.ini
### Option: `default_conf` & `default_ssl_conf`
You can choose between the following options:
default -> the default apache2 addon file will be used
get_config -> Get a copy of the default apache2 addon config file to your /share folder.
path/to/your/new/apache2.conf -> Please change the location depending where your custom 000-default.conf / 000-default-le-ssl.conf file is, f.e.: /share/apache2/000-default.conf <br />
More Information: https://cwiki.apache.org/confluence/display/HTTPD/ExampleVhosts<br /> <br />
Please note, that I wont give any support if you are using custom apache2 config files and are recieving any apache2 errors!
### Option: `website_name`
This option is needed, if you enable ssl to true. If you are not using SSL put anything in here, as it doesnt matter.
### Option: `username`
This option is optional. Set a username to access the webfiles.
### Option: `password`
This option is optional. Set a password to access the webfiles.
### Option: `ssl`
Enables/Disables SSL (HTTPS) on the web interface. Set it `true` to enable it, `false` otherwise.
If you need a self-signed certificate, have a look at my openssl addon: https://github.com/FaserF/hassio-addons/tree/master/openssl
**Note**: _The files MUST be stored in `/ssl/`, which is the default_
## Ingress
This addon supports Homeassistant Ingress. Until now it seems only to work if you enable SSL!
And also I am sorry, but I cant support all your websites. Basic HTML Websites will work great with ingress, the more advanced the page is, the harder it is to support ingress.
## Support
Got questions or problems?
You can [open an issue here][issue] GitHub.
Please keep in mind, that this software is only tested on armv7 running on a Raspberry Pi 4.
## Authors & contributors
The original program is from the Apache Project. For more informatios please visit this page: https://httpd.apache.org/
The hassio addon is brought to you by [FaserF].
## License
MIT License
Copyright (c) 2019-2021 FaserF & The Apache Project
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.
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg
[FaserF]: https://github.com/FaserF/
[issue]: https://github.com/FaserF/hassio-addons/issues

9
apache2/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "ghcr.io/hassio-addons/base/aarch64:10.0.1",
"amd64": "ghcr.io/hassio-addons/base/amd64:10.0.1",
"armhf": "ghcr.io/hassio-addons/base/armhf:10.0.1",
"armv7": "ghcr.io/hassio-addons/base/armv7:10.0.1",
"i386": "ghcr.io/hassio-addons/base/i386:10.0.1"
}
}

44
apache2/config.json Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "Apache2",
"version": "2.1.1",
"slug": "apache2",
"description": "OpenSource Webserver",
"url": "https://github.com/FaserF/hassio-addons/tree/master/apache2",
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
"startup": "application",
"boot": "auto",
"webui": "[PROTO:ssl]://[HOST]:[PORT:80]",
"map": ["share:rw", "media:rw", "ssl"],
"ingress": true,
"panel_icon": "mdi:web-box",
"options": {
"document_root": "/share/htdocs",
"php_ini": "default",
"default_conf": "default",
"default_ssl_conf": "default",
"website_name":null,
"ssl": true,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
},
"schema": {
"document_root":"str",
"php_ini":"str",
"default_conf":"str",
"default_ssl_conf":"str",
"website_name":"str",
"username":"str?",
"password":"str?",
"ssl": "bool",
"certfile": "str",
"keyfile": "str"
},
"ports": {
"80/tcp": 80,
"443": 443
},
"ports_description": {
"80/tcp": "Web interface http",
"443/tcp": "SSL Web interface"
}
}

BIN
apache2/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
apache2/images/ingress.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

284
apache2/index.html Normal file
View File

@@ -0,0 +1,284 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Modified from the Debian original for Ubuntu
Last updated: 2014-03-19
See: https://launchpad.net/bugs/1288690
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache2 FaserF Homeassistant Addon Default Page: It works</title>
<style type="text/css" media="screen">
* {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
body, html {
padding: 3px 3px 3px 3px;
background-color: #D8DBE2;
font-family: Verdana, sans-serif;
font-size: 11pt;
text-align: center;
}
div.main_page {
position: relative;
display: table;
width: 800px;
margin-bottom: 3px;
margin-left: auto;
margin-right: auto;
padding: 0px 0px 0px 0px;
border-width: 2px;
border-color: #212738;
border-style: solid;
background-color: #FFFFFF;
text-align: center;
}
div.page_header {
height: 99px;
width: 100%;
background-color: #F5F6F7;
}
div.page_header span {
margin: 15px 0px 0px 50px;
font-size: 180%;
font-weight: bold;
}
div.page_header img {
margin: 3px 0px 0px 40px;
border: 0px 0px 0px;
}
div.table_of_contents {
clear: left;
min-width: 200px;
margin: 3px 3px 3px 3px;
background-color: #FFFFFF;
text-align: left;
}
div.table_of_contents_item {
clear: left;
width: 100%;
margin: 4px 0px 0px 0px;
background-color: #FFFFFF;
color: #000000;
text-align: left;
}
div.table_of_contents_item a {
margin: 6px 0px 0px 6px;
}
div.content_section {
margin: 3px 3px 3px 3px;
background-color: #FFFFFF;
text-align: left;
}
div.content_section_text {
padding: 4px 8px 4px 8px;
color: #000000;
font-size: 100%;
}
div.content_section_text pre {
margin: 8px 0px 8px 0px;
padding: 8px 8px 8px 8px;
border-width: 1px;
border-style: dotted;
border-color: #000000;
background-color: #F5F6F7;
font-style: italic;
}
div.content_section_text p {
margin-bottom: 6px;
}
div.content_section_text ul, div.content_section_text li {
padding: 4px 8px 4px 16px;
}
div.section_header {
padding: 3px 6px 3px 6px;
background-color: #8E9CB2;
color: #FFFFFF;
font-weight: bold;
font-size: 112%;
text-align: center;
}
div.section_header_red {
background-color: #CD214F;
}
div.section_header_grey {
background-color: #9F9386;
}
.floating_element {
position: relative;
float: left;
}
div.table_of_contents_item a,
div.content_section_text a {
text-decoration: none;
font-weight: bold;
}
div.table_of_contents_item a:link,
div.table_of_contents_item a:visited,
div.table_of_contents_item a:active {
color: #000000;
}
div.table_of_contents_item a:hover {
background-color: #000000;
color: #FFFFFF;
}
div.content_section_text a:link,
div.content_section_text a:visited,
div.content_section_text a:active {
background-color: #DCDFE6;
color: #000000;
}
div.content_section_text a:hover {
background-color: #000000;
color: #DCDFE6;
}
div.validator {
}
</style>
</head>
<body>
<div class="main_page">
<div class="page_header floating_element">
<span class="floating_element">
Apache2 FaserF Homeassistant Addon Default Page
</span>
</div>
<!-- <div class="table_of_contents floating_element">
<div class="section_header section_header_grey">
TABLE OF CONTENTS
</div>
<div class="table_of_contents_item floating_element">
<a href="#about">About</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#changes">Changes</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#scope">Scope</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#files">Config files</a>
</div>
</div>
-->
<div class="content_section floating_element">
<div class="section_header section_header_red">
<div id="about"></div>
It works!
</div>
<div class="content_section_text">
<p>
This is the default welcome page used to test the correct
operation of the Apache2 server after the installation of the Homeassistant Addon.
If you can read this page, it means that the Apache HTTP server installed at
this site is working properly. You should <b>replace this file</b> (located at
<tt>/share/htdocs/index.html</tt>) before continuing to operate your HTTP server.
</p>
<p>
If you are a normal user of this web site and don't know what this page is
about, this probably means that the site is currently unavailable due to
maintenance.
If the problem persists, please contact the site's administrator.
</p>
</div>
<div class="section_header">
<div id="changes"></div>
Configuration Overview
</div>
<div class="content_section_text">
<p>
The configuration system is <b>fully documented in
the github repository</b>. Refer to this for the full
documentation. Documentation can be
found by accessing the <a href="https://github.com/FaserF/hassio-addons/tree/master/apache2">manual</a>.
</p>
</div>
<div class="section_header">
<div id="bugs"></div>
Reporting Problems
</div>
<div class="content_section_text">
<p>
Please use the <tt>github issues tracker</tt> tool to report bugs in the
Apache2 Addon with Homeassistant. However, check <a
href="https://github.com/FaserF/hassio-addons/issues">existing
bug reports</a> before reporting a new bug.
</p>
<p>
Please report bugs specific to modules (such as PHP and others)
to respective packages, not to the web server itself.
</p>
</div>
</div>
</div>
<div class="validator">
<p>
<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</p>
</div>
</body>
</html>

168
apache2/run.sh Normal file
View File

@@ -0,0 +1,168 @@
#!/usr/bin/env bashio
ssl=$(bashio::config 'ssl')
website_name=$(bashio::config 'website_name')
certfile=$(bashio::config 'certfile')
keyfile=$(bashio::config 'keyfile')
DocumentRoot=$(bashio::config 'document_root')
phpini=$(bashio::config 'php_ini')
username=$(bashio::config 'username')
password=$(bashio::config 'password')
default_conf=$(bashio::config 'default_conf')
default_ssl_conf=$(bashio::config 'default_ssl_conf')
webrootdocker=/var/www/localhost/htdocs/
if [ $phpini = "get_file" ]; then
cp /etc/php7/php.ini /share/apache2addon_php.ini
echo "You have requestet a copy of the php.ini file. You will now find your copy at /share/apache2addon_php.ini"
echo "Addon will now be stopped. Please remove the config option and change it to the name of your new config file (for example /share/php.ini)"
exit 1
fi
rm -r $webrootdocker
if [ ! -d $DocumentRoot ]; then
echo "You haven't put your website to $DocumentRoot"
echo "A default website will now be used"
mkdir $webrootdocker
cp /index.html $webrootdocker
else
#Create Shortcut to shared html folder
ln -s $DocumentRoot /var/www/localhost/htdocs
fi
#Set rights to web folders and create user
find $DocumentRoot -type d -exec chmod 771 {} \;
if [ ! -z "$username" ] && [ ! -z "$password" ] && [ ! $username = "null" ] && [ ! $password = "null" ]; then
adduser -S $username -G www-data
echo "$username:$password" | chpasswd $username
find $webrootdocker -type d -exec chown $username:www-data -R {} \;
find $webrootdocker -type f -exec chown $username:www-data -R {} \;
else
echo "No username and/or password was provided. Skipping account set up."
fi
if [ $phpini != "default" ]; then
if [ -f $phpini ]; then
echo "Your custom php.ini at $phpini will be used."
rm /etc/php7/php.ini
cp $phpini /etc/php7/php.ini
else
echo "You have changed the php_ini variable, but the new file could not be found! Default php.ini file will be used instead."
fi
else
echo "extension=mosquitto.so" >> /etc/php7/php.ini
fi
if [ $ssl = "true" ] && [ $default_conf = "default" ]; then
echo "You have activated SSL. SSL Settings will be applied"
if [ ! -f /ssl/$certfile ]; then
echo "Cannot find certificate file $certfile"
exit 1
fi
if [ ! -f /ssl/$keyfile ]; then
echo "Cannot find certificate key file $keyfile"
exit 1
fi
mkdir /etc/apache2/sites-enabled
sed -i '/LoadModule rewrite_module/s/^#//g' /etc/apache2/httpd.conf
echo "Listen 8099" >> /etc/apache2/httpd.conf
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/000-default.conf
echo "ServerName $website_name" >> /etc/apache2/sites-enabled/000-default.conf
echo "ServerAdmin webmaster@localhost" >> /etc/apache2/sites-enabled/000-default.conf
echo "DocumentRoot $webrootdocker" >> /etc/apache2/sites-enabled/000-default.conf
echo "#Redirect http to https" >> /etc/apache2/sites-enabled/000-default.conf
echo " RewriteEngine On" >> /etc/apache2/sites-enabled/000-default.conf
echo " RewriteCond %{HTTPS} off" >> /etc/apache2/sites-enabled/000-default.conf
echo " RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}" >> /etc/apache2/sites-enabled/000-default.conf
echo "#End Redirect http to https" >> /etc/apache2/sites-enabled/000-default.conf
echo " ErrorLog /var/log/error.log" >> /etc/apache2/sites-enabled/000-default.conf
echo " #CustomLog /var/log/access.log combined" >> /etc/apache2/sites-enabled/000-default.conf
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default.conf
echo "<IfModule mod_ssl.c>" > /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "<VirtualHost *:443>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "ServerName $website_name" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "ServerAdmin webmaster@localhost" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "DocumentRoot $webrootdocker" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo " ErrorLog /var/log/error.log" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo " #CustomLog /var/log/access.log combined" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "SSLCertificateFile /ssl/$certfile" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "SSLCertificateKeyFile /ssl/$keyfile" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "</IfModule>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
else
echo "SSL is deactivated and/or you are using a custom config."
fi
if [ "$ssl" = "true" ] || [ "$default_conf" != "default" ]; then
echo "Include /etc/apache2/sites-enabled/*.conf" >> /etc/apache2/httpd.conf
fi
sed -i -e '/AllowOverride/s/None/All/' /etc/apache2/httpd.conf
if [ "$default_conf" = "get_config" ]; then
if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
if [ ! -d /etc/apache2/sites-enabled ]; then
mkdir /etc/apache2/sites-enabled
fi
cp /etc/apache2/sites-enabled/000-default.conf /share/000-default.conf
echo "You have requested a copy of the apache2 config. You can now find it at /share/000-default.conf ."
fi
if [ -f /etc/apache2/httpd.conf ]; then
cp /etc/apache2/httpd.conf /share/httpd.conf
echo "You have requested a copy of the apache2 config. You can now find it at /share/httpd.conf ."
fi
if [ "$default_ssl_conf" != "get_config" ]; then
echo "Exiting now..."
exit 0
fi
fi
if [[ ! $default_conf =~ ^(default|get_config)$ ]]; then
if [ -f $default_conf ]; then
if [ ! -d /etc/apache2/sites-enabled ]; then
mkdir /etc/apache2/sites-enabled
fi
if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
rm /etc/apache2/sites-enabled/000-default.conf
fi
cp -rf $default_conf /etc/apache2/sites-enabled/000-default.conf
echo "Your custom apache config at $default_conf will be used."
else
echo "Cant find your custom 000-default.conf file $default_conf - be sure you have choosen the full path. Exiting now..."
exit 1
fi
fi
if [ "$default_ssl_conf" = "get_config" ]; then
if [ -f /etc/apache2/httpd.conf ]; then
cp /etc/apache2/sites-enabled/000-default-le-ssl.conf /share/000-default-le-ssl.conf
echo "You have requested a copy of the apache2 ssl config. You can now find it at /share/000-default-le-ssl.conf ."
fi
echo "Exiting now..."
exit 0
fi
if [ "$default_ssl_conf" != "default" ]; then
if [ -f $default_ssl_conf ]; then
if [ ! -d /etc/apache2/sites-enabled ]; then
mkdir /etc/apache2/sites-enabled
fi
if [ -f /etc/apache2/sites-enabled/000-default-le-ssl.conf ]; then
rm /etc/apache2/sites-enabled/000-default-le-ssl.conf
fi
cp -rf $default_ssl_conf /etc/apache2/sites-enabled/000-default-le-ssl.conf
echo "Your custom apache config at $default_ssl_conf will be used."
else
echo "Cant find your custom 000-default-le-ssl.conf file $default_ssl_conf - be sure you have choosen the full path. Exiting now..."
exit 1
fi
fi
echo "Here is your web file architecture."
ls -l $webrootdocker
echo "Starting Apache2..."
exec /usr/sbin/httpd -D FOREGROUND

View File

@@ -0,0 +1,16 @@
# Changelog
## 1.2.1
- bump hassio-addon-base to V10.0.1
## 1.2.0
- bump hassio-addon-base to V10.0.0
## 1.1.1
- Added the option to submit up to three arguments to the scripts
## 1.1.0
- Added the option to submit up to two arguments to the scripts
## 1.0.0
- Initial release

View File

@@ -0,0 +1,14 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.1
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
ENV LANG C.UTF-8
# Create directory for apache2 to store PID file
RUN mkdir /run/apache2
RUN apk --no-cache add busybox-extras curl grep coreutils sed xmlstarlet bash
# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

View File

@@ -0,0 +1,126 @@
# Home Assistant Community Add-on: Bash Script Executer
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
![Project Maintenance][maintenance-shield]
Bash Script Executer for Homeassistant OS
## About
This is a simple Docker Image to execute personal scripts. The reason I am needing this, is that the HA OS has limited features installed (for example no curl, sed etc) and this Addon fixes that issue.<br />
You can run up to three different scripts with this addon.<br />
This docker image comes with: busybox-extras curl grep coreutils sed xmlstarlet
## Installation
[![FaserF Homeassistant Addons](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2FFaserF%2Fhassio-addons)
<br />
The installation of this add-on is pretty straightforward and not different in comparison to installing any other custom Home Assistant add-on.<br />
Just click the link above or add my repo to the hassio addons repositorys: https://github.com/FaserF/hassio-addons
Put your scripts somewhere in the /share/ folder. Other folders are not visible to this addon.<br />
Example File where your script could be: /share/scripts/script.sh
## Configuration
**I am recommending to disable "Start on boot" and the Watchdog option from HA for this addon!**<br />
**Note**: _Remember to restart the add-on when the configuration is changed._
Example add-on configuration:
```yaml
script_path: /share/scripts/script.sh
script_argument1: myFirstArgument
script_argument2: AnotherVariable
script_argument3: AnotherVariable
script_path2: false
script2_argument1:
script2_argument2:
script2_argument3:
script_path3: false
script3_argument2:
script3_argument2:
script3_argument3:
```
**Note**: _This is just an example, don't copy and paste it! Create your own!_
### Option: `script_path`
This option is needed. Change it depending where your script is or change it to "false" to leave it empty.
### Option: `scriptX_argumentX`
This option is optional. You can submit up to three arguments to your script with this option.
### Option: `script_path2`
This option is needed. Change it depending where your script is or change it to "false" to leave it empty.
### Option: `script_path3`
This option is needed. Change it depending where your script is or change it to "false" to leave it empty.
## Cron Support - running scripts by time
I havent implemented Cron in this addon, as you can run your scripts periodically by an Homeassistant automation.
Example Automation: <br />
```yaml
- alias: "Run Bash Script with Addon Bash Script Executer"
trigger:
- platform: time
at: '00:02:00'
- platform: time_pattern
minutes: '/90'
seconds: 0
action:
- service: hassio.addon_start
data:
addon: 605cee21_bashscriptexecuter
```
## Support
Got questions or problems?
You can [open an issue here][issue] GitHub.
Please keep in mind, that this software is only tested on armv7 running on a Raspberry Pi 4. And that I have made this addon for my personal scripts.
## Authors & contributors
The hassio addon is brought to you by [FaserF].
## License
MIT License
Copyright (c) 2021 FaserF
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.
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg
[FaserF]: https://github.com/FaserF/
[issue]: https://github.com/FaserF/hassio-addons/issues
[repository]: https://github.com/FaserF/hassio-addons/bash_script_executer

View File

@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "ghcr.io/hassio-addons/base/aarch64:10.0.1",
"amd64": "ghcr.io/hassio-addons/base/amd64:10.0.1",
"armhf": "ghcr.io/hassio-addons/base/armhf:10.0.1",
"armv7": "ghcr.io/hassio-addons/base/armv7:10.0.1",
"i386": "ghcr.io/hassio-addons/base/i386:10.0.1"
}
}

View File

@@ -0,0 +1,31 @@
{
"name": "Bash Script Executer",
"version": "1.2.1",
"slug": "bashscriptexecuter",
"description": "Execute your own bash scripts via Docker Container",
"url": "https://github.com/FaserF/hassio-addons/tree/master/bash_script_executer",
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
"startup": "application",
"boot": "auto",
"map": ["share:rw"],
"panel_icon": "mdi:web-box",
"options": {
"script_path": "/share/scripts/mycoolscript.sh",
"script_path2": "false",
"script_path3": "false"
},
"schema": {
"script_path":"str",
"script_argument1":"str?",
"script_argument2":"str?",
"script_argument3":"str?",
"script_path2":"str",
"script2_argument1":"str?",
"script2_argument2":"str?",
"script2_argument3":"str?",
"script_path3":"str",
"script3_argument1":"str?",
"script3_argument2":"str?",
"script3_argument3":"str?"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env bashio
script_path=$(bashio::config 'script_path')
script_argument1=$(bashio::config 'script_argument1')
script_argument2=$(bashio::config 'script_argument2')
script_argument3=$(bashio::config 'script_argument3')
script_path2=$(bashio::config 'script_path2')
script2_argument1=$(bashio::config 'script2_argument1')
script2_argument2=$(bashio::config 'script2_argument2')
script2_argument3=$(bashio::config 'script2_argument3')
script_path3=$(bashio::config 'script_path3')
script3_argument1=$(bashio::config 'script3_argument1')
script3_argument2=$(bashio::config 'script3_argument2')
script3_argument3=$(bashio::config 'script3_argument3')
if [ $script_path != "false" ]; then
if [ ! -f $script_path ]; then
echo "Cant find your first script at $script_path"
echo "Exiting now..."
exit 1
fi
fi
if [ $script_path2 != "false" ]; then
if [ ! -f $script_path2 ]; then
echo "Cant find your second script at $script_path2"
echo "Exiting now..."
exit 1
fi
fi
if [ $script_path3 != "false" ]; then
if [ ! -f $script_path3 ]; then
echo "Cant find your third script at $script_path3"
echo "Exiting now..."
exit 1
fi
fi
#Set 711 rights to script
echo "Fixing permissions."
if [ $script_path != "false" ]; then
find $script_path -type d -exec chmod 711 {} \;
fi
if [ $script_path2 != "false" ]; then
find $script_path2 -type d -exec chmod 711 {} \;
fi
if [ $script_path3 != "false" ]; then
find $script_path3 -type d -exec chmod 711 {} \;
fi
if [ $script_path != "false" ]; then
echo "Executing the first script $script_path with the argument $script_argument1 and the second argument $script_argument2 and the third argument $script_argument3 now..."
echo "-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
bash $script_path $script_argument1 $script_argument2 $script_argument3
fi
if [ $script_path2 != "false" ]; then
echo "Executing the second script $script_path2 with the argument $script2_argument1 and the second argument $script2_argument2 and the third argument $script2_argument3 now..."
echo "-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
bash $script_path2 $script2_argument2 $script2_argument3
fi
if [ $script_path3 != "false" ]; then
echo "Executing the third script $script_path3 with the argument $script3_argument1 and the second argument $script3_argument2 and the third argument $script3_argument3 now..."
echo "-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
bash $script_path3 $script3_argument1 $script3_argument2 $script3_argument3
fi
echo "-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
echo "All Scripts were executed. Stopping container..."

View File

@@ -0,0 +1,47 @@
## 1.4.0 - 2021-04-02
* 🔨 Use ghcr.io/home-assistant for base images
* 🔼 Update docker to `12.20.1-r1`
## 1.3.1 - 2021-03-17
* 🐛 Specifiy own S6 entrypoint, don't rely on the base image.
* 🔼 Update git to `2.30.2-r0`
## 1.3.0 - 2021-02-27
* 🔼 Update alpine to `3.13`
* 🔼 Update git to `2.30.1-r0`
* 🔼 Update npm/nodejs to `14.16.0-r0`
* 🔼 Update python2 to `2.7.18-r1`
* 🔼 Update g++ to `20.10.3-r0`
* 🔼 Update docker to `12.20.1-r0`
* 🔼 Update sqlite to `3.34.1-r0`
## 1.2.0 - 2021-01-15
* 🧪 Mark addon as experimental. It fills up all the available memory when running, see [Readme](https://github.com/Poeschl/Hassio-Addons/blob/master/container-stats/README.md).
* 🔼 Update npm to `12.20.1-r0`
## 1.1.1 - 2020-12-16
* 🐛 Fix database location
* 🔨 Create a persistence setting
## 1.1.0 - 2020-12-16
* 🔨 Make statistics persistent
## 1.0.1 - 2020-12-03
* 🔨 Fixed link to Github
## 1.0.0 - 2019-11-27
* Introduced container-stats addon

21
container-stats/DOCS.md Normal file
View File

@@ -0,0 +1,21 @@
## Precondition
Unfortunately there is now way to access the docker api without disabling the *Protection Mode* of the addon.
Technically with disabling it, the addon can access and control other addons and the core on a HA supervised system.
But without it we can not retrieve the statistics of the running container and this addon don't work at all.
To make the addon work you have to disable the *Protection Mode* on the addon details page.
**Only do this if you know what this means to your system**
If you want to review the source of the contained application [here is your link](https://github.com/virtualzone/docker-container-stats).
At the time of writing all docker related code is in `stats.js`.
## Config
### `persistent`
Enable persistence of the collected data. If disabled the data vanish on addon stop.
### `update_interval` (Optional)
Set a custom update interval for the data in seconds. Defaults to `60` seconds.

View File

@@ -0,0 +1,45 @@
ARG BUILD_FROM
FROM $BUILD_FROM AS REPOSITORY
RUN apk --update add --no-cache \
git=2.30.2-r0
ENV COMMIT_SHA '586ebebf16195bfab7ffd2b3dbc4344077e72a05'
# hadolint ignore=DL3003
RUN git clone https://github.com/virtualzone/docker-container-stats.git -b master /container-stats && \
cd /container-stats && git checkout $COMMIT_SHA
FROM $BUILD_FROM AS BUILD
RUN apk --update add --no-cache \
npm=14.16.0-r0 \
python2=2.7.18-r1 \
make=4.3-r0 \
g++=10.2.1_pre1-r3
WORKDIR /container-stats
RUN npm update && \
npm install \
express@4.17.1 \
sqlite3@5.0.0 \
body-parser@1.19.0 \
moment@2.29.1
FROM $BUILD_FROM AS RUNNING
RUN apk --update add --no-cache \
nodejs=14.16.0-r0 \
docker=20.10.3-r1 \
sqlite=3.34.1-r0
COPY --from=BUILD /container-stats /container-stats
COPY --from=REPOSITORY /container-stats/stats.js /container-stats
COPY --from=REPOSITORY /container-stats/httpd.js /container-stats
COPY --from=REPOSITORY /container-stats/html /container-stats/html
ENTRYPOINT [ "/init" ]
CMD []
COPY root /

39
container-stats/README.md Normal file
View File

@@ -0,0 +1,39 @@
# Docker Container Stats (Home Assistant Addon)
It contains [Docker Container Stats](https://github.com/virtualzone/docker-container-stats) to monitor all running containers / addons.
![Addon Stage][stage-badge]
![Supports aarch64 Architecture][aarch64-badge]
![Supports amd64 Architecture][amd64-badge]
![Supports armhf Architecture][armhf-badge]
![Supports armv7 Architecture][armv7-badge]
![Supports i386 Architecture][i386-badge]
[![Install on my Home Assistant][install-badge]][install-url]
[![Donate][donation-badge]][donation-url]
## 🧪 Experimental Addon
During long-term usage I noticed that the addon fills up all available memory when getting the data for a week.
Especially on a Raspberry Pi with Home Assistant this means death in a few minutes.
__Use this addon on your own risk!__
## Security
Since the addon accesses the docker api, the security rating is this low.
Unfortunately there is now way to access the docker api without disabling the *Protection Mode* of the addon.
Technically with disabling it, the addon can access and control other addons and the core on a HA supervised system.
But without it we can not retrieve the statistics of the running container and this addon don't work at all.
[aarch64-badge]: https://img.shields.io/badge/aarch64-yes-green.svg?style=for-the-badge
[amd64-badge]: https://img.shields.io/badge/amd64-yes-green.svg?style=for-the-badge
[armhf-badge]: https://img.shields.io/badge/armhf-yes-green.svg?style=for-the-badge
[armv7-badge]: https://img.shields.io/badge/armv7-yes-green.svg?style=for-the-badge
[i386-badge]: https://img.shields.io/badge/i386-yes-green.svg?style=for-the-badge
[install-url]: https://my.home-assistant.io/redirect/supervisor_addon?addon=243ffc37_container-stats
[stage-badge]: https://img.shields.io/badge/Addon%20stage-experimental%20🧪-yellow.svg?style=for-the-badge
[install-badge]: https://img.shields.io/badge/Install%20on%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=for-the-badge&logoColor=white
[donation-url]: https://www.buymeacoffee.com/Poeschl

View File

@@ -0,0 +1,9 @@
{
"build_from": {
"armhf": "ghcr.io/home-assistant/armhf-base:3.13",
"armv7": "ghcr.io/home-assistant/armv7-base:3.13",
"aarch64": "ghcr.io/home-assistant/aarch64-base:3.13",
"amd64": "ghcr.io/home-assistant/amd64-base:3.13",
"i386": "ghcr.io/home-assistant/i386-base:3.13"
}
}

View File

@@ -0,0 +1,38 @@
{
"name": "Docker Container Stats",
"version": "1.4.0",
"slug": "container-stats",
"description": "🧪 experimental | A web interface for viewing historical and current statistics per docker container",
"url": "https://github.com/Poeschl/Hassio-Addons/tree/master/container-stats",
"arch": [
"armhf",
"armv7",
"aarch64",
"amd64",
"i386"
],
"ingress": true,
"ingress_port": 8080,
"panel_title": "Docker Container Stats",
"panel_icon": "mdi:chart-line",
"startup": "application",
"stage": "experimental",
"boot": "auto",
"docker_api": true,
"image": "ghcr.io/poeschl/ha-container-stats-{arch}",
"ports": {
"8080/tcp": null
},
"ports_description": {
"8080/tcp": "Web Interface (Not required for Supervisor Ingress)"
},
"map": [],
"schema": {
"update_interval": "int?",
"persistent": "bool"
},
"options": {
"persistent": "true"
}
}

BIN
container-stats/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
container-stats/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,18 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::log.info 'Start docker statistics'
if bashio::config.has_value 'update_interval'; then
export STATS_UPDATE_INTERVAL=$(bashio::config 'update_interval')
fi
if [ ! -d /container-stats/db ] && bashio::config 'persistent'; then
[ ! -d /data/db ] && mkdir -p /data/db
ln -s /data/db/ /container-stats/db
else
mkdir -p /container-stats/db
fi
cd /container-stats
node stats.js

View File

@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
set -e
if [ ! -d /container-stats/db ]; then
bashio::log.debug 'Wait for database'
sleep 2s
fi
bashio::log.info 'Start webserver'
cd /container-stats
node httpd.js

View File

@@ -0,0 +1,23 @@
FROM python:3.8-slim
RUN set -x \
# Install required system packages
&& apt-get update && apt-get install -y --no-install-recommends \
jq \
tzdata \
portaudio19-dev \
libffi-dev \
libssl-dev
# install python packages
COPY requirements.txt .
RUN pip install --upgrade -r requirements.txt
EXPOSE 5000/tcp
VOLUME [ "/data" ]
WORKDIR /usr/src/app
COPY /app /usr/src/app/
CMD [ "python", "/usr/src/app/main.py" ]

View File

@@ -0,0 +1,57 @@
# Marcelveldt's Hassio Add-ons: Google Assistant Webserver
## About
Webservice for the Google Assistant SDK
Allow you to send (broadcast) commands to Google Assistant
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Install the "Google Assistant Webserver" add-on.
1. Start the "Google Assistant Webserver" add-on.
1. Check the logs of the add-on to see if everything went well.
1. At the first start, you will need to authenticate with Google, use the "Open Web UI" button for that.
1. Ready to go!
## Usage in HomeAssistant
Once you've set-up the webserver, you can add the component to HomeAssistant as notify component (for the broadcasts) and as script for the custom actions.
### Broadcast component
```yaml
notify:
- name: Google Assistant
platform: rest
resource: http://YOUR_HASS_IP_HERE:5000/broadcast
```
### Script component
```yaml
# define as rest_command in configuration
rest_command:
- google_assistant_command:
url: 'http://YOUR_HASS_IP_HERE:5000/command?message={{ command }}'
# example usage in script
script:
- google_cmd_test:
service: rest_command.google_assistant_command
data:
command: "some command you want to throw at the assistant"
```
[repository]: https://github.com/marcelveldt/hassio-addons-repo

View File

@@ -0,0 +1,108 @@
"""Google Assistant Text Assistant."""
import json
import logging
import os
import sys
from pathlib import Path
import google.auth.transport.grpc
import google.auth.transport.requests
import google.oauth2.credentials
from aiohttp import web
from google.assistant.embedded.v1alpha2 import (embedded_assistant_pb2,
embedded_assistant_pb2_grpc)
import assistant_helpers
ASSISTANT_API_ENDPOINT = 'embeddedassistant.googleapis.com'
DEFAULT_GRPC_DEADLINE = 60 * 3 + 5
PLAYING = embedded_assistant_pb2.ScreenOutConfig.PLAYING
class GoogleTextAssistant(object):
"""Sample Assistant that supports text based conversations.
Args:
language_code: language for the conversation.
device_model_id: identifier of the device model.
device_id: identifier of the registered device instance.
display: enable visual display of assistant response.
cred_json: Filename of jsonfile containing credentials.
deadline_sec: gRPC deadline in seconds for Google Assistant API call.
"""
def __init__(self, language_code, device_model_id, device_id,
cred_json:Path, display = True, deadline_sec = DEFAULT_GRPC_DEADLINE):
self.language_code = language_code
self.device_model_id = device_model_id
self.device_id = device_id
self.conversation_state = None
# Force reset of first conversation.
self.is_new_conversation = True
self.display = display
# open credentials
with open(cred_json, 'r') as _file:
credentials = google.oauth2.credentials.Credentials(token=None, **json.load(_file))
http_request = google.auth.transport.requests.Request()
credentials.refresh(http_request)
# Create an authorized gRPC channel.
grpc_channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, http_request, ASSISTANT_API_ENDPOINT)
self.assistant = embedded_assistant_pb2_grpc.EmbeddedAssistantStub(
grpc_channel
)
self.deadline = deadline_sec
def __enter__(self):
return self
def __exit__(self, etype, e, traceback):
if e:
return False
def assist(self, text_query):
"""Send a text request to the Assistant and playback the response.
"""
def iter_assist_requests():
config = embedded_assistant_pb2.AssistConfig(
audio_out_config=embedded_assistant_pb2.AudioOutConfig(
encoding='LINEAR16',
sample_rate_hertz=16000,
volume_percentage=0,
),
dialog_state_in=embedded_assistant_pb2.DialogStateIn(
language_code=self.language_code,
conversation_state=self.conversation_state,
is_new_conversation=self.is_new_conversation,
),
device_config=embedded_assistant_pb2.DeviceConfig(
device_id=self.device_id,
device_model_id=self.device_model_id,
),
text_query=text_query,
)
# Continue current conversation with later requests.
self.is_new_conversation = False
if self.display:
config.screen_out_config.screen_mode = PLAYING
req = embedded_assistant_pb2.AssistRequest(config=config)
# This can be used to output the assistant request
# assistant_helpers.log_assist_request_without_audio(req)
yield req
text_response = None
html_response = None
for resp in self.assistant.Assist(iter_assist_requests(),
self.deadline):
# This can be used to output the assistant response
# assistant_helpers.log_assist_response_without_audio(resp)
if resp.screen_out.data:
html_response = resp.screen_out.data
if resp.dialog_state_out.conversation_state:
conversation_state = resp.dialog_state_out.conversation_state
self.conversation_state = conversation_state
if resp.dialog_state_out.supplemental_display_text:
text_response = resp.dialog_state_out.supplemental_display_text()
return text_response, html_response

View File

@@ -0,0 +1,54 @@
# Copyright (C) 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Helper functions for the Google Assistant API."""
import logging
from google.assistant.embedded.v1alpha2 import embedded_assistant_pb2
def log_assist_request_without_audio(assist_request):
"""Log AssistRequest fields without audio data."""
if logging.getLogger().isEnabledFor(logging.DEBUG):
resp_copy = embedded_assistant_pb2.AssistRequest()
resp_copy.CopyFrom(assist_request)
if len(resp_copy.audio_in) > 0:
size = len(resp_copy.audio_in)
resp_copy.ClearField('audio_in')
logging.debug('AssistRequest: audio_in (%d bytes)',
size)
return
logging.debug('AssistRequest: %s', resp_copy)
def log_assist_response_without_audio(assist_response):
"""Log AssistResponse fields without audio data."""
if logging.getLogger().isEnabledFor(logging.DEBUG):
resp_copy = embedded_assistant_pb2.AssistResponse()
resp_copy.CopyFrom(assist_response)
has_audio_data = (resp_copy.HasField('audio_out') and
len(resp_copy.audio_out.audio_data) > 0)
if has_audio_data:
size = len(resp_copy.audio_out.audio_data)
resp_copy.audio_out.ClearField('audio_data')
if resp_copy.audio_out.ListFields():
logging.debug('AssistResponse: %s audio_data (%d bytes)',
resp_copy,
size)
else:
logging.debug('AssistResponse: audio_data (%d bytes)',
size)
return
logging.debug('AssistResponse: %s', resp_copy)

View File

@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
<div id="app">
<v-app>
<v-main>
<v-container fluid fill-height>
<v-layout align-center justify-center>
<v-flex sm8>
<v-card class="elevation-12">
<v-toolbar dark color="black">
<v-toolbar-title>Authenticate Google Assistant Webserver</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<h2>Step 1</h2>
<span>In order to use the Google Assistant webserver, you need to authenticate your Google account (once).</span>
<span>Please click the button below to start the authentication process.</span>
<span>Once you received the authentication token, come back to this page to submit it.</span>
<br /><br />
<v-btn @click="this.window.open('[[AUTH_URL]]', '_blank');" class="mr-4">Authenticate</v-btn>
<br /><br />
<h2>Step 2</h2>
<span>Once you received the token, paste it below and click submit.</span>
<v-form ref="form" v-model="valid" method="post">
<v-text-field
v-model="token"
prepend-icon="mdi-lock"
name="token"
label="Token"
type="text"
required
:rules="[v => !!v || 'Token is required']"
></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-alert type="success" v-if="success"
>Authentication finished. You can now issue commands to Google Assistant.
</v-alert>
<v-btn type="submit" v-else :disabled="!valid" color="success" @click="submit"
class="mr-4">Submit</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-main>
</v-app>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: () => ({
token: '',
valid: true,
success: false
}),
methods: {
submit () {
const formData = new FormData()
formData.append('token', this.token)
axios.post(window.location + 'token', formData)
.then(function (response) {
this.success = true
}.bind(this))
.catch(function (error) {
console.log('error', error)
});
}
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,61 @@
"""Handler for authentication."""
import json
import sys
from pathlib import Path
from aiohttp import web
from google.oauth2.credentials import Credentials
from requests_oauthlib import OAuth2Session
class AuthHandler:
"""Some logic to handle granting access to Google."""
def __init__(self, user_data:dict, cred_file:Path):
"""Initialize."""
self.cred_file = cred_file
self.user_data = user_data
self.oauth2 = OAuth2Session(
self.user_data["client_id"],
redirect_uri="urn:ietf:wg:oauth:2.0:oob",
scope="https://www.googleapis.com/auth/assistant-sdk-prototype",
)
self.auth_url, _ = self.oauth2.authorization_url(
self.user_data["auth_uri"], access_type="offline", prompt="consent"
)
async def token(self, request):
"""Read access token and process it."""
form = await request.post()
token = form["token"]
self.oauth2.fetch_token(
self.user_data["token_uri"], client_secret=self.user_data["client_secret"], code=token
)
# create credentials
credentials = Credentials(
self.oauth2.token["access_token"],
refresh_token=self.oauth2.token.get("refresh_token"),
token_uri=self.user_data["token_uri"],
client_id=self.user_data["client_id"],
client_secret=self.user_data["client_secret"],
scopes=self.oauth2.scope,
)
# write credentials json file
with self.cred_file.open("w") as json_file:
json_file.write(
json.dumps(
{
"refresh_token": credentials.refresh_token,
"token_uri": credentials.token_uri,
"client_id": credentials.client_id,
"client_secret": credentials.client_secret,
"scopes": [credentials.scopes],
}
)
)
return web.Response(text="Authentication successfull")

View File

@@ -0,0 +1 @@
{"installed":{"client_id":"848329555010-ue91trunkjk1dk48s6dov8csgthqnu54.apps.googleusercontent.com","project_id":"hass-assistant-229621","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"HHrDEJXTLgKfdUai-i7Icsws","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}

View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
<div id="app">
<v-app>
<v-main>
<v-container fluid fill-height>
<v-layout align-center justify-center>
<v-flex sm8>
<v-card class="elevation-12">
<v-toolbar dark color="black">
<v-toolbar-title>Google Assistant Webserver</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<h2>Broadcast</h2>
<v-text-field
v-model="broadcast"
label="Broadcast message"
type="text"
></v-text-field>
<v-btn @click="submitBroadcast()" class="mr-4">Send broadcast</v-btn>
<br />
<br />
<h2>Send command</h2>
<v-text-field
v-model="command"
label="Command to send to Google Assistant (e.g. turn off the lights)"
type="text"
></v-text-field>
<v-btn @click="submitCommand()" class="mr-4">Send command</v-btn>
<v-card-actions>
<v-spacer></v-spacer>
<a @click="openAuth()">Authenticate</a>
</v-card-actions>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-main>
</v-app>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: () => ({
broadcast: '',
command: ''
}),
methods: {
async submitBroadcast () {
const res = await axios.get(window.location + 'broadcast', { params: { message: this.broadcast } })
alert('Message submitted ' + res.data)
},
async submitCommand () {
const res = await axios.get(window.location + 'command', { params: { message: this.command } })
alert('Message submitted ' + res.data)
},
openAuth () {
window.open(window.location + 'auth')
}
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,67 @@
"""Main entrypoint: webserver handling commands to google assistant."""
import json
import logging
import os
from pathlib import Path
from aiohttp import web
from assistant import GoogleTextAssistant
from auth import AuthHandler
LOGGER = logging.getLogger()
CLIENT_JSON = Path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "client_secrets.json"))
CRED_JSON = Path("/data/cred.json")
if not os.path.isdir("/data"):
CRED_JSON = Path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "cred.json"))
routes = web.RouteTableDef()
@routes.get("/broadcast")
async def broadcast_message(request):
message = request.query.get("message", default="This is a test!")
text_query = "broadcast " + message
with GoogleTextAssistant("en-US", "HA_GA", "HA_GA_TEXT_SERVER", CRED_JSON) as assistant:
response_text, response_html = assistant.assist(text_query=text_query)
return web.Response(text=response_text)
@routes.get("/command")
async def command(request):
message = request.query.get("message", default="This is a test!")
with GoogleTextAssistant("en-US", "HA_GA", "HA_GA_TEXT_SERVER", CRED_JSON) as assistant:
response_text, response_html = assistant.assist(text_query=message)
return web.Response(text=response_text)
@routes.get("/")
async def index(request):
"""Landingpage."""
if not CRED_JSON.exists():
raise web.HTTPFound("/auth")
html_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "index.html")
return web.FileResponse(html_file)
@routes.get("/auth")
async def auth(request):
"""Authenticate with google."""
html_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "auth.html")
with open(html_file) as _file:
html = _file.read()
html = html.replace("[[AUTH_URL]]", request.app["auth"].auth_url)
return web.Response(text=html, content_type="text/html")
app = web.Application()
app.add_routes(routes)
with CLIENT_JSON.open("r") as data:
user_data = json.load(data)["installed"]
auth = AuthHandler(user_data, CRED_JSON)
app.router.add_post("/token", auth.token)
app["auth"] = auth
web.run_app(app, port=5000)

View File

@@ -0,0 +1,20 @@
{
"name": "Google Assistant Webserver",
"version": "0.0.10",
"description": "Webservice for the Google Assistant SDK - Allow you to send (broadcast) commands to Google Assistant",
"slug": "google_assistant_webserver",
"startup": "application",
"boot": "auto",
"arch": ["armhf", "amd64", "aarch64"],
"devices": ["/dev/snd:/dev/snd:rwm"],
"ports": {
"5000/tcp": 5000
},
"ingress": true,
"ingress_port": 5000,
"webui": "http://[HOST]:[PORT:5000]",
"options": {
},
"schema": {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -0,0 +1,4 @@
aiohttp[speedups]
google-assistant-sdk[samples]
google-auth-oauthlib[tool]
uvloop

49
hello_flask/Dockerfile Executable file
View File

@@ -0,0 +1,49 @@
ARG BUILD_FROM=hassioaddons/base-python:5.2.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Copy Python requirements file
COPY requirements.txt /tmp/
COPY app.py /
# Setup base
ARG BUILD_ARCH=amd64
RUN \
apk add --no-cache --virtual .build-dependencies \
g++=9.2.0-r4 \
gcc=9.2.0-r4 \
make=4.2.1-r2 \
\
&& apk add --no-cache \
nginx-mod-http-lua=1.16.1-r6 \
lua-resty-http=0.15-r0 \
nginx=1.16.1-r6 \
cython=0.29.14-r0 \
\
&& pip3 install \
--no-cache-dir \
--prefer-binary \
--find-links "https://wheels.hass.io/alpine-3.11/${BUILD_ARCH}/" \
-r /tmp/requirements.txt \
\
&& find /usr/local \
\( -type d -a -name test -o -name tests -o -name '__pycache__' \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
\
&& apk del --purge .build-dependencies \
&& rm -f -r \
/etc/nginx \
/tmp/*
# Copy data for add-on
COPY run.sh /
COPY requirements.txt /tmp/
# Install requirements for add-on
RUN pip install -r /tmp/requirements.txt
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

12
hello_flask/app.py Executable file
View File

@@ -0,0 +1,12 @@
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "Hey, we have Flask in a Docker container!"
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0")

10
hello_flask/build.json Executable file
View File

@@ -0,0 +1,10 @@
{
"args": {},
"build_from": {
"aarch64": "hassioaddons/base-python-aarch64:5.2.0",
"amd64": "hassioaddons/base-python-amd64:5.2.0",
"armhf": "hassioaddons/base-python-armhf:5.2.0",
"armv7": "hassioaddons/base-python-armv7:5.2.0",
"i386": "hassioaddons/base-python-i386:5.2.0"
}
}

20
hello_flask/config.json Executable file
View File

@@ -0,0 +1,20 @@
{
"name": "Hello flask",
"version": "0.23",
"slug": "hello_flask",
"description": "Hello world flask add-on!",
"arch": [
"armhf",
"armv7",
"aarch64",
"amd64",
"i386"
],
"startup": "before",
"boot": "auto",
"options": {},
"schema": {},
"ports": {
"5000/tcp": 5000
}
}

1
hello_flask/requirements.txt Executable file
View File

@@ -0,0 +1 @@
flask==1.1.2

5
hello_flask/run.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bashio
echo Running flask hello world
python3 app.py

106
mpd/CHANGELOG.md Normal file
View File

@@ -0,0 +1,106 @@
## 1.7.0 - 2021-04-02
* 🔨 Use ghcr.io/home-assistant for base images
## 1.6.0 - 2021-03-27
* 🐛 Fixed `media_folder`, `playlist_folder` options overwriting custom config. Thanks @LiJu09
* 🔨 Change how custom_config behave. Check docs. Thanks @LiJu09
## 1.5.4 - 2021-03-25
* Add `media_folder`, `playlist_folder` option. Thanks @LiJu09
## 1.5.3 - 2021-03-17
* 🐛 Specifiy own S6 entrypoint, don't rely on the base image.
## 1.5.2 - 2021-02-09
* 🔨 Migrate to new `devices` option format. Thanks @LiJu09
## 1.5.1 - 2021-01-30
* 🐛 Fixed missing permissions on startup
## 1.5.0 - 2021-01-30
* 🔼 Updated alpine image to `3.13`
* 🔼 Updated mpd to `0.22.3-r0`
* 🔨 Use Jemalloc for better memory handling
## 1.4.2 - 2020-11-11
* 🔨 Add httpd output config
* 🐛 Make debug config optional
## 1.4.1 - 2020-10-24
* Add `verbose` option
## 1.4.0 - 2020-10-20
* 🔼 Update alpine to `3.12`
* 🔼 Update mpd to `0.21.23-r0`
* 🔼 Update ympd to `1.3.0-r9`
* 🔼 Update mpc to `0.33-r2`
* 🔨 Use S6-Overlay for execution
* 🔨 Disable Avahi Discovery
* 🔨 Change audio output to Pulseaudio
* 🔨 Start mpd as `application` startup
* Removed alsa-plugins-pulse
## 1.3.2 - 2020-10-06
* Support `/media` folder
## 1.3.1 - 2020-05-26
* 🐛 Fixed startup without custom config file
## 1.3.0 - 2020-05-22
* Added `custom_config` option for own mpd configuration file.
* Added configuration docs
* 🔨 Updated Changelog to new format
## 1.2.0 - 2020-03-09
* Added `alsa-plugins-pulse` to be compatible with latest HassOS (> 3.11)
## 1.1.2 - 2020-02-09
* 🔨 Start mpd as `system` startup
## 1.1.1 - 2020-02-07
* 🔼 Update mpd to `0.21.16-r1`
* 🔼 Update ympd to `1.3.0-r8`
* 🔼 Update alpine to `3.11`
* 🔼 Update mpc to `0.33-r0`
## 1.1.0 - 2019-12-14
* Add `volume_normalization` option to addon
## 1.0.0 - 2019-12-x
* Add MPD version `0.20.21`
* Add ympd version `1.3.0`

59
mpd/DOCS.md Normal file
View File

@@ -0,0 +1,59 @@
# Configuration
```yaml
media_folder: /media/mpd/media
playlist_folder: /media/mpd/playlists
volume_normalization: false
httpd_output: false
```
### `volume_normalization`
Enables the built-in volume normalization feature.
### `httpd_output`
Enables the httpd audio output.
### `media_folder`
This option let you specify an custom media folder.
### `playlist_folder`
This option let you specify an custom playlist folder.
### `verbose` (optional)
Make `mpd` verbose.
```yaml
verbose: true
```
### `custom_config` (optional)
**If this is specified, all other options are ignored.**
This option let you specify an custom configuration file for MPD.
To keep all MPD files in one place I restricted the path prefix to `/share/mpd`
Please use the default [mpd.conf of the addon](https://github.com/Poeschl/Hassio-Addons/blob/master/mpd/root/etc/mpd.conf) as starting point.
In case you have issues with your configuration, the [MPD docs](https://www.musicpd.org/doc/html/user.html#configuration) might help you out.
Working example:
```yaml
...
custom_config: /share/mpd/mpd.conf
```
# Troubleshooting
### `RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler`
This error is shown on any none-glibc system like alpine linux is. MPD should work without it.
More see here: [MPD Issue](https://github.com/MusicPlayerDaemon/MPD/issues/218)
### `Failed to open '/data/database/mpd.db': No such file or directory`
This error is shown on the first start, when no database exists. It will be there on the second run.

11
mpd/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
ARG BUILD_FROM
FROM $BUILD_FROM
RUN apk add --no-cache \
mpc=0.33-r2 \
mpd=0.22.3-r0 \
ympd=1.3.0-r9
ENTRYPOINT [ "/init" ]
CMD []
COPY root /

31
mpd/README.md Normal file
View File

@@ -0,0 +1,31 @@
# MPD
[MPD](https://www.musicpd.org/) is a free and open source music player. It plays audio files, organizes playlists and maintains a music database. For interaction client software is needed.
Inside this addon there is [ympd](https://ympd.org/), a simple web frontend for interacting.
![Addon Stage][stage-badge]
![Supports aarch64 Architecture][aarch64-badge]
![Supports amd64 Architecture][amd64-badge]
![Supports armhf Architecture][armhf-badge]
![Supports armv7 Architecture][armv7-badge]
![Supports i386 Architecture][i386-badge]
[![Install on my Home Assistant][install-badge]][install-url]
[![Donate][donation-badge]][donation-url]
# Configuration
The configuration is located under the Docs tab or [DOCS.md](https://github.com/Poeschl/Hassio-Addons/blob/master/mpd/DOCS.md).
[aarch64-badge]: https://img.shields.io/badge/aarch64-yes-green.svg?style=for-the-badge
[amd64-badge]: https://img.shields.io/badge/amd64-yes-green.svg?style=for-the-badge
[armhf-badge]: https://img.shields.io/badge/armhf-yes-green.svg?style=for-the-badge
[armv7-badge]: https://img.shields.io/badge/armv7-yes-green.svg?style=for-the-badge
[i386-badge]: https://img.shields.io/badge/i386-yes-green.svg?style=for-the-badge
[install-url]: https://my.home-assistant.io/redirect/supervisor_addon?addon=243ffc37_mpd
[stage-badge]: https://img.shields.io/badge/Addon%20stage-stable-green.svg?style=for-the-badge
[install-badge]: https://img.shields.io/badge/Install%20on%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=for-the-badge&logoColor=white
[donation-url]: https://www.buymeacoffee.com/Poeschl

9
mpd/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"armhf": "ghcr.io/home-assistant/armhf-base:3.13",
"armv7": "ghcr.io/home-assistant/armv7-base:3.13",
"aarch64": "ghcr.io/home-assistant/aarch64-base:3.13",
"amd64": "ghcr.io/home-assistant/amd64-base:3.13",
"i386": "ghcr.io/home-assistant/i386-base:3.13"
}
}

47
mpd/config.json Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "MPD",
"version": "1.7.0",
"slug": "mpd",
"panel_icon": "mdi:music-circle",
"description": "Music Player Daemon is a free and open source music player. It plays audio files, organizes playlists and maintains a music database",
"url": "https://github.com/Poeschl/Hassio-Addons/tree/master/mpd",
"ingress": true,
"ingress_port": 6680,
"arch": [
"armv7",
"armhf",
"aarch64",
"amd64",
"i386"
],
"startup": "application",
"boot": "auto",
"image": "ghcr.io/poeschl/ha-mpd-{arch}",
"audio": true,
"devices": ["/dev/snd"],
"map": ["share:rw", "media:rw"],
"ports": {
"6680/tcp": null,
"6600/tcp": 6600,
"8000/tcp": null
},
"ports_description": {
"6680/tcp": "Web Frontend (Not needed with ingress feature)",
"6600/tcp": "MDP Connection",
"8000/tcp": "HTTPd Connection (if enabled)"
},
"options": {
"media_folder": "/media/mpd/media",
"playlist_folder": "/media/mpd/playlists",
"volume_normalization": false,
"httpd_output": false
},
"schema": {
"media_folder": "match(/share/.+|/media/.+|(smb|nfs)://.+)",
"playlist_folder": "match(/share/.+|/media/.+|(smb|nfs)://.+)",
"volume_normalization": "bool",
"httpd_output": "bool",
"verbose": "bool?",
"custom_config": "match(/share/mpd/.+)?"
}
}

BIN
mpd/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
mpd/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::log.info 'Setup Folders'
MEDIA_FOLDER=$(bashio::config 'media_folder')
PLAYLIST_FOLDER=$(bashio::config 'playlist_folder')
mkdir -p /data/database \
"${MEDIA_FOLDER}" \
"${PLAYLIST_FOLDER}"

View File

@@ -0,0 +1,36 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::log.info 'Setup settings'
if [ "$(bashio::config 'custom_config')" != 'null' ]; then
bashio::log.info 'Use custom config'
cp "$(bashio::config 'custom_config')" '/etc/mpd.conf'
else
bashio::log.info 'Set media folder'
MEDIA_FOLDER=$(bashio::config 'media_folder')
sed -i "s/music_directory.*/music_directory \"${MEDIA_FOLDER//\//\\/}\"/" /etc/mpd.conf
bashio::log.info 'Set playlist folder'
PLAYLIST_FOLDER=$(bashio::config 'playlist_folder')
sed -i "s/playlist_directory.*/playlist_directory \"${PLAYLIST_FOLDER//\//\\/}\"/" /etc/mpd.conf
if [ "$(bashio::config 'volume_normalization')" == 'true' ]; then
sed -i "/^#volume_normalization/s/^#//" /etc/mpd.conf
fi
if [ "$(bashio::config 'verbose')" == 'true' ]; then
sed -i "/^log_level/s/default/verbose/" /etc/mpd.conf
fi
if [ "$(bashio::config 'httpd_output')" == 'true' ]; then
printf '\n
audio_output { \n
type "httpd" \n
name "HTTPd Output" \n
port "8000" \n
bitrate "192" \n
}' >> /etc/mpd.conf
bashio::log.info 'HTTPd output enabled'
fi
fi

View File

@@ -0,0 +1,2 @@
/usr/bin/mpd false root:root 0744 0744
/usr/bin/mpc false root:root 0744 0744

View File

@@ -0,0 +1 @@
/usr/bin/ympd false root:root 0744 0744

386
mpd/root/etc/mpd.conf Normal file
View File

@@ -0,0 +1,386 @@
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "/share/mpd/music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory "/share/mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file "/data/database/mpd.db"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file "syslog"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
# pid_file "/var/run/mpd/mpd.pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
#state_file "/data/state"
#
# The location of the sticker database. This is a database which
# manages dynamic information attached to songs.
#
sticker_file "/data/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
#user "mpd"
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group "audio"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Not effective if
# systemd socket activiation is in use.
#
# For network
bind_to_address "0.0.0.0"
#
# And for Unix Socket
#bind_to_address "~/.mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
port "6600"
#
# This setting controls the type of information which is logged. Available
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
log_level "default"
#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
#
#restore_paused "no"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. The complete list of possible values can be
# found in the user manual.
metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This setting enables automatic update of MPD's database when files in
# music_directory are changed.
#
#auto_update "yes"
#
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself. There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################
# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
#follow_inside_symlinks "yes"
#
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
zeroconf_enabled "no"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
#zeroconf_name "Music Player"
#
###############################################################################
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# setting can be specified multiple times for different password profiles.
#
#password "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions "read,add,control,admin"
#
###############################################################################
# Database #######################################################################
#
#database {
# plugin "proxy"
# host "other.mpd.host"
# port "6600"
#}
# Input #######################################################################
#
#input {
# plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
#}
#
###############################################################################
# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
#audio_output {
# type "alsa"
# name "Home Assistant ALSA Audio"
## device "hw:0,0" # optional
## mixer_type "hardware" # optional
## mixer_device "default" # optional
## mixer_control "PCM" # optional
## mixer_index "0" # optional
#}
#
# An example of an OSS output:
#
#audio_output {
# type "oss"
# name "My OSS Device"
## device "/dev/dsp" # optional
## mixer_type "hardware" # optional
## mixer_device "/dev/mixer" # optional
## mixer_control "PCM" # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
# type "shout"
# encoder "vorbis" # optional
# name "My Shout Stream"
# host "localhost"
# port "8000"
# mount "/mpd.ogg"
# password "hackme"
# quality "5.0"
# bitrate "128"
# format "44100:16:1"
## protocol "icecast2" # optional
## user "source" # optional
## description "My Stream Description" # optional
## url "http://example.com" # optional
## genre "jazz" # optional
## public "no" # optional
## timeout "2" # optional
## mixer_type "software" # optional
#}
#
# An example of a recorder output:
#
#audio_output {
# type "recorder"
# name "My recorder"
# encoder "vorbis" # optional, vorbis or lame
# path "/var/lib/mpd/recorder/mpd.ogg"
## quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
#audio_output {
# type "httpd"
# name "My HTTP Stream"
# encoder "vorbis" # optional, vorbis or lame
# port "8000"
# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
# quality "5.0" # do not define if bitrate is defined
# bitrate "192" # do not define if quality is defined
# format "44100:16:1"
# max_clients "5" # optional 0=no limit
#}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
#
audio_output {
type "pulse"
name "Home Assistant Pulseaudio"
# server "remote_server" # optional
# sink "remote_server_sink" # optional
}
#
# An example of a winmm output (Windows multimedia API).
#
#audio_output {
# type "winmm"
# name "My WinMM output"
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
# or
## device "0" # optional
## mixer_type "hardware" # optional
#}
#
# An example of an openal output.
#
#audio_output {
# type "openal"
# name "My OpenAL output"
## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
#}
#
# An example of an sndio output.
#
#audio_output {
# type "sndio"
# name "sndio output"
# mixer_type "software"
#}
#
# An example of an OS X output:
#
#audio_output {
# type "osx"
# name "My OS X Device"
## device "Built-in Output" # optional
## channel_map "-1,-1,0,1" # optional
#}
#
## Example "pipe" output:
#
#audio_output {
# type "pipe"
# name "my pipe"
# command "aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
# command "AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
# command "nc example.org 8765"
# format "44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
# type "null"
# name "My Null Output"
# mixer_type "none" # optional
#}
#
###############################################################################
# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "off", "album", "track" or "auto". "auto" is a special mode that
# chooses between "track" and "album" depending on the current state of
# random playback. If random playback is enabled then "track" mode is used.
# See <http://www.replaygain.org> for more details about ReplayGain.
# This setting is off by default.
#
#replaygain "album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp "0"
#
# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
# By default this setting is disabled.
#
#replaygain_missing_preamp "0"
#
# This setting enables or disables ReplayGain limiting.
# MPD calculates actual amplification based on the ReplayGain tags
# and replaygain_preamp / replaygain_missing_preamp setting.
# If replaygain_limit is enabled MPD will never amplify audio signal
# above its original level. If replaygain_limit is disabled such amplification
# might occur. By default this setting is enabled.
#
#replaygain_limit "yes"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has
# equal "loudness". This setting is disabled by default.
#
#volume_normalization "yes"
#
###############################################################################
# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you
# may need to modify this setting.
#
filesystem_charset "UTF-8"
#
###############################################################################

View File

@@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bashio
set -e
# Enable Jemalloc for better memory handling
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
bashio::log.info 'Start MPD'
mpd --stdout --no-daemon

View File

@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::net.wait_for 6600
# Enable Jemalloc for better memory handling
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
bashio::log.info 'Start ympd'
ympd -w 6680

View File

@@ -1,4 +1,17 @@
## 14.3.7.99202108230857-7410-fefce0337ubuntu20.04.1-ls151 (24-08-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.7.99202108032349-7395-0415c0c6fubuntu20.04.1-ls149 (05-08-2021)
- Update to latest version from linuxserver/docker-qbittorrent
- Improved smb mount code
## 14.3.6.99202107121017-7389-3ac8c97e6ubuntu20.04.1-ls145 (13-07-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.6.99202107050919-7388-ede42910dubuntu20.04.1-ls143 (05-07-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141 (28-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent

View File

@@ -1,84 +1,86 @@
ARG BUILD_FROM
ARG BUILD_VERSION
ARG BUILD_UPSTREAM="14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141"
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
FROM ${BUILD_FROM}
# Base system
ARG BASHIO_VERSION=0.13.0
ARG BASHIO_VERSION=0.13.1
ARG TEMPIO_VERSION=2021.01.0
ARG BUILD_ARCH
RUN \
####################
# AVOID NTP ISSUES #
####################
yum install -y ntp && \
service ntpd stop && \
ntpdate pool.ntp.org && \
\
################
# Install apps #
################
apt-get update && \
apt-get install -y \
apt-transport-https \
apt-get update \
&& apt-get install -y \
jq \
curl \
cifs-utils \
keyutils \
samba \
nginx \
coreutils \
openvpn \
&& apt-get clean \
\
##################
# Install tempio #
##################
curl -L -f -s -o /usr/bin/tempio \
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" && \
chmod a+x /usr/bin/tempio && \
&& curl -L -f -s -o /usr/bin/tempio \
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" \
&& chmod a+x /usr/bin/tempio \
\
##############
# STATISTICS #
##############
curl -L -f -s -o /tmp/tmp \
"https://github.com/alexbelgium/downloads-tracker/archive/refs/tags/Qbittorrent.zip" && \
&& curl -L -f -s -o /tmp/tmp \
"https://github.com/alexbelgium/downloads-tracker/archive/refs/tags/Qbittorrent.zip" \
\
##################
# Install bashio #
##################
mkdir -p /tmp/bashio && \
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" && \
| tar -xzf - --strip 1 -C /tmp/bashio && \
mv /tmp/bashio/lib /usr/lib/bashio && \
ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \
rm -rf /tmp/bashio && \
&& mkdir -p /tmp/bashio \
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
| tar -xzf - --strip 1 -C /tmp/bashio \
&& mv /tmp/bashio/lib /usr/lib/bashio \
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
&& rm -rf /tmp/bashio \
\
########################################
# Correct upstream image folders links #
########################################
\
# Allow UID and GID setting
sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser && \
sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' /etc/cont-init.d/10-adduser && \
sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser && \
&& sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \
&& sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' /etc/cont-init.d/10-adduser \
&& sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser \
\
# Correct permissions
sed -i 's|/config|-R /config/qBittorrent|g' /etc/cont-init.d/10-adduser && \
sed -i 's= /config=/config/qBittorrent || true=g' /etc/cont-init.d/30-config && \
&& sed -i 's=/config=/config/qBittorrent || true=g' /etc/cont-init.d/10-adduser \
&& sed -i 's= /config=/config/qBittorrent || true=g' /etc/cont-init.d/30-config \
\
# Set download folder to /share
sed -i 's|/downloads/|/share/qBittorrent/|g' /defaults/qBittorrent.conf && \
&& sed -i 's|/downloads/|/share/qBittorrent/|g' /defaults/qBittorrent.conf \
\
# Remove fixed folders, allows connection to webUI
sed '11,13d' /defaults/qBittorrent.conf && \
echo 'WebUI\HostHeaderValidation=false' >> /defaults/qBittorrent.conf && \
echo 'WebUI\LocalHostAuth=false' >> /defaults/qBittorrent.conf
&& sed '11,13d' /defaults/qBittorrent.conf \
&& echo 'WebUI\HostHeaderValidation=false' >> /defaults/qBittorrent.conf \
&& echo 'WebUI\LocalHostAuth=false' >> /defaults/qBittorrent.conf
# Copy root filesystem
COPY rootfs /
VOLUME [ "/data" ]
# Environment variables
ENV \
DEBIAN_FRONTEND="noninteractive"\
LANG="C.UTF-8" \
PS1="$(whoami)@$(hostname):$(pwd)$ " \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES=1 \
TERM="xterm-256color"
### LABELS
ARG BUILD_ARCH
ARG BUILD_DATE

View File

@@ -1,30 +1,39 @@
# Home assistant add-on: qBittorrent
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
![Supports smb mounts][smb-shield] ![Supports openvpn][openvpn-shield] ![Supports ingress][ingress-shield] ![Supports ssl][ssl-shield]
## About
# About
----------
[Qbittorrent](https://github.com/qbittorrent/qBittorrent) is a cross-platform free and open-source BitTorrent client.
This addon is based on the docker image from [linuxserver.io](https://www.linuxserver.io/).
qBittorrent is a bittorrent client.
This addon is based on the [docker image](https://github.com/linuxserver/qbittorrent) from linuxserver.io.
This addons has several configurable options :
- allowing to mount local external drive, or smb share from the addon
- [alternative webUI](https://github.com/qbittorrent/qBittorrent/wiki/List-of-known-alternate-WebUIs)
- usage of ssl
- ingress
- optional openvpn support
- allow setting specific DNS servers
## Installation
# Installation
----------
The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Add my add-ons repository to your home assistant instance (in supervisor addons store at top right, or click button below if you have configured my HA)
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons)
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Set the add-on options to your preferences
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.
1. Open the webUI and adapt the software options
## Configuration
Webui can be found at <http://your-ip:8081>. The default username/password : described in the startup log. Configurations can be done through the app, except for the following options.
# Configuration
--------------
Webui can be found at <http://your-ip:8080>, or in your sidebar using Ingress.
The default username/password : described in the startup log.
Configurations can be done through the app webUI, except for the following options
Network disk is mounted to /mnt/storagename
OpenVPN must be enabled from within qBittorrent options
Network disk is mounted to /mnt/share name
```yaml
GUID: user
@@ -35,21 +44,29 @@ keyfile: privkey.pem #sslkeyfile
whitelist: "localhost,192.168.0.0/16" # list ip subnets that won't need a password (optional)
Username: "admin" #username to access webui. Please change it as the default is admin for all installations.
customUI: selection from list # alternative webUI can be set here. Latest version set at each addon start.
SavePath: "/share/qbittorrent" # Define the download directory
DNS_servers : 8.8.8.8,1.1.1.1 # Keep blank to use routers DNS, or set custom DNS to avoid spamming in case of local DNS ad-remover
SavePath: "/share/qbittorrent" # Define the download directory
networkdisks: "//SERVER/SHARE" # optional, list of smb servers to mount, separated by commas
cifsusername: "username" # optional, smb username, same for all smb shares
cifspassword: "password" # optional, smb password, same for all smb shares)
openvpn_enabled: yes/no
cifspassword: "password" # optional, smb password
cifsdomain: "domain" # optional, allow setting the domain for the smb share
password, same for all smb shares
openvpn_enabled: true/false # is openvpn required to start qbittorrent
openvpn_alternative_mode: true/false # if enabled, will tunnel only qbittorrent and not webui through vpn. Allows webui connection from external networks, but risk of decreased stability.
openvpn_config: must reference an openvpn config files stored in /config/openvpn
openvpn_username: openvpn username
openvpn_password": openvpn password
openvpn_config": For example "config.ovpn" # name of the file located in /config/openvpn.
openvpn_username": USERNAME
openvpn_password: YOURPASSWORD
```
# Integration with HA
Use the [qBittorrent integration](https://www.home-assistant.io/integrations/qbittorrent/)
## Support
Create an issue on github, or ask on the [home assistant thread](https://community.home-assistant.io/t/home-assistant-addon-qbittorrent/279247)
# Illustration (vuetorrent webui)
--------------
![illustration](https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/qbittorrent/illustration.png)
[repository]: https://github.com/alexbelgium/hassio-addons
[smb-shield]: https://img.shields.io/badge/smb-yes-green.svg
[openvpn-shield]: https://img.shields.io/badge/openvpn-yes-green.svg
@@ -59,3 +76,4 @@ Create an issue on github, or ask on the [home assistant thread](https://communi
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg

View File

@@ -10,12 +10,15 @@ profile db21ed7f_qbittorrent flags=(attach_disconnected,mediate_deleted) {
remount,
capability setgid,
capability chown,
capability setuid,
capability sys_admin,
capability dac_read_search,
capability net_admin,
capability dac_override,
# capability sys_rawio,
capability net_bind_service,
capability net_broadcast,
capability sys_rawio,
# S6-Overlay
/bin/** ix,

View File

@@ -1,8 +1,8 @@
{
"build_from": {
"armv7": "linuxserver/qbittorrent:arm32v7-",
"armhf": "linuxserver/qbittorrent:arm32v7-",
"aarch64": "linuxserver/qbittorrent:arm64v8-",
"amd64": "linuxserver/qbittorrent:amd64-"
"armv7": "linuxserver/qbittorrent:arm32v7-latest",
"armhf": "linuxserver/qbittorrent:arm32v7-latest",
"aarch64": "linuxserver/qbittorrent:arm64v8-latest",
"amd64": "linuxserver/qbittorrent:amd64-latest"
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "Qbittorrent",
"version": "14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141",
"upstream": "14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141",
"version": "14.3.7.99202108230857-7410-fefce0337ubuntu20.04.1-ls151",
"upstream": "14.3.7.99202108230857-7410-fefce0337ubuntu20.04.1-ls151",
"slug": "qbittorrent",
"description": "qBittorrent is a bittorrent client",
"url": "https://github.com/alexbelgium/hassio-addons",
@@ -14,6 +14,9 @@
"ingress": true,
"ingress_port": 8099,
"panel_icon": "mdi:progress-download",
"hassio_api": true,
"hassio_role": "homeassistant",
"homeassistant_api": true,
"ports": {
"8080/tcp": 8081,
"6881/tcp": 6881,

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@@ -31,8 +31,8 @@ fi
# Correct Port #
################
sed -i '/PortRangeMin/d' qBittorrent.conf
sed -i "$LINE i\Connection\\\PortRangeMin=6881" qBittorrent.conf
# sed -i '/PortRangeMin/d' qBittorrent.conf
# sed -i "$LINE i\Connection\\\PortRangeMin=6881" qBittorrent.conf
################
# SSL CONFIG #

View File

@@ -39,14 +39,20 @@ if bashio::config.has_value 'networkdisks'; then
if [ $MOUNTED = false ]; then
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN}"
do
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5"
mount -t cifs -o rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5" ",iocharset=utf8"
do
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
mount -t cifs -o rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
done
done
fi
# Test smbclient if not mounted yet
if [ $MOUNTED = false ]; then
smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD --option="client min protocol"="NT1" && \
bashio::log.info "Mounted with smbclient"
fi
# Messages
if [ $MOUNTED = true ]; then
#Test write permissions

6
radarr/Dockerfile Executable file
View File

@@ -0,0 +1,6 @@
FROM linuxserver/radarr
# MOFIFY DATA PATH
RUN sed -i "s|config|data|g" /etc/services.d/radarr/run
VOLUME [ "/data" ]

32
radarr/README.md Normal file
View File

@@ -0,0 +1,32 @@
# Marcelveldt's Hassio Add-ons: Radarr
## About
Radarr add-on based on the prebuilt docker image from linuxserver
Radarr - A fork of Sonarr to work with movies à la Couchpotato.
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Install this 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
Webui can be found at <your-ip>:7878
By default hassio folders backup, share and ssl are available within the addon.
You can use the share folder to access/store your media files.
Documentation for Radarr: https://github.com/Radarr/Radarr
[repository]: https://github.com/marcelveldt/hassio-addons-repo

29
radarr/config.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "Radarr",
"version": "latest",
"slug": "radarr_docker",
"description": "Radarr add-on based on the prebuilt docker image from linuxserver",
"url": "https://github.com/marcelveldt/hassio-addons-repo/radarr",
"startup": "services",
"arch": [
"aarch64",
"amd64",
"armhf"
],
"ports": {
"7878/tcp": 7878
},
"map": [
"backup:rw",
"share:rw",
"ssl"
],
"webui": "http://[HOST]:[PORT:7878]",
"boot": "auto",
"environment": {
"PUID": "0",
"PGID": "0"
},
"options": {},
"schema": {}
}

BIN
radarr/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
radarr/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

30
vnc-viewer/CHANGELOG.md Normal file
View File

@@ -0,0 +1,30 @@
## 1.3.0 - 2021-04-02
* 🔨 Use ghcr.io/home-assistant for base images
## 1.2.1 - 2021-03-17
* 🐛 Specifiy own S6 entrypoint, don't rely on the base image
## 1.2.0 - 2012-01-10
* Add password option, for not retyping the password every time
* 🔨 Use noVNC icons since the addon is based on noVNC
## 1.1.1 - 2021-01-05
* 🔨 Use rounded icons, thanks @LiJu09
* 🔨 Fixed addon github link, thanks @LiJu09
## 1.1.0 - 2020-12-31
* 🐛 Fix websocket url to connect to the included websockify
## 1.0.0 - 2020-12-27
* Add noVNC version `1.3.0-r8`

19
vnc-viewer/DOCS.md Normal file
View File

@@ -0,0 +1,19 @@
## Config
Example config:
```yaml
vnc_server_host: 192.168.0.23
```
### `vnc_server_host`
The hostname or ip address of the VNC server the addon should connect to.
### `vnc_server_port` (Optional)
The remote port of the VNC server. (Default: `5900`)
### `vnc_server_password` (Optional)
The password of the the VNC server. When not set and the connection requires a password, it is asked at connection time.

43
vnc-viewer/Dockerfile Normal file
View File

@@ -0,0 +1,43 @@
ARG BUILD_FROM
FROM $BUILD_FROM AS NO_VNC
RUN apt-get update && apt-get -y --no-install-recommends install \
git=1:2.20.1-2+deb10u3
RUN git config --global advice.detachedHead false && \
git clone https://github.com/novnc/noVNC.git -b v1.2.0 /noVNC
FROM $BUILD_FROM AS WEBSOCKIFY
RUN apt-get update && apt-get -y --no-install-recommends install \
git=1:2.20.1-2+deb10u3 \
python3=3.7.3-1 \
python3-setuptools=40.8.0-1 \
python3-numpy=1:1.16.2-1 \
python3-pip=18.1-5
RUN pip3 install --no-cache-dir Cython==0.29.21
# hadolint ignore=DL3003
RUN git config --global advice.detachedHead false && \
git clone https://github.com/novnc/websockify -b v0.9.0 /websockify && \
cd /websockify && python3 setup.py install
FROM $BUILD_FROM AS RUNNING
RUN apt-get update && apt-get -y --no-install-recommends install \
git=1:2.20.1-2+deb10u3 \
python3=3.7.3-1 \
python3-setuptools=40.8.0-1 \
python3-numpy=1:1.16.2-1 \
procps=2:3.3.15-2 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=NO_VNC /noVNC /noVNC
COPY --from=WEBSOCKIFY /usr/local/lib/python3.7/dist-packages/ /usr/local/lib/python3.7/dist-packages/
COPY --from=WEBSOCKIFY /usr/local/bin/websockify /usr/local/bin/websockify
ENTRYPOINT [ "/init" ]
CMD []
COPY root /

30
vnc-viewer/README.md Normal file
View File

@@ -0,0 +1,30 @@
# VNC Viewer
Bundles the noVNC application inside an Home Assistant Addon. This allows the integration of any VNC server into Home Assistant.
![Addon Stage][stage-badge]
![Supports aarch64 Architecture][aarch64-badge]
![Supports amd64 Architecture][amd64-badge]
![Supports armhf Architecture][armhf-badge]
![Supports armv7 Architecture][armv7-badge]
![Supports i386 Architecture][i386-badge]
[![Install on my Home Assistant][install-badge]][install-url]
[![Donate][donation-badge]][donation-url]
## Note
Currently only one connection is possible, if more are needed create or join the thread in the repository discussions.
[aarch64-badge]: https://img.shields.io/badge/aarch64-yes-green.svg?style=for-the-badge
[amd64-badge]: https://img.shields.io/badge/amd64-yes-green.svg?style=for-the-badge
[armhf-badge]: https://img.shields.io/badge/armhf-yes-green.svg?style=for-the-badge
[armv7-badge]: https://img.shields.io/badge/armv7-yes-green.svg?style=for-the-badge
[i386-badge]: https://img.shields.io/badge/i386-yes-green.svg?style=for-the-badge
[install-url]: https://my.home-assistant.io/redirect/supervisor_addon?addon=243ffc37_vnc
[stage-badge]: https://img.shields.io/badge/Addon%20stage-stable-green.svg?style=for-the-badge
[install-badge]: https://img.shields.io/badge/Install%20on%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=for-the-badge&logoColor=white
[donation-url]: https://www.buymeacoffee.com/Poeschl

9
vnc-viewer/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"armhf": "ghcr.io/home-assistant/armhf-base-debian:buster",
"armv7": "ghcr.io/home-assistant/armv7-base-debian:buster",
"aarch64": "ghcr.io/home-assistant/aarch64-base-debian:buster",
"amd64": "ghcr.io/home-assistant/amd64-base-debian:buster",
"i386": "ghcr.io/home-assistant/i386-base-debian:buster"
}
}

30
vnc-viewer/config.json Normal file
View File

@@ -0,0 +1,30 @@
{
"name": "VNC Viewer",
"version": "1.3.0",
"slug": "vnc",
"panel_icon": "mdi:remote-desktop",
"description": "A noVNC client integrated in Home Assistant",
"url": "https://github.com/Poeschl/Hassio-Addons/tree/master/vnc-viewer",
"ingress": true,
"ingress_port": 6080,
"ingress_entry":"vnc.html?autoconnect=true",
"arch": [
"armv7",
"armhf",
"aarch64",
"amd64",
"i386"
],
"startup": "application",
"boot": "manual",
"hassio_api": true,
"image": "ghcr.io/poeschl/ha-vnc-{arch}",
"options": {
"vnc_server_host": "localhost"
},
"schema": {
"vnc_server_host": "str",
"vnc_server_port": "int?",
"vnc_server_password":"str?"
}
}

BIN
vnc-viewer/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
vnc-viewer/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::log.info 'Set some defaults'
sed -i "/UI.initSetting('show_dot'/ s/false/true/; /UI.initSetting('resize'/ s/off/scale/" /noVNC/app/ui.js

View File

@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::log.info 'Prepare noVNC for Home Assistant ingress'
host_port=$(bashio::core.port)
ingress_url=$(bashio::addon.ingress_entry)
sed -i "/UI.initSetting/ s@'websockify'@'${ingress_url:1}/websockify'@; /UI.initSetting/ s/ port/ ${host_port}/" /noVNC/app/ui.js

View File

@@ -0,0 +1,20 @@
#!/usr/bin/with-contenv bashio
set -e
if bashio::config.has_value 'vnc_server_password'; then
bashio::log.info 'Inject vnc connection password'
password=$(bashio::config 'vnc_server_password')
sed -i "s/WebUtil.getConfigVar('password');/'${password}';/" /noVNC/app/ui.js
fi
server_host=$(bashio::config 'vnc_server_host')
server_port=5900
if bashio::config.has_value 'vnc_server_port'; then
server_port=$(bashio::config 'vnc_server_port')
fi
server="${server_host}:${server_port}"
bashio::log.info 'Start noVNC'
bashio::log.info "Connecting to VNC $server"
/noVNC/utils/launch.sh --listen 6080 --vnc $server

14
wiki.js/CHANGELOG.md Normal file
View File

@@ -0,0 +1,14 @@
# Changelog
## 1.1.1
- bump hassio-addon-base to V10.0.1
## 1.1.0
- bump hassio-addon-base to V10.0.0
- Update Wiki.JS to 2.5.201
## 1.0.1
- Update Wiki.JS to 2.5.191
## 1.0.0
- Initial release

18
wiki.js/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.1
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
RUN apk --no-cache add nodejs wget tar mariadb-client
WORKDIR /wiki
RUN wget https://github.com/Requarks/wiki/releases/download/2.5.201/wiki-js.tar.gz
RUN tar xzf wiki-js.tar.gz -C /wiki
RUN rm wiki-js.tar.gz
RUN rm /wiki/config.sample.yml
# Copy data for add-on
COPY run.sh /
#COPY config.yml /wiki/
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

91
wiki.js/README.md Normal file
View File

@@ -0,0 +1,91 @@
# Home Assistant Community Add-on: Wiki.js
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
![Project Maintenance][maintenance-shield]
Wiki.js for Homeassistant OS
## About
The most powerful and extensible open source Wiki software.
Make documentation a joy to write using Wiki.js's beautiful and intuitive interface!
## Installation
[![FaserF Homeassistant Addons](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2FFaserF%2Fhassio-addons)
<br />
The installation of this add-on is pretty straightforward and not different in comparison to installing any other custom Home Assistant add-on.<br />
Just click the link above or add my repo to the hassio addons repositorys: https://github.com/FaserF/hassio-addons
Please ensure that the MariaDB Addon is installed!
## Configuration
**Note**: _Remember to restart the add-on when the configuration is changed._
Example add-on configuration:
```yaml
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
```
**Note**: _This is just an example, don't copy and paste it! Create your own!_
### Option: `ssl`
Enables/Disables SSL (HTTPS) on the web interface. Set it `true` to enable it, `false` otherwise.
If you need a self-signed certificate, have a look at my openssl addon: https://github.com/FaserF/hassio-addons/tree/master/openssl
**Note**: _The files MUST be stored in `/ssl/`, which is the default_
## Ingress
This addon currently does not fully support ingress! Hopefully that will come soon.
## Support
Got questions or problems?
You can [open an issue here][issue] GitHub.
Please keep in mind, that this software is only tested on armv7 running on a Raspberry Pi 4.
## Authors & contributors
The original program is from the Requarks Team [NGPixel][NGPixel]. For more informations, please visit this page: https://github.com/Requarks/wiki
The hassio addon is brought to you by [FaserF].
## License
MIT License
Copyright (c) 2021 FaserF & Requarks
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.
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[FaserF]: https://github.com/FaserF/
[issue]: https://github.com/FaserF/hassio-addons/issues
[repository]: https://github.com/FaserF/hassio-addons/wiki.js
[NGPixel]: https://github.com/NGPixel

9
wiki.js/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "ghcr.io/hassio-addons/base/aarch64:10.0.1",
"amd64": "ghcr.io/hassio-addons/base/amd64:10.0.1",
"armhf": "ghcr.io/hassio-addons/base/armhf:10.0.1",
"armv7": "ghcr.io/hassio-addons/base/armv7:10.0.1",
"i386": "ghcr.io/hassio-addons/base/i386:10.0.1"
}
}

35
wiki.js/config.json Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "Wiki.JS",
"version": "1.1.1",
"slug": "wikijs",
"description": "The most powerful and extensible open source Wiki software",
"url": "https://github.com/FaserF/hassio-addons/tree/master/wiki.js",
"arch": ["armhf", "armv7", "aarch64", "amd64"],
"services": ["mysql:need"],
"startup": "application",
"boot": "auto",
"webui": "[PROTO:ssl]://[HOST]:[PORT:3000]",
"ingress": true,
"panel_icon": "mdi:wikipedia",
"options": {
"ssl": true,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"log_level": "info"
},
"schema": {
"ssl": "bool",
"certfile": "str",
"keyfile": "str",
"log_level": "list(error|warn|info|verbose|debug|silly)?",
"reset_database": "bool?"
},
"ports": {
"3000/tcp": 3000,
"3443/tcp": 3443
},
"ports_description": {
"3000/tcp": "HTTP Entrance port",
"3443/tcp": "HTTPS/SSL Entrance port"
}
}

BIN
wiki.js/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 KiB

65
wiki.js/run.sh Normal file
View File

@@ -0,0 +1,65 @@
#!/usr/bin/with-contenv bashio
ssl=$(bashio::config 'ssl')
certfile=$(bashio::config 'certfile')
keyfile=$(bashio::config 'keyfile')
log_level=$(bashio::config 'log_level')
declare host
declare password
declare port
declare username
# Require MySQL service to be available
#if ! bashio::services.available "mysql"; then
# bashio::log.error \
# "This add-on requires the MariaDB core add-on 2.0 or newer!"
# bashio::exit.nok \
# "Make sure the MariaDB add-on is installed and running"
#fi
echo "This add-on requires the MariaDB core add-on 2.0 or newer!"
host=$(bashio::services "mysql" "host")
password=$(bashio::services "mysql" "password")
port=$(bashio::services "mysql" "port")
username=$(bashio::services "mysql" "username")
#Drop database based on config flag
if bashio::config.true 'reset_database'; then
bashio::log.warning 'Recreating database'
echo "DROP DATABASE IF EXISTS wiki;" \
| mysql -h "${host}" -P "${port}" -u "${username}" -p"${password}"
#Remove reset_database option
bashio::addon.option 'reset_database'
fi
#Create Config file
echo "port: 3000" > /wiki/config.yml
echo "db:" >> /wiki/config.yml
echo " type: mariadb" >> /wiki/config.yml
echo " host: ${host}" >> /wiki/config.yml
echo " port: ${port}" >> /wiki/config.yml
echo " user: ${username}" >> /wiki/config.yml
echo " pass: ${password}" >> /wiki/config.yml
echo " db: wiki" >> /wiki/config.yml
echo "ssl:" >> /wiki/config.yml
echo " enabled: $ssl" >> /wiki/config.yml
echo " port: 3443" >> /wiki/config.yml
echo " provider: custom" >> /wiki/config.yml
echo " format: pem" >> /wiki/config.yml
echo " key: $keyfile" >> /wiki/config.yml
echo " cert: $certfile" >> /wiki/config.yml
echo "pool:" >> /wiki/config.yml
echo "bindIP: 0.0.0.0" >> /wiki/config.yml
echo "logLevel: $log_level" >> /wiki/config.yml
echo "offline: false" >> /wiki/config.yml
echo "ha: false" >> /wiki/config.yml
echo "dataPath: ./data" >> /wiki/config.yml
# Create database if not exists
echo "CREATE DATABASE IF NOT EXISTS wiki;" \
| mysql -h "${host}" -P "${port}" -u "${username}" -p"${password}"
echo "Starting Wiki.JS"
node server

34
ympd/CHANGELOG.md Normal file
View File

@@ -0,0 +1,34 @@
## 1.3.0 - 2021-04-02
* 🔨 Use ghcr.io/home-assistant for base images
## 1.2.1 - 2021-03-17
* 🐛 Specifiy own S6 entrypoint, don't rely on the base image
## 1.2.0 - 2021-01-30
* 🔼 Update alpine to `3.13`
* 🔨 Use Jemalloc for better memory handling
## 1.1.0 - 2020-10-22
* 🔼 Update alpine to `3.12`
* 🔼 Update ympd to `1.3.0-r9`
* 🔨 Use S6-Overlay for execution
* 🔨 Start ympd as `application` startup
## 1.0.1 - 2020-05-22
* 🔨 Updated Changelog to new format
## 1.0.0 - 2020-02-12
### Added
* Add ympd version `1.3.0-r8`

Some files were not shown because too many files have changed in this diff Show More