Closed vitaliy-guliy closed 5 years ago
@vitaliy-guliy Actually, you already are able to expose containers ports with dockerimage
tool type. See https://redhat-developer.github.io/devfile/#tools endpoint field. And then Workspace API will have information about exposed endpoint as a server of the machine in runtime.
But if you need multiple containers, then (for time being) you have to use kubernetes/openshift tool where it is possible. And in this case, you are able to define Kubernetes Services/Ingresses, OpenShift Routes for exposing your containers ports BUT Workspace API server won't expose URLs for such objects. Here is an issue for exposing URLs of such objects https://github.com/eclipse/che/issues/12268.
Anyway, it would be useful to see an example of your use case in the issue description.
Also I include a JSON template to create a Factory which covers my case
{
"v": "4.0",
"name": "remote_plugin_developer",
"workspace": {
"defaultEnv": "default",
"environments": {
"default": {
"machines": {
"ws/dev-plugin": {
"attributes": {
"memoryLimitBytes": "2684354560"
},
"servers": {
"PluginDev": {
"attributes": {},
"port": "10000",
"protocol": "ws"
}
},
"volumes": {
"projects": {
"path": "/projects"
}
},
"installers": [],
"env": {}
},
"ws/dev": {
"attributes": {
"memoryLimitBytes": "2684354560"
},
"servers": {
"TheiaDev": {
"attributes": {},
"port": "3030",
"protocol": "http"
}
},
"volumes": {
"projects": {
"path": "/projects"
}
},
"installers": [],
"env": {}
}
},
"recipe": {
"type": "kubernetes",
"content": "kind: List\nitems:\n - \n apiVersion: v1\n kind: Pod\n metadata:\n name: ws\n spec:\n containers:\n - \n image: 'eclipse/che-theia-dev:nightly'\n name: dev\n resources:\n limits:\n memory: 3072Mi\n - \n image: 'eclipse/che-theia-dev:nightly'\n name: dev-plugin\n resources:\n limits:\n memory: 2560Mi\n",
"contentType": "application/x-yaml"
}
}
},
"projects": [
{
"links": [],
"name": "theia",
"attributes": {},
"type": "blank",
"source": {
"location": "https://github.com/theia-ide/theia.git",
"type": "git",
"parameters": {}
},
"path": "/theia",
"description": "",
"mixins": [],
"problems": []
}
],
"name": "remote_plugin_developer",
"attributes": {
"editor": "org.eclipse.che.editor.theia:1.0.0",
"plugins": "che-machine-exec-plugin:0.0.1"
},
"commands": [],
"links": []
}
}
@vitaliy-guliy could we close it ? as we managed to do it with https://github.com/sunix/devfiles/blob/e4dc471ed71b2f488a98b304ff49117e4304c2ac/che-in-che/che-theia-remote.devfile.yaml ?
@sunix Thanks for sharing a way how you solved this issue with dockerimage tool. I think it makes sense to keep this issue opened since there is no way to make Che Server expose k8s/os tool's container port. I do not know how critical it is, but still, such an issue exists.
OK so maybe rename this issue to be more precise of what is not working :) or create a new issue ? WDYT ?
@sunix I'll modify the current issue.
Issue description is updated. Hope everything is clear enough. Everybody - feel free to modify issue description or ask me missing details.
Thanks @sleshchenko i am not sure to understand the via Che API
.
@sunix Here I mean propagating server URL via Workspace API, like we do with Theia (or any other servers) URL
@sleshchenko via Che API
-> in Che workspace config
or just remove via Che API
WDYT ?
Issues go stale after 180
days of inactivity. lifecycle/stale
issues rot after an additional 7
days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale
in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen
label to avoid stale mode.
Outdated
Show motivation description
With Workspace Config, there is an ability to define that Container exposed some port (with server config entry in machine configuration) and then it is possible to get publicly available URL (powered by Ingress/Route) via Che Server API (it's
Workspace#Runtime#Machines[n]#Servers
). And there are two main reasons why users may want to expose their containers ports with Che Server API:Detailed Theia Dev Use case description
In my use case I need a workspace with Theia editor and two custom containers which I use to launch another instance of Theia and remote plugin. This two containers must have exposed ports. One is for Theia http server, another one is for remote plugin which opens a websocket server. Theia has to know URI to the plugin server which is taken from workspace runtime.
In the Dockerfile I use
kubernetes
tool to describe custom containers. For those containers I need to describe exposes ports 3030 and 10000. Here are my files from which I create my workspace..devfile
dev.yaml