Run Newt inside the add-on without Docker - v1.1.8
This commit is contained in:
parent
c4b7f4da90
commit
bbfd2398cd
2 changed files with 15 additions and 34 deletions
|
@ -1,7 +1,7 @@
|
||||||
name: "Newt Add-on"
|
name: "Newt Add-on"
|
||||||
version: "1.1.7"
|
version: "1.1.8"
|
||||||
slug: "newt"
|
slug: "newt"
|
||||||
description: "Runs the Newt container inside Home Assistant using Supervisor API"
|
description: "Runs Newt inside Home Assistant OS"
|
||||||
arch:
|
arch:
|
||||||
- amd64
|
- amd64
|
||||||
- armv7
|
- armv7
|
||||||
|
@ -15,9 +15,9 @@ privileged:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- DAC_READ_SEARCH
|
- DAC_READ_SEARCH
|
||||||
options:
|
options:
|
||||||
PANGOLIN_ENDPOINT: "https://example.com"
|
PANGOLIN_ENDPOINT: "https://dash.opland.net"
|
||||||
NEWT_ID: ""
|
NEWT_ID: "your_newt_id"
|
||||||
NEWT_SECRET: ""
|
NEWT_SECRET: "your_newt_secret"
|
||||||
schema:
|
schema:
|
||||||
PANGOLIN_ENDPOINT: "str"
|
PANGOLIN_ENDPOINT: "str"
|
||||||
NEWT_ID: "str"
|
NEWT_ID: "str"
|
||||||
|
@ -25,4 +25,4 @@ schema:
|
||||||
hassio_api: true
|
hassio_api: true
|
||||||
homeassistant_api: true
|
homeassistant_api: true
|
||||||
auth_api: true
|
auth_api: true
|
||||||
hassio_role: "admin"
|
hassio_role: "admin"
|
37
newt/run.sh
37
newt/run.sh
|
@ -1,40 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e # Stop the script on errors
|
set -e # Stop the script on errors
|
||||||
|
|
||||||
echo "🔹 Starting Newt container using Home Assistant OS..."
|
echo "🔹 Starting Newt inside Home Assistant OS..."
|
||||||
|
|
||||||
# Check if Docker is available
|
# Load configuration values
|
||||||
if ! command -v docker &> /dev/null; then
|
|
||||||
echo "❌ ERROR: Docker is NOT available inside Home Assistant OS!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "✅ Docker is available!"
|
|
||||||
|
|
||||||
# Retrieve environment variables
|
|
||||||
PANGOLIN_ENDPOINT=${PANGOLIN_ENDPOINT:-"https://dash.opland.net"}
|
PANGOLIN_ENDPOINT=${PANGOLIN_ENDPOINT:-"https://dash.opland.net"}
|
||||||
NEWT_ID=${NEWT_ID:-"ru32vsg8ls5lx93"}
|
NEWT_ID=${NEWT_ID:-"your_newt_id"}
|
||||||
NEWT_SECRET=${NEWT_SECRET:-"5rbqgpc292989uk9kz52hmypoyz6u9jf7k670fqja8p4un8o"}
|
NEWT_SECRET=${NEWT_SECRET:-"your_newt_secret"}
|
||||||
|
|
||||||
echo "🔹 Environment Variables:"
|
echo "✅ Configuration Loaded:"
|
||||||
echo " PANGOLIN_ENDPOINT=$PANGOLIN_ENDPOINT"
|
echo " PANGOLIN_ENDPOINT=$PANGOLIN_ENDPOINT"
|
||||||
echo " NEWT_ID=$NEWT_ID"
|
echo " NEWT_ID=$NEWT_ID"
|
||||||
echo " NEWT_SECRET=$NEWT_SECRET"
|
echo " NEWT_SECRET=$NEWT_SECRET"
|
||||||
|
|
||||||
# Remove old Newt container if it exists
|
# Run Newt inside the add-on container
|
||||||
if docker ps -a --format '{{.Names}}' | grep -q "newt"; then
|
echo "🔹 Running Newt..."
|
||||||
echo "🔹 Stopping and removing existing Newt container..."
|
/usr/bin/newt --id "$NEWT_ID" --secret "$NEWT_SECRET" --endpoint "$PANGOLIN_ENDPOINT" &
|
||||||
docker stop newt
|
|
||||||
docker rm newt
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the Newt container
|
echo "✅ Newt is running!"
|
||||||
echo "🔹 Starting Newt container..."
|
|
||||||
docker run -d --restart unless-stopped \
|
|
||||||
--name newt \
|
|
||||||
-e PANGOLIN_ENDPOINT="$PANGOLIN_ENDPOINT" \
|
|
||||||
-e NEWT_ID="$NEWT_ID" \
|
|
||||||
-e NEWT_SECRET="$NEWT_SECRET" \
|
|
||||||
fosrl/newt || { echo "❌ ERROR: Failed to start Newt container"; exit 22; }
|
|
||||||
|
|
||||||
echo "✅ Newt container started successfully!"
|
|
||||||
exec tail -f /dev/null # Keep the add-on running
|
exec tail -f /dev/null # Keep the add-on running
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue