mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-18 21:54:20 +01:00
11
vlc/rootfs/etc/cont-init.d/ingress.sh
Normal file
11
vlc/rootfs/etc/cont-init.d/ingress.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Prepair VLC for ingress access
|
||||
# ==============================================================================
|
||||
|
||||
# Generate NGINX config
|
||||
bashio::var.json \
|
||||
supervisor_ip "$(getent hosts supervisor | awk '{ print $1 }' | head -1)" \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/nginx.conf \
|
||||
-out /etc/nginx/nginx.conf
|
||||
11
vlc/rootfs/etc/cont-init.d/secret.sh
Normal file
11
vlc/rootfs/etc/cont-init.d/secret.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Create VLC secret
|
||||
# ==============================================================================
|
||||
|
||||
if bashio::fs.file_exists /data/secret; then
|
||||
bashio::exit.ok
|
||||
fi
|
||||
|
||||
# Generate password
|
||||
pwgen 64 1 > /data/secret
|
||||
8
vlc/rootfs/etc/services.d/nginx/finish
Normal file
8
vlc/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
5
vlc/rootfs/etc/services.d/nginx/run
Normal file
5
vlc/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start NGINX service
|
||||
# ==============================================================================
|
||||
exec nginx
|
||||
19
vlc/rootfs/etc/services.d/vlc/discovery
Executable file
19
vlc/rootfs/etc/services.d/vlc/discovery
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Send vlc_telnet discovery information to Home Assistant
|
||||
# ==============================================================================
|
||||
declare ha_config
|
||||
|
||||
# Prepare discovery payload
|
||||
ha_config=$(\
|
||||
bashio::var.json \
|
||||
host "$(hostname)" \
|
||||
port "^3000" \
|
||||
password "$(cat /data/secret)" \
|
||||
)
|
||||
|
||||
if bashio::discovery "vlc_telnet" "${ha_config}" > /dev/null; then
|
||||
bashio::log.info "Successfully send discovery information to Home Assistant."
|
||||
else
|
||||
bashio::log.error "Discovery message to Home Assistant failed!"
|
||||
fi
|
||||
8
vlc/rootfs/etc/services.d/vlc/finish
Normal file
8
vlc/rootfs/etc/services.d/vlc/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when Z-Wave JS fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
11
vlc/rootfs/etc/services.d/vlc/run
Normal file
11
vlc/rootfs/etc/services.d/vlc/run
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Start Z-Wave JS service for Z-Wave radio
|
||||
# ==============================================================================
|
||||
readonly PASSWORD="$(cat /data/secret)"
|
||||
|
||||
# Send out discovery information to Home Assistant
|
||||
./discovery &
|
||||
|
||||
# Run daemon
|
||||
exec cvlc -I http --extraintf telnet --http-host 127.0.0.1 --http-password "INGRESS" --telnet-password "${PASSWORD}" --aout=pulse
|
||||
55
vlc/rootfs/usr/share/tempio/nginx.conf
Normal file
55
vlc/rootfs/usr/share/tempio/nginx.conf
Normal file
@@ -0,0 +1,55 @@
|
||||
worker_processes 1;
|
||||
pid /var/run/nginx.pid;
|
||||
error_log /dev/stdout info;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
proxy_read_timeout 1200;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
upstream backend {
|
||||
ip_hash;
|
||||
server 127.0.0.1:8080;
|
||||
}
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
# Ingress
|
||||
server {
|
||||
listen 8099 default_server;
|
||||
listen [::]:8099 default_server;
|
||||
|
||||
allow {{ .supervisor_ip }};
|
||||
deny all;
|
||||
|
||||
server_name _;
|
||||
access_log /dev/stdout combined;
|
||||
|
||||
client_max_body_size 4G;
|
||||
keepalive_timeout 5;
|
||||
|
||||
root /dev/null;
|
||||
|
||||
location / {
|
||||
proxy_redirect off;
|
||||
proxy_pass http://backend;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Authorization "Basic OklOR1JFU1M=";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user