Add tailscale!
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 35s

This commit is contained in:
Your Name
2025-09-07 22:52:10 +12:00
parent 8e6b00bfee
commit 9aa6168f76
12 changed files with 487 additions and 0 deletions

62
tailscale/status.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# shellcheck disable=SC1091
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME"
# Tailscale Status Script
echo "Tailscale Service Status"
echo "========================"
# Check if container exists
if ! _is_container_exists "$CONTAINER_NAME"; then
echo "Status: Not Installed"
echo "The Tailscale container does not exist."
exit 1
fi
# Check if container is running
if ! _is_container_running "$CONTAINER_NAME"; then
echo "Status: Stopped"
echo "The Tailscale container exists but is not running."
echo ""
echo "To start the service, run:"
echo " ${SERVICE_PATH}/start.sh"
exit 1
fi
echo "Status: Running"
echo ""
# Get Tailscale connection status
echo "Tailscale Connection Status:"
echo "----------------------------"
if docker exec ${CONTAINER_NAME} tailscale status --json >/dev/null 2>&1; then
# Get basic status
docker exec ${CONTAINER_NAME} tailscale status 2>/dev/null || {
echo "Unable to get Tailscale status. The daemon may still be starting."
}
echo ""
echo "Tailscale IP Address:"
docker exec ${CONTAINER_NAME} tailscale ip -4 2>/dev/null || echo "Not connected"
echo ""
echo "Device Name:"
docker exec ${CONTAINER_NAME} tailscale status --json 2>/dev/null | \
docker exec -i ${CONTAINER_NAME} sh -c 'cat | grep -o "\"Self\":{[^}]*}" | grep -o "\"HostName\":\"[^\"]*\"" | cut -d":" -f2 | tr -d "\""' 2>/dev/null || echo "Unknown"
else
echo "Tailscale is running but not yet connected to the network."
echo "This might be normal if the container was just started."
fi
echo ""
echo "Container Information:"
echo "----------------------"
docker ps --filter "name=${CONTAINER_NAME}" --format "table {{.Status}}\t{{.Ports}}"
echo ""
echo "To view detailed logs, run:"
echo " ${SERVICE_PATH}/logs.sh"
exit 0