Created
January 5, 2022 10:31
-
-
Save l0rd/8aae44187f56ea6be94305023bcef65c to your computer and use it in GitHub Desktop.
NodeJS DevWorkspace using CheTheia next
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: workspace.devfile.io/v1alpha2 | |
kind: DevWorkspaceTemplate | |
metadata: | |
name: theia-ide-nodejs-web-app | |
spec: | |
commands: | |
- id: init-container-command | |
apply: | |
component: remote-runtime-injector | |
events: | |
preStart: | |
- init-container-command | |
components: | |
- name: theia-ide | |
container: | |
image: quay.io/eclipse/che-theia:next | |
env: | |
- name: THEIA_PLUGINS | |
value: local-dir:///plugins | |
- name: HOSTED_PLUGIN_HOSTNAME | |
value: 0.0.0.0 | |
- name: HOSTED_PLUGIN_PORT | |
value: '3130' | |
- name: THEIA_HOST | |
value: 127.0.0.1 | |
volumeMounts: | |
- name: plugins | |
path: /plugins | |
- name: theia-local | |
path: /home/theia/.theia | |
mountSources: true | |
memoryLimit: 512M | |
cpuLimit: 1500m | |
cpuRequest: 100m | |
endpoints: | |
- name: theia | |
attributes: | |
type: main | |
cookiesAuthEnabled: true | |
discoverable: false | |
urlRewriteSupported: true | |
targetPort: 3100 | |
exposure: public | |
secure: false | |
protocol: https | |
- name: webviews | |
attributes: | |
type: webview | |
cookiesAuthEnabled: true | |
discoverable: false | |
unique: true | |
urlRewriteSupported: true | |
targetPort: 3100 | |
exposure: public | |
secure: false | |
protocol: https | |
- name: mini-browser | |
attributes: | |
type: mini-browser | |
cookiesAuthEnabled: true | |
discoverable: false | |
unique: true | |
urlRewriteSupported: true | |
targetPort: 3100 | |
exposure: public | |
secure: false | |
protocol: https | |
- name: theia-dev | |
attributes: | |
type: ide-dev | |
discoverable: false | |
urlRewriteSupported: true | |
targetPort: 3130 | |
exposure: public | |
protocol: http | |
- name: theia-redirect-1 | |
attributes: | |
discoverable: false | |
urlRewriteSupported: true | |
targetPort: 13131 | |
exposure: public | |
protocol: http | |
- name: theia-redirect-2 | |
attributes: | |
discoverable: false | |
urlRewriteSupported: true | |
targetPort: 13132 | |
exposure: public | |
protocol: http | |
- name: theia-redirect-3 | |
attributes: | |
discoverable: false | |
urlRewriteSupported: true | |
targetPort: 13133 | |
exposure: public | |
protocol: http | |
- name: terminal | |
attributes: | |
type: collocated-terminal | |
discoverable: false | |
cookiesAuthEnabled: true | |
urlRewriteSupported: true | |
targetPort: 3333 | |
exposure: public | |
secure: false | |
protocol: wss | |
attributes: | |
app.kubernetes.io/component: che-theia | |
app.kubernetes.io/part-of: che-theia.eclipse.org | |
- name: plugins | |
volume: {} | |
- name: theia-local | |
volume: {} | |
- name: che-machine-exec | |
container: | |
image: quay.io/eclipse/che-machine-exec:next | |
command: | |
- /go/bin/che-machine-exec | |
- '--url' | |
- 127.0.0.1:3333 | |
- '--idle-timeout' | |
- 15m | |
memoryLimit: 128Mi | |
memoryRequest: 32Mi | |
cpuLimit: 500m | |
cpuRequest: 30m | |
attributes: | |
app.kubernetes.io/component: machine-exec | |
app.kubernetes.io/part-of: che-theia.eclipse.org | |
- name: remote-runtime-injector | |
container: | |
image: quay.io/eclipse/che-theia-endpoint-runtime-binary:next | |
env: | |
- name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE | |
value: /remote-endpoint/plugin-remote-endpoint | |
- name: REMOTE_ENDPOINT_VOLUME_NAME | |
value: remote-endpoint | |
volumeMounts: | |
- name: plugins | |
path: /plugins | |
- name: remote-endpoint | |
path: /remote-endpoint | |
memoryLimit: 128Mi | |
memoryRequest: 32Mi | |
cpuLimit: 500m | |
cpuRequest: 30m | |
attributes: | |
app.kubernetes.io/component: remote-runtime-injector | |
app.kubernetes.io/part-of: che-theia.eclipse.org | |
- name: remote-endpoint | |
volume: | |
ephemeral: true | |
--- | |
apiVersion: workspace.devfile.io/v1alpha2 | |
kind: DevWorkspace | |
metadata: | |
name: nodejs-web-app | |
spec: | |
started: true | |
routingClass: che | |
template: | |
components: | |
- name: nodejs | |
container: | |
image: quay.io/devfile/universal-developer-image:ubi8-b452131 | |
endpoints: | |
- exposure: public | |
name: nodejs | |
protocol: http | |
targetPort: 3000 | |
memoryLimit: 1G | |
mountSources: true | |
env: | |
- name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE | |
value: /remote-endpoint/plugin-remote-endpoint | |
- name: THEIA_PLUGINS | |
value: local-dir:///plugins/sidecars/nodejs | |
volumeMounts: | |
- path: /remote-endpoint | |
name: remote-endpoint | |
- path: /plugins | |
name: plugins | |
args: | |
- sh | |
- '-c' | |
- ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE} | |
attributes: | |
che-theia.eclipse.org/vscode-extensions: | |
- >- | |
https://open-vsx.org/api/vscode/typescript-language-features/1.49.3/file/vscode.typescript-language-features-1.49.3.vsix | |
- >- | |
https://open-vsx.org/api/ms-vscode/js-debug/1.52.2/file/ms-vscode.js-debug-1.52.2.vsix | |
app.kubernetes.io/name: nodejs | |
- name: theia-ide-nodejs-web-app | |
plugin: | |
kubernetes: | |
name: theia-ide-nodejs-web-app | |
commands: | |
- id: dependencies | |
exec: | |
label: Download dependencies | |
component: nodejs | |
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app | |
commandLine: npm install | |
group: | |
kind: build | |
isDefault: true | |
- id: runapp | |
exec: | |
label: Run the web app | |
component: nodejs | |
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app | |
commandLine: nodemon app.js | |
group: | |
kind: run | |
- id: debug | |
exec: | |
label: Run the web app (debugging enabled) | |
component: nodejs | |
workingDir: ${PROJECTS_ROOT}/web-nodejs-sample/app | |
commandLine: nodemon --inspect app.js | |
group: | |
kind: debug | |
isDefault: true | |
- id: stopapp | |
exec: | |
label: Stop the web app | |
component: nodejs | |
commandLine: >- | |
node_server_pids=$(pgrep -fx '.*nodemon (--inspect )?app.js' | tr | |
"\\n" " ") && echo "Stopping node server with PIDs: | |
${node_server_pids}" && kill -15 ${node_server_pids} &>/dev/null && | |
echo 'Done.' | |
group: | |
kind: run | |
projects: | |
- name: web-nodejs-sample | |
zip: | |
location: 'https://eclipse-che.github.io/che-devfile-registry/main/resources/v2/web-nodejs-sample.zip' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment