Closed ocafebabe closed 4 months ago
why not. I was changing the app code structure today for more readability and convenience. I think I will have time and can implement this next week.
Hey @ocafebabe
Today, I installed and configured Podman on my local PC. I created a MongoDB container and restored the staging database to this container. It seems like "Monalize" is fully compatible with Podman. I can check all indexes and slow queries. For more information, I think it would be better to give you this:
podman -c podman-machine-default ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a5794c71f3ca docker.io/library/mongo:latest mongod 9 minutes ago Up 9 minutes 0.0.0.0:27017->27017/tcp mongo
As you can see, MongoDB is running in Podman.
My Podman installation used the default Docker socket:
ls -la /var/run/docker.sock
lrwxr-xr-x 1 root daemon 62 Jun 3 12:17 /var/run/docker.sock -> /Users/ku9n/.local/share/containers/podman/machine/podman.sock
Unfortunately, this is my first time using Podman, as I always preferred Docker. Could you check your Podman installation and give me more information about this case?
Thanks!
It seems like we have just one problem with how Podman is working. It's very strange when an additional app still sockets from other apps... I think the best way is to add functionality for setting a custom socket path, and to maintain compatibility between Docker and Podman.
In this PR, you can check that two new flags were added: --socket
and --podman
. "Podman" is a boolean variable that is only used when we want to check a custom log file in a container. The "socket" variable will be used for setting a custom path to the Docker/Podman socket. By default, it is unix:///var/run/docker.sock
, but for Podman it can be unix:///Users/ku9n/.local/share/containers/podman/machine/podman.sock
.
It's very interesting how bash/zsh
interpolates these variables. I found a very strange thing when this command isn't working:
go run monalize.go --db_uri "mongodb://root:sec#$re)t@127.0.0.1:27017/?&authSource=admin" --container server_mongo_for_tests --db_name cb_admin_prod --excel true --socket 'unix:///Users/ku9n/.docker/run/docker.sock'
Output:
Command Line Arguments: [/var/folders/tx/dktdvg_n577fx5dx8zc440sw0000gn/T/go-build1405417362/b001/exe/monalize --db_uri mongodb://root
#)t@127.0.0.1:27017/?&authSource=admin --container server_mongo_for_tests --db_name cb_admin_prod --excel true --socket /Users/ku9n/.docker/run/docker.sock]
Custom Socket Path: unix:///var/run/docker.sock
And this command is working as expected:
go run monalize.go --socket 'unix:///Users/ku9n/.docker/run/docker.sock' --db_uri "mongodb://root:sec#$re)t@127.0.0.1:27017/?&authSource=admin" --container server_mongo_for_tests --db_name cb_admin_prod --excel true
Output:
Command Line Arguments: [/var/folders/tx/dktdvg_n577fx5dx8zc440sw0000gn/T/go-build3211319027/b001/exe/monalize --socket /Users/ku9n/.docker/run/docker.sock --db_uri mongodb://root
#)t@127.0.0.1:27017/?&authSource=admin --container server_mongo_for_tests --db_name cb_admin_prod --excel true]
Custom Socket Path: unix:///Users/ku9n/.docker/run/docker.sock
So, if you have special characters in your password, it's very important to use the socket path before the URI variable. This way, with a very secure password, I'm already tired, so I think it will be better if we find a new, better way for sending variables.
Could you please check this branch with the correct setting for your socket path and let me know about the result?
Hey @ku9nov,
Based on your feedback and after more testing, I was able to make it work "as-is" using the podman-system-service like this:
systemctl --user start podman.socket
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
./monalize --container mongo --db_uri "mongodb://127.0.0.1:27017"
So, no code modification required on your end after all. Sorry about that, I should have done more tests before opening this issue.
Thanks a lot for your help!
Hi,
It would be neat if you could add support for Podman. Because as it is the container option tries to connect to the Docker daemon which of course doesn't exist with rootless podman containers:
Thanks,
C.