eclipse-archived / codewind

The official repository of the Eclipse Codewind project
https://codewind.dev
Eclipse Public License 2.0
114 stars 44 forks source link

Appsody broken on master branch #683

Closed makandre closed 5 years ago

makandre commented 5 years ago

Codewind version: master OS:

Che version: IDE extension version: IDE version: Kubernetes cluster:

Description:

Currently appsody is broken on master branch. When you you create an appsody project, in the log you'll see:

unning docker command: docker run --rm -P --name cw-knpython-1682c9c0-ef6b-11e9-ae96-1d0b6deac20e --network codewind_network -v /codewind-workspace/knpython/:/project/userapp -v knpython-deps:/project/deps -v /codewind-workspace/.extensions/codewind-appsody-extension/bin/appsody-controller:/appsody/appsody-controller -t --entrypoint /appsody/appsody-controller appsody/python-flask:0.1 --mode=run
[Container] docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/appsody/appsody-controller\": permission denied": unknown.
[Error] Error in 'appsody run': exit status 126

I think it's related to the code below, which is not being guarded by the --remote flag:

https://github.com/eclipse/codewind/commit/abe12b535cd345a5e677af066d0e38dd7d3ca754#diff-7597df0b79304bd2be18940009414316R58

Steps to reproduce:

Workaround:

tobespc commented 5 years ago

@ssh24 Could you take a look at this please ? I've stepped through the code and can't see why its not building

ssh24 commented 5 years ago

@makandre Any idea where the docker run command is being triggered from? Searched the appsody extension but couldn't find it there docker run --rm -P --name cw-knpython-1682c9c0-ef6b-11e9-ae96-1d0b6deac20e --network codewind_network -v /codewind-workspace/knpython/:/project/userapp -v knpython-deps:/project/deps -v /codewind-workspace/.extensions/codewind-appsody-extension/bin/appsody-controller:/appsody/appsody-controller -t --entrypoint /appsody/appsody-controller appsody/python-flask:0.1 --mode=run

makandre commented 5 years ago

It fails because LOCAL_WORKSPACE in the file projectUtils.ts used to be the host system path to codewind-workspace (for example, /opt/Repos/Tempest/codewind/codewind-workspace)

Appsody CLI needs to mount the project folder into their container using this path (they issue the docker command that @ssh24 posted above). So, where it says -v /codewind-workspace/knpython/:/project/userapp above, it should have been -v /opt/Repos/Tempest/codewind/codewind-workspace/knpython/:/project/userapp

Anything that starts with /codewind-workspace is not going to work because that's a PFE relative path, but Appsody talks to the host docker daemon and can only mount using host system paths.

ssh24 commented 5 years ago

Talked with @makandre . Looks like the issue is not on remote mode itself but on non-remote cases. Appsody and probably other projects rely on LOCAL_WORKSPACE in here https://github.com/eclipse/codewind/blob/abe12b535cd345a5e677af066d0e38dd7d3ca754/src/pfe/file-watcher/server/src/projects/projectUtil.ts#L58 so for non-remote cases we should have safeguard to the default value. Will land a PR for the fix soon.

makandre commented 5 years ago

Verified this is ok now. Thanks.