oppodelldog / droxy Goto Github PK
View Code? Open in Web Editor NEWCreate commands on your machine that proxy docker run / exec calls
License: BSD 3-Clause "New" or "Revised" License
Create commands on your machine that proxy docker run / exec calls
License: BSD 3-Clause "New" or "Revised" License
It would be a nice idea to enable passing an env-file to the container using --env-file
Write a test, where ever you want.
When building up on a template, it might be useful to just add volumes to the template definition.
e.g. having volume bind in a template like
${HOME}:${HOME}
it could be handy to just add a different mapping like
${SSH_AUTH_SOCK}:/run/ssh.sock
Currently the command using the template would have to
add both volumes like:
${HOME}:${HOME}
${SSH_AUTH_SOCK}:/run/ssh.sock
add parameter ip
I tired PHPStorm integration under windows using droxy, but when adding the php interpreter
droxy logs show up an error. Seems to be something with terminal detection under windows.
Here's the log:
PS C:\Users\user\PhpstormProjects\droxy-phpstorm-integration\bin> tail -f .\droxy.log time="2018-04-07T11:04:32+02:00" level=info msg="configuration load from: 'C:\\Users\\user\\PhpstormProjects\\droxy-phpstorm-integration\\bin/droxy.toml'" time="2018-04-07T11:04:32+02:00" level=info time="2018-04-07T11:04:32+02:00" level=info msg="environment variables:" time="2018-04-07T11:04:32+02:00" level=info msg="=::=::\\" time="2018-04-07T11:04:32+02:00" level=info msg="ALLUSERSPROFILE=C:\\ProgramData" time="2018-04-07T11:04:32+02:00" level=info msg="APPDATA=C:\\Users\\user\\AppData\\Roaming" time="2018-04-07T11:04:32+02:00" level=info msg="asl.log=Destination=file" time="2018-04-07T11:04:32+02:00" level=info msg="CommonProgramFiles=C:\\Program Files\\Common Files" time="2018-04-07T11:04:32+02:00" level=info msg="CommonProgramFiles(x86)=C:\\Program Files (x86)\\Common Files" time="2018-04-07T11:04:32+02:00" level=info msg="CommonProgramW6432=C:\\Program Files\\Common Files" time="2018-04-07T11:04:32+02:00" level=info msg="COMPUTERNAME=user-PC" time="2018-04-07T11:04:32+02:00" level=info msg="ComSpec=C:\\WINDOWS\\system32\\cmd.exe" time="2018-04-07T11:04:32+02:00" level=info msg="DOCKER_TOOLBOX_INSTALL_PATH=C:\\Program Files\\Docker Toolbox" time="2018-04-07T11:04:32+02:00" level=info msg="FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer" time="2018-04-07T11:04:32+02:00" level=info msg="FPS_BROWSER_USER_PROFILE_STRING=Default" time="2018-04-07T11:04:32+02:00" level=info msg="FP_NO_HOST_CHECK=NO" time="2018-04-07T11:04:32+02:00" level=info msg="GOPATH=F:\\shared-projects\\go-workspace" time="2018-04-07T11:04:32+02:00" level=info msg="GOROOT=C:\\Go\\" time="2018-04-07T11:04:32+02:00" level=info msg="GTK_BASEPATH=C:\\Program Files (x86)\\GtkSharp\\2.12\\" time="2018-04-07T11:04:32+02:00" level=info msg="HOMEDRIVE=C:" time="2018-04-07T11:04:32+02:00" level=info msg="HOMEPATH=\\Users\\user" time="2018-04-07T11:04:32+02:00" level=info msg="LOCALAPPDATA=C:\\Users\\user\\AppData\\Local" time="2018-04-07T11:04:32+02:00" level=info msg="LOGONSERVER=\\\\user-PC" time="2018-04-07T11:04:32+02:00" level=info msg="MAGICK_CONFIGURE_PATH=C:\\Program Files (x86)\\OpenShot Video Editor\\ImageMagick\\etc\\configuration" time="2018-04-07T11:04:32+02:00" level=info msg="NUMBER_OF_PROCESSORS=4" time="2018-04-07T11:04:32+02:00" level=info msg="OneDrive=C:\\Users\\user\\OneDrive" time="2018-04-07T11:04:32+02:00" level=info msg="OS=Windows_NT" time="2018-04-07T11:04:32+02:00" level=info msg="Path=C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\HashiCorp\\Vagrant\\bin;C:\\Program Files (x86)\\AMD\\ATI.ACE\\Core-Static;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\usr\\bin;C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;F:\\shared-projects\\go-workspace\\bin;C:\\Program Files (x86)\\GtkSharp\\2.12\\bin;c:\\Python27\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Go\\bin;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Program Files\\Docker Toolbox" time="2018-04-07T11:04:32+02:00" level=info msg="PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" time="2018-04-07T11:04:32+02:00" level=info msg="PROCESSOR_ARCHITECTURE=AMD64" time="2018-04-07T11:04:32+02:00" level=info msg="PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel" time="2018-04-07T11:04:32+02:00" level=info msg="PROCESSOR_LEVEL=6" time="2018-04-07T11:04:32+02:00" level=info msg="PROCESSOR_REVISION=3c03" time="2018-04-07T11:04:32+02:00" level=info msg="ProgramData=C:\\ProgramData" time="2018-04-07T11:04:32+02:00" level=info msg="ProgramFiles=C:\\Program Files" time="2018-04-07T11:04:32+02:00" level=info msg="ProgramFiles(x86)=C:\\Program Files (x86)" time="2018-04-07T11:04:32+02:00" level=info msg="ProgramW6432=C:\\Program Files" time="2018-04-07T11:04:32+02:00" level=info msg="PSModulePath=C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\" time="2018-04-07T11:04:32+02:00" level=info msg="PUBLIC=C:\\Users\\Public" time="2018-04-07T11:04:32+02:00" level=info msg="QT_PLUGIN_PATH=C:\\Program Files (x86)\\OpenShot Video Editor\\" time="2018-04-07T11:04:32+02:00" level=info msg="SESSIONNAME=Console" time="2018-04-07T11:04:32+02:00" level=info msg="SystemDrive=C:" time="2018-04-07T11:04:32+02:00" level=info msg="SystemRoot=C:\\WINDOWS" time="2018-04-07T11:04:32+02:00" level=info msg="TEMP=C:\\Users\\user\\AppData\\Local\\Temp" time="2018-04-07T11:04:32+02:00" level=info msg="TMP=C:\\Users\\user\\AppData\\Local\\Temp" time="2018-04-07T11:04:32+02:00" level=info msg="USERDOMAIN=user-PC" time="2018-04-07T11:04:32+02:00" level=info msg="USERDOMAIN_ROAMINGPROFILE=user-PC" time="2018-04-07T11:04:32+02:00" level=info msg="USERNAME=user" time="2018-04-07T11:04:32+02:00" level=info msg="USERPROFILE=C:\\Users\\user" time="2018-04-07T11:04:32+02:00" level=info msg="VBOX_MSI_INSTALL_PATH=C:\\Program Files\\Oracle\\VirtualBox\\" time="2018-04-07T11:04:32+02:00" level=info msg="VS100COMNTOOLS=C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools\\" time="2018-04-07T11:04:32+02:00" level=info msg="VS140COMNTOOLS=C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\" time="2018-04-07T11:04:32+02:00" level=info msg="windir=C:\\WINDOWS" time="2018-04-07T11:04:32+02:00" level=info msg=---------------------------------------------------------------------- time="2018-04-07T11:04:32+02:00" level=info msg="origin arguments:" time="2018-04-07T11:04:32+02:00" level=info msg="C:\\Users\\user\\PhpstormProjects\\droxy-phpstorm-integration\\bin\\php7.2.exe" time="2018-04-07T11:04:32+02:00" level=info msg="C:\\Users\\user\\AppData\\Local\\Temp\\ide-phpinfo.php" time="2018-04-07T11:04:32+02:00" level=info msg=---------------------------------------------------------------------- time="2018-04-07T11:04:32+02:00" level=info msg="calling docker ro tun 'php7.2'" time="2018-04-07T11:04:32+02:00" level=info msg="docker run -t --rm --name php7.2 -v /C/Users/user/AppData/Local/Temp:/C/Users/user/AppData/Local/Temp -v /C/Users/user/PhpstormProjects/droxy-phpstorm-integration:/C/Users/user/PhpstormProjects/droxy-phpstorm-integration -e XDEBUG_CONFIG= -a STDIN -a STDOUT -a STDERR php:7.2 C:\\Users\\user\\AppData\\Local\\Temp\\ide-phpinfo.php" time="2018-04-07T11:04:32+02:00" level=info msg="StdErr:the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'\n" time="2018-04-07T11:04:32+02:00" level=info msg="docker finished with exit code '1'"
Currently if a environment variable is defined to be mapped in toml the command panics id the environment variable is not set at runtime.
This makes sense for debugging the droxy command during developing it, but the reuse of common configuration is more complicated.
So there should be a flag to prevent command from panicing if a environment variable cannot be resolved.
Sample:
[[command]]
name="php7"
image="php7-dbg"
envvars=[
"XDEBUG_CONFIG=${XDEBUG_CONFIG}"
]
if XDEBUG_CONFIG is not set at runtime, thge program panics.
since phpstorm docker integration does not work well it would be nice if droxy could be used
as "local php" from phpstorm.
phpstorm executes the following call for local php debugging:
php -dxdebug.remote_enable=1 \
-dxdebug.remote_mode=req \
-dxdebug.remote_port=9000 \
-dxdebug.remote_host=127.0.0.1 \
index.php
Obviously inside of the container 127.0.0.1 will not be accessible.
So one todo is:
During testing I found that the replacement of the remote_host parameter is not enough.
When appending an additional argument 'xdebug.remote_autostart=1' it works like a charm.
The 'autostart' option is like setting "XDEBUG_SESSION_START=1" in the query string of an url.
So the second todo is:
php -dxdebug.remote_enable=1 \
-dxdebug.remote_mode=req \
-dxdebug.remote_port=9000 \
-dxdebug.remote_host=172.17.0.1 \
-dxdebug.remote_log=xdebug.log \
-dxdebug.remote_timeout=2000 \
-dxdebug.remote_autostart=1 \
index.php
Should not be too much work, there should just be one system call at the moment.
docker-proxy-command automatically sets the -t flag when it detects that the command was started by a terminal. convenience stuff (should be removed if it won't work properly on windows)
For the determination if the command is spawned in a terminal session, I copied some code from the docker-cli, but only the linux part. there should be an appropriate call for windows.
If this does not work out well, we can convert the currently automatically set -t into a configuration option.
to fix go lint warnings, add documentation to all exportet methods and types
add make target to build a release binary.
it should
To startup commands more quickly it might be an option to save time in mounting volumes.
There could be a caching container which mounts volumes.
Other commands can then use the containers volumes by using the --volumes-from option.
Since the caching container will some time get out of sync there should be an option to clear that cache or define a lifetime which then is handled at each run of a proxy command.
Write tests for dockercmd/builder.go
droxy shall reveal itself when called as proxy command.
to enable the user to ensure that a created command is a droxy command, the command shall reveal itself as droxy when called with parameter
--is-it-droxy
can output a simple answer, or the default droxy help message, or version info
add a label to each created container which makes it easier to find droxy created containers using docker commands
droxy\dockercmd\config.go
The part where the configuration is converted into a command using the command builder
is an important path and is currently tested by some module test which output highly depends on the system it is run.
To enable more isolated testing this file shall be refactored. For each configuration option there is the same interface used to call the command builder.
Those logic should be moved to be more generic and by this more testable.
For debugging the logging feature is quite nice.
It would be more nice if the communication between caller and docker-command would be logged.
Somehow one should intercept Stdin,Stdout,Stderr to read communication, write it to the log, and bypass it to the appropriate stream.
enable the --link parameter
remove unused code
I think the docs resp. readme should comment on the option RequireEnvVars
When a running container is reused by calling docker exec, parameter -w is appended which is not allowed. It leads to an error aborting the program.
Must be a version issue, as stated in docs
https://docs.docker.com/engine/reference/commandline/exec/#usage
workdir is available from v1.35+
The fix should consider the docker api version
A template should be able to have a template :-)
For the first release the behavior of how to transform a config into a docker command should be tested.
Find an awesome project name.
the go report card report does look good, but we can get a+.
seems that go lint currently is not configured to run from the make file.
Since docker run works, why not adding docker-compose support?
extend configuration to create docker run commands and docker-compose commands.
add badge to readme to get scoring from https://github.com/gojp/goreportcard
enable mapping ports
❓ ❔ ❗ ❕ ❣️
Automatically mounting the workdir sounds quite convenient.
The use of pointers is required to reflect if the user has set a configuration option or not.
There are already descriptive helper function like hasPropertyXSet but the code using that model often accesses properties directly by *config.commandName having to check.
This should be wrapped into more convenient and meaningful functions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.