Skip to content

Instantly share code, notes, and snippets.

@svor
Created February 1, 2023 13:38
Show Gist options
  • Save svor/0c0117941540924c0d967cd618f9c3f8 to your computer and use it in GitHub Desktop.
Save svor/0c0117941540924c0d967cd618f9c3f8 to your computer and use it in GitHub Desktop.
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspaceTemplate
metadata:
name: che-idea-spring-petclinic
spec:
commands:
- id: init-container-command
apply:
component: idea-rhel8-injector
events:
preStart:
- init-container-command
components:
- name: idea-rhel8
container:
image: registry.redhat.io/devspaces/udi-rhel8:3.5
command:
- /projector/entrypoint-volume.sh
env:
- name: PROJECTOR_ASSEMBLY_DIR
value: /projector
- name: PROJECTOR_CONFIG_DIR
value: /home/user/.jetbrains
volumeMounts:
- name: projector-volume
path: /projector
- name: projector-configuration
path: /home/user/.jetbrains
- name: projector-java-configuration
path: /home/user/.java
memoryLimit: 6144Mi
memoryRequest: 2048Mi
cpuLimit: 2000m
cpuRequest: 1500m
endpoints:
- name: intellij
attributes:
type: main
cookiesAuthEnabled: true
discoverable: false
urlRewriteSupported: true
secure: false
targetPort: 8887
exposure: public
path: /?backgroundColor=434343&wss
protocol: http
- name: intellij-redirect-1
attributes:
discoverable: false
urlRewriteSupported: false
targetPort: 13131
exposure: public
protocol: http
- name: intellij-redirect-2
attributes:
discoverable: false
urlRewriteSupported: false
targetPort: 13132
exposure: public
protocol: http
- name: intellij-redirect-3
attributes:
discoverable: false
urlRewriteSupported: false
targetPort: 13133
exposure: public
protocol: http
attributes:
app.kubernetes.io/component: idea-rhel8-runtime
app.kubernetes.io/part-of: idea-rhel8.eclipse.org
controller.devfile.io/container-contribution: true
- name: projector-volume
volume: {}
- name: projector-configuration
volume: {}
- name: projector-java-configuration
volume: {}
- name: idea-rhel8-injector
container:
image: registry.redhat.io/devspaces/idea-rhel8:3.5
command:
- /projector/entrypoint-init-container.sh
env:
- name: PROJECTOR_VOLUME_MOUNT
value: /projector-volume
- name: PROJECTOR_ASSEMBLY_DIR
value: /projector
volumeMounts:
- name: projector-volume
path: /projector-volume
memoryLimit: 128Mi
memoryRequest: 32Mi
cpuLimit: 500m
cpuRequest: 30m
---
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspace
metadata:
name: spring-petclinic
spec:
started: true
template:
components:
- name: tools
container:
image: quay.io/devfile/universal-developer-image:ubi8-0e189d9
memoryLimit: 3Gi
endpoints:
- exposure: none
name: debug
protocol: tcp
targetPort: 5005
- exposure: public
name: 8080-tcp
protocol: http
targetPort: 8080
volumeMounts:
- name: m2
path: /home/user/.m2
attributes:
controller.devfile.io/merge-contribution: true
- name: m2
volume:
size: 1G
- name: mariadb
container:
image: >-
quay.io/eclipse/che--mariadb:10.7.1-5a8009369ee57c85b6f4a08406147bd9c505cde6b8250d16a27d2a5febfdead7
memoryLimit: 300Mi
endpoints:
- exposure: none
name: db
protocol: tcp
targetPort: 3306
env:
- name: MARIADB_USER
value: petclinic
- name: MARIADB_PASSWORD
value: petclinic
- name: MARIADB_DATABASE
value: petclinic
- name: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD
value: allow
- name: PS1
value: $(echo ${0}) $
volumeMounts:
- name: mysqldata
path: /var/lib/mysql
- name: mysqldata
volume:
size: 256Mi
commands:
- id: prepare-database
exec:
component: mariadb
workingDir: ${PROJECT_SOURCE}
commandLine: >
mysql -u root <
${PROJECT_SOURCE}/src/main/resources/db/mysql/user.sql && \
mysql -u root petclinic <
${PROJECT_SOURCE}/src/main/resources/db/mysql/schema.sql && \
mysql -u root petclinic <
${PROJECT_SOURCE}/src/main/resources/db/mysql/data.sql && \
echo "\e[32mDone.\e[0m Database petclinic was configured"
group:
kind: run
isDefault: true
- id: maven-build
exec:
component: tools
workingDir: ${PROJECT_SOURCE}
commandLine: mvn clean install
group:
kind: build
isDefault: true
- id: run-with-hsqldb
exec:
component: tools
workingDir: ${PROJECT_SOURCE}
commandLine: >
mvn spring-boot:run -DskipTests \
-Dspring-boot.run.jvmArguments='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005,quiet=y'
group:
kind: run
isDefault: true
- id: run-with-mysql
exec:
component: tools
workingDir: ${PROJECT_SOURCE}
commandLine: >
mvn spring-boot:run -DskipTests -Dspring-boot.run.profiles=mysql \
-Dspring-boot.run.jvmArguments='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005,quiet=y'
group:
kind: run
isDefault: true
projects:
- name: java-spring-petclinic
git:
remotes:
origin: https://github.com/che-samples/java-spring-petclinic.git
checkoutFrom:
revision: main
contributions:
- name: editor
kubernetes:
name: che-idea-spring-petclinic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment