You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/06/17 11:09:26 UTC

[GitHub] [openwhisk-wskdebug] dilox opened a new issue #67: wskdebug inside theia

dilox opened a new issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67


   Hi,
   I am in a similiar situation described here (theia inside docker in docker):
   https://lists.apache.org/thread.html/re234e7b7b0540562d2748a9ba5a2f4da4857de328836d90b7f9d6d95%40%3Cdev.openwhisk.apache.org%3E
   I am trying to use wskdebug inside a container running with
   ```
    -v /var/run/docker.sock:/var/run/docker.sock
   ```
   When I launch the debug inside theia, it tries to connect to localhost, but it fails.
   The correct address should be 172.17.0.1 which is the docker0 network interface on the host.
   This is a screenshot:  
   ![image](https://user-images.githubusercontent.com/10356678/84890098-3b072e80-b09a-11ea-9ff7-6da36c899475.png)
   I tried with different docker configurations with no luck (different -p, --network and privileged) so I think I have to solve on debugger side.
   I am not an npm/nodejs super expert, so before start experiments, I would like to know your opinion about this issue.
   Maybe there is already an option to specify a different host to whick wskdebug connect..
   Can you help me please?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli commented on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
alexkli commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-646502844


   Where exactly do you see the error? What command do you run? The port that fails - is that the debugger failing to connect to the debug port of the container started by openwisk? Where does the debugger run?
   
   —
   
   I think I have seen a similar problem before. Not with wskdebug but another use case of running openwhisk runtime containers locally. This was inside Jenkins, which ran in a container itself.
   
   The solution there was to look at an environment variable that contains the host ip under which exposed ports of containers are “visible”.
   
   AFAICS that is something that has to be passed in as even the docker daemon itself does not know the ip address of the host - at least the docker apis never include a hostname or ip when retrieving the exposed ports.
   
   Hence a solution could be another cli argument with that host ip, if it cannot be retrieved automatically.
   
   Note that the docker logic was just refactored in #61 and will be in the next 1.3.0 release. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli commented on issue #67: support custom docker host IPs (wskdebug inside theia)

Posted by GitBox <gi...@apache.org>.
alexkli commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-658539601


   In #69 I made it use the `DOCKER_HOST_IP` env var if set. This seems to be a commonly used variable name for that purpose. Will be in the next release.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli commented on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
alexkli commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-649229955


   > can you point me where to "patch" the code and say "use 172.17.0.1 instead of 127.0.0.1"?
   
   It should be enough to replace the `0.0.0.0` [here](https://github.com/apache/openwhisk-wskdebug/blob/master/src/invoker.js#L276).
   
   > When do you think to release the refactored version?
   
   I hope to get to a release in the next few weeks. You can try testing current wskdebug master either by doing
   
   ```
   npm install -g https://github.com/apache/openwhisk-wskdebug.git
   ```
   
   Or if you want to poke around in the code locally (just in case you haven't done this before):
   
   ```
   git clone https://github.com/apache/openwhisk-wskdebug.git
   cd openwhisk-wskdebug
   npm install
   npm link
   ```
   
   The latter makes the global `wskdebug` command be symlinked to the local checkout.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] dilox commented on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
dilox commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-650088240


   Yes, it's working with the latest master.
   I only changed
   ```
   this.containerURL = `http://0.0.0.0:${hostRuntimePort}`;
   ```
   with:
   ```
   this.containerURL = `http://172.17.0.1:${hostRuntimePort}`;
   ```
   in invoker.js, then I used the npm commands you provide.
   This is ok for me, so I didn't try other ways to pass/inspect the correct value and I closed the issue.
   Reopening it is not a problem..
   Thanks again, Pierluigi
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] dilox closed issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
dilox closed issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli commented on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
alexkli commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-649807502


   @dilox Since you closed the issue - did you find a way to make it work with the latest master? It sounds like you made a code change. I think it is worthwhile to support this by e.g. reading an environment variable or cli arg with the IP address.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli edited a comment on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
alexkli edited a comment on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-646502844


   Where exactly do you see the error? What command do you run? What is “theia”? The port that fails - is that the debugger failing to connect to the debug port of the container started by openwisk? Where does the debugger run?
   
   —
   
   I think I have seen a similar problem before. Not with wskdebug but another use case of running openwhisk runtime containers locally. This was inside Jenkins, which ran in a container itself.
   
   The solution there was to look at an environment variable that contains the host ip under which exposed ports of containers are “visible”.
   
   AFAICS that is something that has to be passed in as even the docker daemon itself does not know the ip address of the host - at least the docker apis never include a hostname or ip when retrieving the exposed ports.
   
   Hence a solution could be another cli argument with that host ip, if it cannot be retrieved automatically.
   
   Note that the docker logic was just refactored in #61 and will be in the next 1.3.0 release. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] dilox commented on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
dilox commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-646606657


   First of all, thanks for fast reply.
   
   >Where exactly do you see the error? What command do you run? What is “theia”? The port that fails - is that the debugger failing to connect to the debug port of the container started by openwisk? Where does the debugger run?
   
   theia (https://theia-ide.org/) is an editor, very similar to vscode, accessible from the browser. It runs inside docker in the same network (bridge) where openwhisk resides
   wskdebug runs trough a launch.json, similiar to this one:
   ```{
       // Use IntelliSense to learn about possible attributes.
       // Hover to view descriptions of existing attributes.
       // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       "version": "0.2.0",
       "configurations": [
   
           {
               "type": "node",
               "request": "launch",
               "name": "wskdebug",
               "runtimeExecutable": "wskdebug",
               "args": [
                   "echo",
                   "${workspaceFolder}/echo.js",
                   "-l",
                   "-v"
               ],
               "localRoot": "${workspaceFolder}",
               "remoteRoot": "/code",
               "outputCapture": "std"
           }
   ```
   I tried also running wskdebug from inside the theia terminal with the same result.
   This is what I think it happens:
   - wskdebug creates a docker service.
   - wskdebug inspects the new service, finding the host and the port to which connect
   - after 10000 ms it fails to connect since service is binded on the docker network interfaces the volumes share
   
   > I think I have seen a similar problem before. Not with wskdebug but another use case of running openwhisk runtime containers locally. This was inside Jenkins, which ran in a container itself.
   
   Yes I think it is the same situation, docker in docker, the theia conteiners runs with:
   ``` -v /var/run/docker.sock:/var/run/docker.sock ```
   exactly like jenkins does
   
   >The solution there was to look at an environment variable that contains the host ip under which exposed ports of containers are “visible”.
   
   I didn't have this idea, thanks! Can you give me some extra details? Supposing I have the right ip (172.17.0.1), can you point me where to "patch" the code and say "use 172.17.0.1 instead of  127.0.0.1"? (I tried to tweak src/debugger.js, no luck)
   
   >AFAICS that is something that has to be passed in as even the docker daemon itself does not know the ip address of the host - at least the docker apis never include a hostname or ip when retrieving the exposed ports.
   Hence a solution could be another cli argument with that host ip, if it cannot be retrieved automatically.
   Note that the docker logic was just refactored in #61 and will be in the next 1.3.0 release.
   
   This sounds great! When do you think to release the refactored version?
   
   Thanks again, Pierluigi
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] dilox commented on issue #67: wskdebug inside theia

Posted by GitBox <gi...@apache.org>.
dilox commented on issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67#issuecomment-649352230


   Yes, changing hostRuntimePort in invoker.js does the job.
   In my env the value is always 172.17.0.1 and this is fine (I tried to implement a function to inspect the value with no luck, it's working and it's ok)
   Thanks also for clarification about npm
   Pierluigi.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] rabbah closed issue #67: support custom docker host IPs (wskdebug inside theia)

Posted by GitBox <gi...@apache.org>.
rabbah closed issue #67:
URL: https://github.com/apache/openwhisk-wskdebug/issues/67


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org