diff --git a/docker-compose.yml b/docker-compose.yml index 2ecba03..21049d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,18 +12,15 @@ services: container_name: meshcore-bot restart: unless-stopped - # Device access for serial ports - # NOTE: Docker Desktop on macOS does NOT support device passthrough - # Options for macOS: - # 1. Use TCP connection (if device supports it) - configure in config.ini - # 2. Use a serial-to-TCP bridge (e.g., socat) on the host - # 3. Run the bot natively on macOS instead of Docker - # For Linux: Uncomment and adjust device path below + # Device access for serial ports (Linux) + # Uncomment and adjust if using serial connection # devices: # - /dev/ttyUSB0:/dev/ttyUSB0 # Network mode for host access (needed for BLE and some serial setups) # Uncomment if you need host network access + # NOTE: On some ARM devices (Orange Pi, Raspberry Pi) with Docker bridge networking issues, + # you may need to uncomment this to bypass bridge networking # network_mode: host # Environment variables (optional, can override config.ini settings) @@ -44,8 +41,8 @@ services: # Port mappings (if web viewer is enabled) # Uncomment and adjust if using web viewer - ports: - - "8082:8080" + # ports: + # - "8080:8080" # Logging configuration logging: diff --git a/docker-setup.sh b/docker-setup.sh index 245cbee..43cf8d7 100755 --- a/docker-setup.sh +++ b/docker-setup.sh @@ -217,13 +217,24 @@ fi # Update config.ini with serial device if found if [ -n "$SERIAL_DEVICE" ]; then if [[ "$PLATFORM" == "Linux" ]] && [[ "$SERIAL_DEVICE" == /dev/serial/by-id/* ]]; then - # On Linux with by-id path, use it directly in config (more stable) + # On Linux with by-id path, resolve to actual device for Docker compatibility + # Docker containers may not resolve symlinks correctly, so use the actual device + ACTUAL_DEVICE=$(readlink -f "$SERIAL_DEVICE" 2>/dev/null || echo "") + if [ -n "$ACTUAL_DEVICE" ] && [ -e "$ACTUAL_DEVICE" ]; then + # Use actual device path for better Docker compatibility + update_config "Connection" "serial_port" "$ACTUAL_DEVICE" + echo "✓ Updated config.ini with serial port: $ACTUAL_DEVICE" + echo " (resolved from $SERIAL_DEVICE)" + else + # Fallback to by-id path if resolution fails + update_config "Connection" "serial_port" "$SERIAL_DEVICE" + echo "✓ Updated config.ini with serial port: $SERIAL_DEVICE" + echo " ⚠️ Note: If Docker can't access this symlink, use the actual device path" + fi + elif [[ "$PLATFORM" == "Linux" ]]; then + # On Linux, use the device path directly update_config "Connection" "serial_port" "$SERIAL_DEVICE" echo "✓ Updated config.ini with serial port: $SERIAL_DEVICE" - elif [[ "$PLATFORM" == "Linux" ]]; then - # On Linux, use the Docker mapped path in config - update_config "Connection" "serial_port" "$DOCKER_DEVICE_PATH" - echo "✓ Updated config.ini with serial port: $DOCKER_DEVICE_PATH (mapped from $SERIAL_DEVICE)" else # macOS: just note it, but user needs to handle differently update_config "Connection" "serial_port" "$SERIAL_DEVICE"