question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an ability to expose K8s/OS tool container port in Workspace Runtime

See original GitHub issue

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:

  1. Theia provides UI to get these servers URLs for a user for further using, like their server testing.
  2. Theia itself may need to pick up such exposed port. See Detailed use-case description.

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

specVersion: 0.0.1
name: develop-remote-plugins
projects:
  - name: theia
    source:
      type: git
      location: 'https://github.com/theia-ide/theia.git'
  - name: sample-remote-plugin
    source:
      type: git
      location: 'https://github.com/vitaliy-guliy/sample-remote-plugin.git'
tools:
  - name: theia-editor
    type: cheEditor
    id: org.eclipse.che.editor.theia:1.0.0
  - name: exec-plugin
    type: chePlugin
    id: che-machine-exec-plugin:0.0.1
  - name: dev
    type: kubernetes
    local: dev.yaml
commands:
  - name: build-plugin
    actions:
      - type: exec
        tool: dev-plugin
        command: cd /projects/sample-remote-plugin && yarn
        workdir: /projects/sample-remote-plugin
  - name: build-theia
    actions:
      - type: exec
        tool: dev
        command: cd /projects/theia && yarn
        workdir: /projects/theia

dev.yaml

---
apiVersion: v1
kind: List
items:
- apiVersion: v1
  kind: Pod
  metadata:
    name: ws
  spec:
    containers:
    - name: dev
      image: eclipse/che-theia-dev:nightly
      resources:
        limits:
          memory: 2048Mi
      volumeMounts:
      - mountPath: /projects
        name: projects
    - name: dev-plugin
      image: eclipse/che-theia-dev:nightly
      resources:
        limits:
          memory: 2048Mi
      volumeMounts:
      - mountPath: /projects
        name: projects
    volumes:
    - name: projects
      persistentVolumeClaim:
        claimName: projects
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: projects
  spec:
    accessModes:
     - ReadWriteOnce
    resources:
      requests:
        storage: 2Gi

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
sunixcommented, Mar 19, 2019

@sleshchenko via Che API -> in Che workspace config or just remove via Che API WDYT ?

0reactions
vitaliy-guliycommented, Sep 23, 2019

Outdated

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Expose or Publish Docker Ports
Add an EXPOSE instruction in the Dockerfile; Use the –expose flag at runtime to expose a port; Use the -p flag or -P...
Read more >
Add "Exposed Ports" to Add container page #698 - GitHub
Sometimes the Dockerfile doesn't specify any exposed ports but it is useful to be able to expose a port at container creation time....
Read more >
Docker Expose Port: What It Means and What It Doesn't Mean
What is docker expose port? How do you use it to allow apps to talk to your Docker container? Here's what it is...
Read more >
PortMapping - Amazon Elastic Container Service
Port mappings allow containers to access ports on the host container instance to send or receive traffic. Port mappings are specified as part...
Read more >
Exposing a port on a live Docker container - Stack Overflow
You cannot do this via Docker, but you can access the container's un-exposed port from the host machine. If you have a container...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found