jantman / python-wifi-survey-heatmap

A Python application for Linux machines to perform WiFi site surveys and present the results as a heatmap overlayed on a floorplan
GNU Affero General Public License v3.0
375 stars 88 forks source link

running under Docker in macOS with X11 #31

Closed PaulWieland closed 4 months ago

PaulWieland commented 9 months ago

Feature Request

Feature Description

Support for running under macOS with XQuartz (X11 window system for macOS)

Installation Method

I'm attempting to run in docker under macOS 14.1.2 with XQuartz.

$docker run   --net="host"   --privileged   --name survey   -it   --rm   -v $(pwd):/pwd   -w /pwd   -e DISPLAY=$DISPLAY   -v "$HOME/.Xauthority:/root/.Xauthority:ro"   jantman/python-wifi-survey-heatmap   wifi-survey -b DeckAP -i en0 -s 10.0.1.3 -p main_floor.png -t main_floor

Unable to access the X Display, is $DISPLAY set properly?

$ echo $DISPLAY

/private/tmp/com.apple.launchd.OoSO3ahrXN/org.xquartz:0

Testing Assistance

Yes, I can test.

jantman commented 9 months ago

@PaulWieland Thanks for submitting this. Just as a heads up I don't use Mac, so I'm not really sure how much I can do for this. One guess, though, is that /private/tmp/com.apple.launchd.OoSO3ahrXN/org.xquartz is either a file or pipe/device, which maybe needs to be mounted in to the container?

I'd really need someone who knows more about Mac, and XQuartz specifically, to assist on this...

PaulWieland commented 9 months ago

I have experience with docker, iperf, and some with python but none with python + x11. Is there a basic hello world example you could offer that I can use to figure out if python can interact with x11 under macOS?

PaulWieland commented 9 months ago

I can natively run this program

import wx

app = wx.App()
window = wx.Frame(None, title = "wxPython Frame", size = (300,200))
panel = wx.Panel(window)
label = wx.StaticText(panel, label = "Hello World", pos = (100,50))
window.Show(True)
app.MainLoop()

and it correctly renders an X11 window.

Now to test under docker (or mount the $DISPLAY path in docker)

PaulWieland commented 9 months ago

Mapped the display property like this:

docker run  \
    --net="host" \
    --privileged \
    --name survey \
    -it \
    --rm \
    -v $(pwd):/pwd \
        -v $(DISPLAY):/tmp/display \
    -w /pwd \
    -e DISPLAY=/tmp/display \
    -v "$HOME/.Xauthority:/root/.Xauthority:ro" \
    jantman/python-wifi-survey-heatmap \
    wifi-survey -b DeckAP -i en0 -s 10.0.1.3 -p main_floor.png -t main_floor

However it produces these errors which I haven't yet chased down:

DISPLAY: delegate library support not built-in '' (X11) @ error/display.c/DisplayImageCommand/1901.
docker: invalid reference format: repository name must be lowercase.

The docker error might be a simple syntax problem. The DISPLAY error might be more serious, but so far the only pages Ive found are related to Imagemagick which is unrelated afaik.

hnykda commented 4 months ago

I wasn't able to make it work on Mac, so I rewrote it here: https://github.com/hnykda/wifi-heatmapper

jantman commented 4 months ago

Cool, thanks so much @hnykda ! I've updated the README to add a section on OS support and link to your project.

hnykda commented 4 months ago

Thank you for your work!