-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mosquitto.sh runs native mosquitto #148
mosquitto.sh runs native mosquitto #148
Conversation
Is it not possible to have mosquitto bind a path internal to the docker container? |
Mosquitto can bind a unix socket path internal to the docker container, but tests running in the host MacOS environment need access to that socket path. Using a volume mount is the nominal way to share parts of the host and container filesystems, but a unix socket is not a regular file and cannot be shared between a Linux container and a MacOS host. A unix socket can be shared between a container and a linux host. AFAICT, the only way to enable tests running natively on MacOS to connect to mosquitto via a unix socket will involve running a native mosquitto process on the MacOS host. This change modifies As noted, we could structure this script to continue using the containerized mosquitto approach on Linux hosts where that will work with unix sockets. |
This script was originally written on the understanding mosquitto was running inside Docker and might be running in the background. We can probably remove that and just support running in the foreground now. |
I can make the script just run in the foreground. That would be simpler and would avoid monkeying with a pid file. I'd kind of like to have the option on Linux of running either non-containerized mosquitto or in a container. Perhaps by testing for a I'll update the PR with these changes. Let me know what you think. And thanks again for taking a look at these changes. |
@jpgrayson this all sounds good. |
0849e77
to
03933ce
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
=======================================
Coverage 78.92% 78.92%
=======================================
Files 22 22
Lines 2500 2500
=======================================
Hits 1973 1973
Misses 527 527 ☔ View full report in Codecov by Sentry. |
The goal of mosquitto.sh is to get a mosquitto service up and running so that tests can built and run in the native OS environment. A mosquitto container running on a MacOS host cannot share a unix socket from the Linux container to the MacOS host. Running a native mosquitto instance from mosquitto.sh solves this problem. The native mosquitto process can create/listen a host-compatible unix socket. The script is modified to run a locally installed mosquitto by default, if available, and fallback to running mosquitto in a container. For both the locally installed and containerized paths, the script now just runs in the foreground; no more start/stop/status subcommands.
03933ce
to
45a7bd9
Compare
I am posting this as a possible solution to the problem of how to run tests natively with a mosquitto service.
This changes
scripts/mosquitto.sh
to run a native mosquitto process instead of running mosquitto as a containerized service. This specifically allows mosquitto to create/bind a unix socket path that is available to natively running tests.This is the best way forward I am seeing to enable tests running natively on MacOS to support unix sockets. But I also appreciate that it's a very different paradigm.
The container based approach works on Linux; i.e. a container can share a unix socket to a Linux host. So
mosquitto.sh
could be written to use containers on Linux and only use a native mosquitto process on MacOS. Let me know if that alternative seems right.