Skip to content
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

Optional skipping of using sudo for Docker on Linux #426

Closed
UniqueTokens opened this issue Oct 18, 2021 · 11 comments
Closed

Optional skipping of using sudo for Docker on Linux #426

UniqueTokens opened this issue Oct 18, 2021 · 11 comments

Comments

@UniqueTokens
Copy link
Contributor

For automated tests, it would be nice if the use of sudo for Docker on Linux could be skipped (because the current user may a member of the docker group). Perhaps as a named parameter for Genie.Deploy.Docker.build(; sudo=false) and Genie.Deploy.Docker.run(; sudo=false) with the default value true?

@AbhimanyuAryan
Copy link
Member

For automated tests, it would be nice if the use of sudo for Docker on Linux could be skipped (because the current user may a member of the docker group). Perhaps as a named parameter for Genie.Deploy.Docker.build(; sudo=false) and Genie.Deploy.Docker.run(; sudo=false) with the default value true?

Noted 👍

@essenciary
Copy link
Member

@UniqueTokens This is now available in v4.4.0 - please try and let me know if it works as expected.

@UniqueTokens
Copy link
Contributor Author

Deploy.Docker.build not working in Genie v4.4.1. DOCKER function is returning a Cmd type instead of the String type.

DOCKER(; sudo::Bool = Sys.islinux()) = `$(sudo ? "sudo " : "")docker`

julia> using Genie
# output omitted
julia> Genie.newapp("DockerTest")
# output omitted
julia> using Genie.Deploy
# output omitted
julia> Deploy.Docker.dockerfile()
# output omitted
julia> Deploy.Docker.build()
┌ Error: 2021-12-02 08:33:11 Can not find sudo docker. Please make sure that sudo docker is installed and accessible.
└ @ Genie.Deploy ~/.julia/packages/Genie/MQlbP/src/Deploy.jl:9
ERROR: IOError: could not spawn `'sudo docker' build --no-cache -t genie .`: no such file or directory (ENOENT)
# output omitted

Maybe this will fix the bug

DOCKER(; sudo::Bool = Sys.islinux()) = sudo ? "sudo docker" : "docker"

@essenciary
Copy link
Member

Hmmm.... I don't have a Linux with me, but on macOS (the non sudo version) worked fine...

@essenciary
Copy link
Member

Oh, need more coffee - I can just pass the sudo argument to force it on macOS too :)

@essenciary
Copy link
Member

Should be fixed in v4.4.2

@UniqueTokens
Copy link
Contributor Author

Primary issue seems be fixed in v4.4.2. But now Deploy.Docker.run() is broken:

julia> Deploy.Docker.run()
ERROR: UndefVarError: System not defined
Stacktrace:
 [1] run()
   @ Genie.Deploy.Docker ~/.julia/packages/Genie/U7ZwI/src/Deploy.jl:92
 [2] top-level scope
   @ REPL[7]:1

System.islinux() should be Sys.islinux()

websockets_hostport::Int = hostport, websockets_containerport::Int = containerport, sudo::Bool = System.islinux())

BTW, how about automated unit tests before the next version is released? ;-)

@essenciary
Copy link
Member

Damn!
We have some 350 unit tests hooked in CI. If you know how to unit test the docker integration (with CI support) please add them, happy to merge them.

@essenciary
Copy link
Member

OK - tagged v4.4.3 - hopefully this is the last of the fixes.

@UniqueTokens
Copy link
Contributor Author

v4.4.3 tested with sudo = false. Works as expected. Thank you very much!

@essenciary
Copy link
Member

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants