mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-24 01:31:51 +02:00
Add NetBird server add-on
This commit is contained in:
19
netbird-server/rootfs/etc/services.d/coturn/run
Normal file
19
netbird-server/rootfs/etc/services.d/coturn/run
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs Coturn
|
||||
# ==============================================================================
|
||||
|
||||
DATA_DIR=$(bashio::config 'data_dir')
|
||||
TURN_CONFIG="$DATA_DIR/turn/turnserver.conf"
|
||||
|
||||
if [[ ! -f "$TURN_CONFIG" ]]; then
|
||||
bashio::log.error "Missing Coturn configuration at ${TURN_CONFIG}."
|
||||
bashio::exit.nok
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting Coturn..."
|
||||
exec /usr/local/bin/turnserver -c "$TURN_CONFIG" --log-file stdout
|
||||
43
netbird-server/rootfs/etc/services.d/dashboard/run
Normal file
43
netbird-server/rootfs/etc/services.d/dashboard/run
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs the NetBird Dashboard
|
||||
# ==============================================================================
|
||||
|
||||
DOMAIN=$(bashio::config 'domain')
|
||||
EXTERNAL_BASE_URL=$(bashio::config 'external_base_url')
|
||||
MANAGEMENT_LISTEN=$(bashio::config 'management_listen')
|
||||
AUTH_AUTHORITY=$(bashio::config 'auth_authority')
|
||||
AUTH_CLIENT_ID=$(bashio::config 'auth_client_id')
|
||||
AUTH_CLIENT_SECRET=$(bashio::config 'auth_client_secret')
|
||||
AUTH_AUDIENCE=$(bashio::config 'auth_audience')
|
||||
AUTH_SUPPORTED_SCOPES=$(bashio::config 'auth_supported_scopes')
|
||||
USE_AUTH0=$(bashio::config 'use_auth0')
|
||||
|
||||
MANAGEMENT_PORT="${MANAGEMENT_LISTEN##*:}"
|
||||
|
||||
if [[ -n "$EXTERNAL_BASE_URL" ]]; then
|
||||
NETBIRD_MGMT_API_ENDPOINT="$EXTERNAL_BASE_URL"
|
||||
elif [[ -n "$DOMAIN" ]]; then
|
||||
NETBIRD_MGMT_API_ENDPOINT="http://${DOMAIN}:${MANAGEMENT_PORT}"
|
||||
else
|
||||
bashio::log.warning "external_base_url and domain are empty; defaulting NETBIRD_MGMT_API_ENDPOINT to localhost."
|
||||
NETBIRD_MGMT_API_ENDPOINT="http://127.0.0.1:${MANAGEMENT_PORT}"
|
||||
fi
|
||||
|
||||
export AUTH_AUTHORITY
|
||||
export AUTH_CLIENT_ID
|
||||
export AUTH_CLIENT_SECRET
|
||||
export AUTH_AUDIENCE
|
||||
export AUTH_SUPPORTED_SCOPES
|
||||
export USE_AUTH0
|
||||
export NETBIRD_MGMT_API_ENDPOINT
|
||||
|
||||
bashio::log.info "Preparing NetBird Dashboard assets..."
|
||||
/usr/local/bin/init_react_envs.sh
|
||||
|
||||
bashio::log.info "Starting NetBird Dashboard..."
|
||||
exec nginx -g "daemon off;"
|
||||
23
netbird-server/rootfs/etc/services.d/management/run
Normal file
23
netbird-server/rootfs/etc/services.d/management/run
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs the NetBird Management service
|
||||
# ==============================================================================
|
||||
|
||||
DATA_DIR=$(bashio::config 'data_dir')
|
||||
LOG_LEVEL=$(bashio::config 'log_level')
|
||||
MANAGEMENT_CONFIG="$DATA_DIR/management/management.json"
|
||||
|
||||
if [[ ! -f "$MANAGEMENT_CONFIG" ]]; then
|
||||
bashio::log.error "Missing management configuration at ${MANAGEMENT_CONFIG}."
|
||||
bashio::exit.nok
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting NetBird Management..."
|
||||
exec /usr/local/bin/netbird-mgmt management \
|
||||
--config "$MANAGEMENT_CONFIG" \
|
||||
--log-level "$LOG_LEVEL" \
|
||||
--log-file console
|
||||
20
netbird-server/rootfs/etc/services.d/relay/run
Normal file
20
netbird-server/rootfs/etc/services.d/relay/run
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs the NetBird Relay (optional)
|
||||
# ==============================================================================
|
||||
|
||||
LOG_LEVEL=$(bashio::config 'log_level')
|
||||
RELAY_EXPOSED_ADDRESS=$(bashio::config 'relay_exposed_address')
|
||||
RELAY_AUTH_SECRET=$(bashio::config 'relay_auth_secret')
|
||||
|
||||
bashio::log.info "Starting NetBird Relay..."
|
||||
exec /usr/local/bin/netbird-relay \
|
||||
--listen-address ":33080" \
|
||||
--exposed-address "$RELAY_EXPOSED_ADDRESS" \
|
||||
--auth-secret "$RELAY_AUTH_SECRET" \
|
||||
--log-level "$LOG_LEVEL" \
|
||||
--log-file console
|
||||
18
netbird-server/rootfs/etc/services.d/signal/run
Normal file
18
netbird-server/rootfs/etc/services.d/signal/run
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs the NetBird Signal service
|
||||
# ==============================================================================
|
||||
|
||||
SIGNAL_LISTEN=$(bashio::config 'signal_listen')
|
||||
LOG_LEVEL=$(bashio::config 'log_level')
|
||||
SIGNAL_PORT="${SIGNAL_LISTEN##*:}"
|
||||
|
||||
bashio::log.info "Starting NetBird Signal on port ${SIGNAL_PORT}..."
|
||||
exec /usr/local/bin/netbird-signal run \
|
||||
--port "$SIGNAL_PORT" \
|
||||
--log-level "$LOG_LEVEL" \
|
||||
--log-file console
|
||||
Reference in New Issue
Block a user