Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Add Java Web devfiles #18

Merged
merged 10 commits into from
Jul 16, 2019
76 changes: 76 additions & 0 deletions devfiles/java-mysql/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
apiVersion: 1.0.0
metadata:
name: java-mysql
projects:
-
name: web-java-spring-petclinic
source:
type: git
location: "https://github.com/spring-projects/spring-petclinic.git"
components:
-
type: chePlugin
id: redhat/java/latest
-
type: dockerimage
alias: tools
image: registry.centos.org/che-stacks/centos-jdk8
command: ['sleep']
args: ['infinity']
env:
- name: JAVA_OPTS
value: "-XX:MaxRAMPercentage=50.0 -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
-Duser.home=/home/user"
- name: MAVEN_OPTS
value: $(JAVA_OPTS)
- name: PS1
value: $(echo ${0})\\$
memoryLimit: 512Mi
endpoints:
- name: '8080/tcp'
port: 8080
mountSources: true
volumes:
- name: m2
containerPath: /home/user/.m2
-
type: dockerimage
alias: mysql
image: centos/mysql-57-centos7
env:
- name: MYSQL_USER
value: petclinic
- name: MYSQL_PASSWORD
value: password
- name: MYSQL_DATABASE
value: petclinic
- name: PS1
value: $(echo ${0})\\$
memoryLimit: 256Mi
endpoints:
- name: 'db'
port: 3306
attributes:
discoverable: "true"
public: "false"
mountSources: false
commands:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say command to run server in debug mode is missed.

SPRING_DATASOURCE_URL=jdbc:mysql://db/petclinic SPRING_DATASOURCE_USERNAME=petclinic SPRING_DATASOURCE_PASSWORD=password java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 -jar target/*.jar  --spring.profile.active=mysql

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It's a nice way to improve this and other java stacks, I'm going to merge as is and create a separate issue to improve it. I think except Debug it also needs command to stop the application, because probably user starts his app, sees that something is wrong, stops app and rerun it in debug mode.

-
name: maven build
actions:
-
type: exec
component: tools
command: "./mvnw clean install"
workdir: "${CHE_PROJECTS_ROOT}/web-java-spring-petclinic"
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
- name: run webapp
actions:
-
type: exec
component: tools
command: |
SPRING_DATASOURCE_URL=jdbc:mysql://db/petclinic SPRING_DATASOURCE_USERNAME=petclinic SPRING_DATASOURCE_PASSWORD=password java -jar target/*.jar --spring.profile.active=mysql
workdir: ${CHE_PROJECTS_ROOT}/web-java-spring-petclinic
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions devfiles/java-mysql/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
displayName: Java MySQL
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
description: Default Java MySQL
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
tags: ["Java", "Maven", "Spring Boot v2", "MySQL"]
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
globalMemoryLimit: 2930Mi
54 changes: 54 additions & 0 deletions devfiles/java-web-spring/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: 1.0.0
metadata:
name: java-web-spring
projects:
-
name: java-web-spring
source:
type: git
location: "https://github.com/spring-projects/spring-petclinic.git"
components:
-
type: chePlugin
id: redhat/java/latest
-
type: dockerimage
alias: tools
image: registry.centos.org/che-stacks/centos-jdk8
command: ['sleep']
args: ['infinity']
env:
- name: JAVA_OPTS
value: "-XX:MaxRAMPercentage=50.0 -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
-Duser.home=/home/user"
- name: MAVEN_OPTS
value: $(JAVA_OPTS)
- name: PS1
value: $(echo ${0})\\$
memoryLimit: 1024Mi
endpoints:
- name: '8080/tcp'
port: 8080
mountSources: true
volumes:
- name: m2
containerPath: /home/user/.m2
commands:
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
-
name: maven build
actions:
-
type: exec
component: tools
command: "./mvnw clean install"
workdir: ${CHE_PROJECTS_ROOT}/java-web-spring
- name: run webapp
actions:
-
type: exec
component: tools
command: "java -jar target/*.jar"
workdir: ${CHE_PROJECTS_ROOT}/java-web-spring
6 changes: 6 additions & 0 deletions devfiles/java-web-spring/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
displayName: Java Web Spring
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
description: Default Java Spring Stack
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
tags: ["Java", "Maven", "Spring Boot v2"]
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
globalMemoryLimit: 2674Mi
65 changes: 65 additions & 0 deletions devfiles/java-web-vertx/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
apiVersion: 1.0.0
metadata:
name: java-web-vertx
projects:
-
name: java-web-vertx
source:
type: git
location: "https://github.com/che-samples/web-java-vertx"
components:
-
type: chePlugin
id: redhat/java/latest
-
type: dockerimage
alias: maven
image: registry.centos.org/che-stacks/centos-jdk8
command: ['sleep']
args: ['infinity']
env:
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
- name: MAVEN_CONFIG
value: /home/user/.m2
- name: MAVEN_OPTS
value: "-XX:MaxRAMPercentage=50.0 -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
-Duser.home=/home/user"
- name: JAVA_OPTS
value: "-XX:MaxRAMPercentage=50.0 -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: "-XX:MaxRAMPercentage=50.0 -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: PS1
value: $(echo ${0})\\$
- name: HOME
value: /home/user
memoryLimit: 512Mi
endpoints:
- name: '8080/tcp'
port: 8080
mountSources: true
volumes:
- name: m2
containerPath: /home/user/.m2
commands:
-
name: maven build
actions:
-
type: exec
component: maven
command: "mvn -Duser.home=${HOME} clean install"
workdir: "${CHE_PROJECTS_ROOT}/java-web-vertx"
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
-
name: run app
actions:
-
type: exec
component: maven
command: "JDBC_URL=jdbc:h2:/tmp/db java -jar ./target/*fat.jar"
workdir: "${CHE_PROJECTS_ROOT}/java-web-vertx"
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions devfiles/java-web-vertx/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
displayName: Vertx Web
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
description: Default Vertx Web Stack
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
tags: ["Java", "Maven", "Spring Boot v2", "Vertx"]
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
globalMemoryLimit: 2674Mi