hotfix for telemetry hotfix for profiles config
This commit is contained in:
+17
-4
@@ -56,10 +56,23 @@ setup_alacritty() {
|
||||
|
||||
# Start socktop agent
|
||||
start_socktop_agent() {
|
||||
echo "Starting socktop-agent on port 3000..."
|
||||
echo "Starting socktop-agent on port 3001..."
|
||||
|
||||
# Don't start the agent here - supervisor will handle it
|
||||
echo "socktop-agent will be started by supervisor"
|
||||
# Start socktop-agent in the background on port 3001
|
||||
/usr/bin/socktop_agent --port 3001 > /tmp/socktop-agent.log 2>&1 &
|
||||
AGENT_PID=$!
|
||||
|
||||
echo "socktop-agent started (PID: $AGENT_PID)"
|
||||
|
||||
# Give it a moment to start
|
||||
sleep 1
|
||||
|
||||
# Check if it's running
|
||||
if kill -0 $AGENT_PID 2>/dev/null; then
|
||||
echo " ✓ socktop-agent is running on port 3001"
|
||||
else
|
||||
echo " ⚠ socktop-agent may have failed to start (check /tmp/socktop-agent.log)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main initialization
|
||||
@@ -82,7 +95,7 @@ main() {
|
||||
echo ""
|
||||
echo "Services:"
|
||||
echo " - Webterm: http://localhost:8082"
|
||||
echo " - Socktop Agent: localhost:3001"
|
||||
echo " - Socktop Agent: ws://localhost:3001/ws"
|
||||
echo ""
|
||||
|
||||
# Execute the main command
|
||||
|
||||
+25
-9
@@ -13,9 +13,18 @@ echo "==================================="
|
||||
SOCKTOP_HOME=$(eval echo ~socktop)
|
||||
echo "Socktop HOME: ${SOCKTOP_HOME}"
|
||||
|
||||
# Create necessary directories in the actual HOME
|
||||
mkdir -p "${SOCKTOP_HOME}/.config/socktop/certs"
|
||||
mkdir -p "${SOCKTOP_HOME}/.config/alacritty"
|
||||
# Check if we're running as root
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
echo "Running as root, will set permissions"
|
||||
# Create necessary directories in the actual HOME
|
||||
mkdir -p "${SOCKTOP_HOME}/.config/socktop/certs"
|
||||
mkdir -p "${SOCKTOP_HOME}/.config/alacritty"
|
||||
else
|
||||
echo "Running as non-root user ($(id -u)), creating directories without root"
|
||||
# Try to create directories - will work if HOME is writable
|
||||
mkdir -p "${SOCKTOP_HOME}/.config/socktop/certs" 2>/dev/null || echo " ⚠ Could not create directories (may already exist)"
|
||||
mkdir -p "${SOCKTOP_HOME}/.config/alacritty" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Copy files from mounted locations to actual HOME if they exist
|
||||
echo "Copying configuration files..."
|
||||
@@ -56,8 +65,11 @@ else
|
||||
echo " ℹ No certificates directory found (optional)"
|
||||
fi
|
||||
|
||||
# Set proper ownership
|
||||
chown -R socktop:socktop "${SOCKTOP_HOME}/.config"
|
||||
# Set proper ownership (only if running as root)
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
chown -R socktop:socktop "${SOCKTOP_HOME}/.config"
|
||||
echo " ✓ Set ownership to socktop:socktop"
|
||||
fi
|
||||
|
||||
# Fix paths in profiles.json if it exists
|
||||
if [ -f "${SOCKTOP_HOME}/.config/socktop/profiles.json" ]; then
|
||||
@@ -70,7 +82,11 @@ fi
|
||||
echo "==================================="
|
||||
echo "Configuration initialization complete"
|
||||
echo "==================================="
|
||||
echo "Switching to socktop user..."
|
||||
|
||||
# Switch to socktop user and execute the main command
|
||||
exec runuser -u socktop -- "$@"
|
||||
# Switch to socktop user only if running as root
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
echo "Switching to socktop user..."
|
||||
exec runuser -u socktop -- "$@"
|
||||
else
|
||||
echo "Already running as non-root user ($(whoami)), continuing..."
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user