mirror of
https://github.com/unraid/api.git
synced 2026-05-08 08:00:19 -05:00
refactor(install): add debugging to install process
- Remove redundant log file handling and display errors directly to users - Add debug information for troubleshooting installation issues <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved installation and verification scripts to display output and error messages directly to the user, rather than writing to a log file. * Enhanced error messages to provide clearer instructions when issues occur during installation or verification. * **New Features** * Added detailed debug output during the API service startup to assist with troubleshooting. * **Chores** * Updated script environments and streamlined directory creation for improved reliability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -331,8 +331,7 @@ exit 0
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
SCRIPTS_DIR="/usr/local/share/dynamix.unraid.net/install/scripts"
|
SCRIPTS_DIR="/usr/local/share/dynamix.unraid.net/install/scripts"
|
||||||
# Log file for debugging
|
# Log file for debugging
|
||||||
LOGFILE="/var/log/unraid-api/dynamix-unraid-install.log"
|
mkdir -p "/var/log/unraid-api"
|
||||||
mkdir -p "$(dirname "$LOGFILE")"
|
|
||||||
|
|
||||||
echo "Starting Unraid Connect installation..."
|
echo "Starting Unraid Connect installation..."
|
||||||
|
|
||||||
@@ -344,26 +343,26 @@ CFG_NEW=/boot/config/plugins/dynamix.my.servers
|
|||||||
# Setup the API (but don't start it yet)
|
# Setup the API (but don't start it yet)
|
||||||
if [ -x "$SCRIPTS_DIR/setup_api.sh" ]; then
|
if [ -x "$SCRIPTS_DIR/setup_api.sh" ]; then
|
||||||
echo "Setting up Unraid API..."
|
echo "Setting up Unraid API..."
|
||||||
echo "Running setup_api.sh" >> "$LOGFILE"
|
echo "Running setup_api.sh"
|
||||||
# Capture output and add to log file
|
# Run and show output to user
|
||||||
setup_output=$("$SCRIPTS_DIR/setup_api.sh")
|
"$SCRIPTS_DIR/setup_api.sh"
|
||||||
echo "$setup_output" >> "$LOGFILE"
|
|
||||||
else
|
else
|
||||||
echo "ERROR: setup_api.sh not found or not executable" >> "$LOGFILE"
|
echo "ERROR: setup_api.sh not found or not executable"
|
||||||
|
echo "ERROR: setup_api.sh not found or not executable"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run post-installation verification
|
# Run post-installation verification
|
||||||
if [ -x "$SCRIPTS_DIR/verify_install.sh" ]; then
|
if [ -x "$SCRIPTS_DIR/verify_install.sh" ]; then
|
||||||
echo "Running post-installation verification..."
|
echo "Running post-installation verification..."
|
||||||
echo "Running verify_install.sh" >> "$LOGFILE"
|
echo "Running verify_install.sh"
|
||||||
# Capture output and add to log file
|
# Run and show output to user
|
||||||
verify_output=$("$SCRIPTS_DIR/verify_install.sh")
|
"$SCRIPTS_DIR/verify_install.sh"
|
||||||
echo "$verify_output" >> "$LOGFILE"
|
|
||||||
else
|
else
|
||||||
echo "ERROR: verify_install.sh not found or not executable" >> "$LOGFILE"
|
echo "ERROR: verify_install.sh not found or not executable"
|
||||||
|
echo "ERROR: verify_install.sh not found or not executable"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installation completed at $(date)" >> "$LOGFILE"
|
echo "Installation completed at $(date)"
|
||||||
]]>
|
]]>
|
||||||
</INLINE>
|
</INLINE>
|
||||||
</FILE>
|
</FILE>
|
||||||
@@ -379,6 +378,18 @@ echo "Installation completed at $(date)" >> "$LOGFILE"
|
|||||||
/etc/rc.d/rc.unraid-api cleanup-dependencies
|
/etc/rc.d/rc.unraid-api cleanup-dependencies
|
||||||
|
|
||||||
echo "Starting Unraid API service"
|
echo "Starting Unraid API service"
|
||||||
|
echo "DEBUG: Checking PATH: $PATH"
|
||||||
|
echo "DEBUG: Checking if unraid-api files exist:"
|
||||||
|
ls -la /usr/local/unraid-api/dist/
|
||||||
|
echo "DEBUG: Checking symlink:"
|
||||||
|
ls -la /usr/local/bin/unraid-api
|
||||||
|
echo "DEBUG: Checking Node.js version:"
|
||||||
|
node --version
|
||||||
|
echo "DEBUG: Checking if cli.js is executable:"
|
||||||
|
ls -la /usr/local/unraid-api/dist/cli.js
|
||||||
|
echo "DEBUG: Attempting to run unraid-api directly:"
|
||||||
|
/usr/local/unraid-api/dist/cli.js version || echo "Direct execution failed"
|
||||||
|
|
||||||
echo "If no additional messages appear within 30 seconds, it is safe to refresh the page."
|
echo "If no additional messages appear within 30 seconds, it is safe to refresh the page."
|
||||||
/etc/rc.d/rc.unraid-api plugins add unraid-api-plugin-connect -b --no-restart
|
/etc/rc.d/rc.unraid-api plugins add unraid-api-plugin-connect -b --no-restart
|
||||||
/etc/rc.d/rc.unraid-api start
|
/etc/rc.d/rc.unraid-api start
|
||||||
|
|||||||
+2
-5
@@ -1,10 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# Unraid API Installation Verification Script
|
# Unraid API Installation Verification Script
|
||||||
# Checks that critical files are installed correctly
|
# Checks that critical files are installed correctly
|
||||||
|
|
||||||
# Exit on errors
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Performing comprehensive installation verification..."
|
echo "Performing comprehensive installation verification..."
|
||||||
|
|
||||||
# Define critical files to check (POSIX-compliant, no arrays)
|
# Define critical files to check (POSIX-compliant, no arrays)
|
||||||
@@ -171,7 +168,7 @@ if [ $TOTAL_ERRORS -eq 0 ]; then
|
|||||||
else
|
else
|
||||||
printf 'Found %d total errors.\n' "$TOTAL_ERRORS"
|
printf 'Found %d total errors.\n' "$TOTAL_ERRORS"
|
||||||
echo "Installation verification completed with issues."
|
echo "Installation verification completed with issues."
|
||||||
echo "See log file for details: /var/log/unraid-api/dynamix-unraid-install.log"
|
echo "Please review the errors above and contact support if needed."
|
||||||
# We don't exit with error as this is just a verification script
|
# We don't exit with error as this is just a verification script
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user