mirror of
https://github.com/unraid/api.git
synced 2026-02-17 21:48:34 -06: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[
|
||||
SCRIPTS_DIR="/usr/local/share/dynamix.unraid.net/install/scripts"
|
||||
# Log file for debugging
|
||||
LOGFILE="/var/log/unraid-api/dynamix-unraid-install.log"
|
||||
mkdir -p "$(dirname "$LOGFILE")"
|
||||
mkdir -p "/var/log/unraid-api"
|
||||
|
||||
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)
|
||||
if [ -x "$SCRIPTS_DIR/setup_api.sh" ]; then
|
||||
echo "Setting up Unraid API..."
|
||||
echo "Running setup_api.sh" >> "$LOGFILE"
|
||||
# Capture output and add to log file
|
||||
setup_output=$("$SCRIPTS_DIR/setup_api.sh")
|
||||
echo "$setup_output" >> "$LOGFILE"
|
||||
echo "Running setup_api.sh"
|
||||
# Run and show output to user
|
||||
"$SCRIPTS_DIR/setup_api.sh"
|
||||
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
|
||||
|
||||
# Run post-installation verification
|
||||
if [ -x "$SCRIPTS_DIR/verify_install.sh" ]; then
|
||||
echo "Running post-installation verification..."
|
||||
echo "Running verify_install.sh" >> "$LOGFILE"
|
||||
# Capture output and add to log file
|
||||
verify_output=$("$SCRIPTS_DIR/verify_install.sh")
|
||||
echo "$verify_output" >> "$LOGFILE"
|
||||
echo "Running verify_install.sh"
|
||||
# Run and show output to user
|
||||
"$SCRIPTS_DIR/verify_install.sh"
|
||||
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
|
||||
|
||||
echo "Installation completed at $(date)" >> "$LOGFILE"
|
||||
echo "Installation completed at $(date)"
|
||||
]]>
|
||||
</INLINE>
|
||||
</FILE>
|
||||
@@ -379,6 +378,18 @@ echo "Installation completed at $(date)" >> "$LOGFILE"
|
||||
/etc/rc.d/rc.unraid-api cleanup-dependencies
|
||||
|
||||
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."
|
||||
/etc/rc.d/rc.unraid-api plugins add unraid-api-plugin-connect -b --no-restart
|
||||
/etc/rc.d/rc.unraid-api start
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# Unraid API Installation Verification Script
|
||||
# Checks that critical files are installed correctly
|
||||
|
||||
# Exit on errors
|
||||
set -e
|
||||
|
||||
echo "Performing comprehensive installation verification..."
|
||||
|
||||
# Define critical files to check (POSIX-compliant, no arrays)
|
||||
@@ -171,7 +168,7 @@ if [ $TOTAL_ERRORS -eq 0 ]; then
|
||||
else
|
||||
printf 'Found %d total errors.\n' "$TOTAL_ERRORS"
|
||||
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
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user