mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 21:04:05 +02:00
Simplify NetBird server quickstart addon
This commit is contained in:
24
netbird-server/rootfs/etc/services.d/caddy/run
Normal file
24
netbird-server/rootfs/etc/services.d/caddy/run
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs Caddy reverse proxy
|
||||
# ==============================================================================
|
||||
|
||||
DATA_DIR="/config/netbird"
|
||||
CADDYFILE="${DATA_DIR}/Caddyfile"
|
||||
|
||||
if [[ ! -f "$CADDYFILE" ]]; then
|
||||
bashio::log.error "Missing Caddyfile at ${CADDYFILE}."
|
||||
bashio::exit.nok
|
||||
fi
|
||||
|
||||
export XDG_DATA_HOME="${DATA_DIR}/caddy/data"
|
||||
export XDG_CONFIG_HOME="${DATA_DIR}/caddy/config"
|
||||
|
||||
mkdir -p "$XDG_DATA_HOME" "$XDG_CONFIG_HOME"
|
||||
|
||||
bashio::log.info "Starting Caddy..."
|
||||
exec caddy run --config "$CADDYFILE" --adapter caddyfile
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs Coturn
|
||||
# ==============================================================================
|
||||
|
||||
DATA_DIR="/config/netbird"
|
||||
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
|
||||
@@ -7,46 +7,17 @@ set -euo pipefail
|
||||
# Runs the NetBird Dashboard
|
||||
# ==============================================================================
|
||||
|
||||
DOMAIN="localhost"
|
||||
EXTERNAL_BASE_URL=""
|
||||
MANAGEMENT_LISTEN="0.0.0.0:33073"
|
||||
AUTH_AUTHORITY=""
|
||||
AUTH_CLIENT_ID=""
|
||||
AUTH_CLIENT_SECRET=""
|
||||
AUTH_AUDIENCE=""
|
||||
AUTH_SUPPORTED_SCOPES="openid profile email api offline_access email_verified"
|
||||
USE_AUTH0="false"
|
||||
NETBIRD_MGMT_API_ENDPOINT=""
|
||||
|
||||
MANAGEMENT_PORT="${MANAGEMENT_LISTEN##*:}"
|
||||
|
||||
ENV_FILE="/config/netbird/dashboard/env"
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
. "$ENV_FILE"
|
||||
set +a
|
||||
fi
|
||||
|
||||
if [[ -n "$NETBIRD_MGMT_API_ENDPOINT" ]]; then
|
||||
NETBIRD_MGMT_API_ENDPOINT="$NETBIRD_MGMT_API_ENDPOINT"
|
||||
elif [[ -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}"
|
||||
bashio::log.error "Missing dashboard env file at ${ENV_FILE}."
|
||||
bashio::exit.nok
|
||||
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
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ set -euo pipefail
|
||||
DATA_DIR="/config/netbird"
|
||||
LOG_LEVEL="info"
|
||||
MANAGEMENT_CONFIG="$DATA_DIR/management/management.json"
|
||||
MANAGEMENT_PORT=8081
|
||||
|
||||
if [[ ! -f "$MANAGEMENT_CONFIG" ]]; then
|
||||
bashio::log.error "Missing management configuration at ${MANAGEMENT_CONFIG}."
|
||||
@@ -19,5 +20,10 @@ fi
|
||||
bashio::log.info "Starting NetBird Management..."
|
||||
exec /usr/local/bin/netbird-mgmt management \
|
||||
--config "$MANAGEMENT_CONFIG" \
|
||||
--port "$MANAGEMENT_PORT" \
|
||||
--log-level "$LOG_LEVEL" \
|
||||
--log-file console
|
||||
--log-file console \
|
||||
--disable-anonymous-metrics=false \
|
||||
--single-account-mode-domain=netbird.selfhosted \
|
||||
--dns-domain=netbird.selfhosted \
|
||||
--idp-sign-key-refresh-enabled
|
||||
|
||||
@@ -4,17 +4,20 @@ set -euo pipefail
|
||||
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: NetBird Server
|
||||
# Runs the NetBird Relay (optional)
|
||||
# Runs the NetBird Relay (includes embedded STUN)
|
||||
# ==============================================================================
|
||||
|
||||
LOG_LEVEL="info"
|
||||
RELAY_EXPOSED_ADDRESS=""
|
||||
RELAY_AUTH_SECRET=""
|
||||
RELAY_ENV_FILE="/config/netbird/relay/relay.env"
|
||||
|
||||
if [[ -f "$RELAY_ENV_FILE" ]]; then
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
. "$RELAY_ENV_FILE"
|
||||
set +a
|
||||
else
|
||||
bashio::log.error "Missing relay env file at ${RELAY_ENV_FILE}."
|
||||
bashio::exit.nok
|
||||
fi
|
||||
|
||||
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
|
||||
exec /usr/local/bin/netbird-relay
|
||||
|
||||
@@ -7,9 +7,8 @@ set -euo pipefail
|
||||
# Runs the NetBird Signal service
|
||||
# ==============================================================================
|
||||
|
||||
SIGNAL_LISTEN="0.0.0.0:10000"
|
||||
SIGNAL_PORT=8083
|
||||
LOG_LEVEL="info"
|
||||
SIGNAL_PORT="${SIGNAL_LISTEN##*:}"
|
||||
|
||||
bashio::log.info "Starting NetBird Signal on port ${SIGNAL_PORT}..."
|
||||
exec /usr/local/bin/netbird-signal run \
|
||||
|
||||
Reference in New Issue
Block a user