-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How do I get the service name in my tomcat container #15897
Comments
Unfortunately, there is not really easy way to do it, you can create a feature request, I wonder if we can inject value you need with env var. {
"links":{
"self":"http://che-che.192.168.99.100.nip.io/api/workspace/workspacek5figooh89z74f8t",
"ide":"http://che-che.192.168.99.100.nip.io/che/wksp-voiu",
"environment/statusChannel":"ws://che-che.192.
168.99.100.nip.io/api/websocket",
"environment/outputChannel":"ws://che-che.192.168.99.100.nip.io/api/websocket"
},
"attributes":{
"stackName":"Java Gradle",
"org.eclipse.che.runtimes_id":"runtimesafkyvt3rk
65nd6ql",
"infrastructureNamespace":"che",
"updated":"1580737469057",
"created":"1580737177090"
},
"namespace":"che",
"temporary":false,
"id":"workspacek5figooh89z74f8t",
"status":"RUNNING",
"runtime":{
"machines":{
"gradle":{
"attributes":{
"memoryLimitBytes":"536870912",
"memoryRequestBytes":"536870912",
"component":"gradle",
"source":"recipe"
},
"servers":{
"tomcat":{
"url":"http://servernyb67a6i-gradle-server-8080.192.168.99.100.nip.io/",
"attributes":{
"port":"8080"
},
"status":"UNKNOWN"
}
},
"status":"RUNNING"
},
....
} Devfile I used to get such server info from Che Servermetadata:
name: wksp-voiu
projects:
- name: console-java-simple
source:
location: 'https://github.com/che-samples/console-java-simple.git'
type: git
branch: java1.11
components:
- id: redhat/java11/latest
type: chePlugin
- mountSources: true
endpoints:
- name: tomcat
port: 8080
attributes:
public: 'true'
memoryLimit: 512Mi
type: dockerimage
volumes:
- name: gradle
containerPath: /home/gradle/.gradle
alias: gradle
image: 'quay.io/eclipse/che-java11-gradle:nightly'
env:
- value: /home/gradle/.gradle
name: GRADLE_USER_HOME
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom
name: JAVA_OPTS
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom
name: JAVA_TOOL_OPTIONS
- value: /home/gradle
name: HOME
apiVersion: 1.0.0
commands:
- name: gradle build
actions:
- workdir: '${CHE_PROJECTS_ROOT}/console-java-simple'
type: exec
command: gradle build
component: gradle
- name: gradle run
actions:
- workdir: '${CHE_PROJECTS_ROOT}/console-java-simple'
type: exec
command: gradle run
component: gradle |
@sleshchenko thanks for detailed info |
Hi @sleshchenko , thank you for the nice example ! I noticed that in your devfile:
from the response to
So, if any other external web application (not part of che) running somewhere else in the cloud needs to access the above container's api, can it use the following url ? Should the external web application need to provide access token in order to access this api? Should there be any other information that needs to be part of the http/https request from the external web application? for example, in case the above container supports rest api, can the request from external web app be as follows ? Please advise. |
I believe those questions are answered in the documentation where you can read about it in much more detail than we can afford to provide here in the comments. Please consult https://www.eclipse.org/che/docs/che-7/making-a-workspace-portable-using-a-devfile/ |
Thank you all ! I was able to get the public url as https://... (when i set protocol: 'http' for the endpoint) and open it in a browser and it worked. However, when I try to use the endpoint protocol type as websocket (protocol: 'ws' & secure: 'false'), I get an url like this:
Here is the java websocket client
I get an exception in the call stompClient.connect(). Exception Log:
|
Created new thread here for websocket communication : #16014 |
Hi @sleshchenko. Thank you for your answer. I created a feature request #16096 for this issue. |
Hello,
thanks for the great work with eclipse che. We want to use eclipse che to deploy our own workspace. Part of this workspace is a tomcat container, in which we are planning to run our own app.
This app generates different URLs that make the various app components accessible. The app has an init process to set these URLs. So we need the from eclipse che generated tomcat service name (see image below) before we start the init process.
Is there a possibility to get this name within the tomcat container?
I would appreciate if you could give me some help. Thank you.
The text was updated successfully, but these errors were encountered: