Skip to content

Commit

Permalink
continuing rebranding the demo
Browse files Browse the repository at this point in the history
Signed-off-by: Sun Tan <sutan@redhat.com>
  • Loading branch information
sunix committed Jul 30, 2019
1 parent 15ad3a7 commit 9b24f9f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ The devfile will also setup few container images:
1. Start the quarkus app in devmode. With the right command `compile quarkus:dev`.
2. Running it should popup windows to access to the exposed port of the app.
3. Open the link into another tab and access to the `/hello`. It should display `hello`.
4. Make a change on the Java file `sunix-quarkus-demo/src/main/java/org/sunix/QuarkusDemoResource.java`,
4. Make a change on the Java file `hello-quarkus/src/main/java/com/example/QuarkusDemoResource.java`,
use the code completion to perform a `"hello".toUpperCase();`. BEWARE, autosave may not be activated by default (File > Auto Save)
5. Don't forget to update the test `sunix-quarkus-demo/src/test/java/org/sunix/QuarkusDemoResourceTest.java`
5. Don't forget to update the test `hello-quarkus/src/test/java/com/example/QuarkusDemoResourceTest.java`
6. Refreshing the app tab page, it should display `HELLO`
7. Stop it : `pkill java`
7. Stop it : Ctrl-C
8. Package the app into a classic java app (optional)
9. Package the app into a tiny executable by running the native compilation `package -Pnative`, it will take a while ....
- `quarkus-runner`: which is based on `registry.fedoraproject.org/fedora-minimal`
Expand Down Expand Up @@ -100,13 +100,13 @@ That will run a che workspace with quarkus and maven ... let's generate the proj

From the theia-ide container terminal ...
```
cd /projects && git init sunix-demo-quarkus
cd /projects && git init che-quarkus-demo
```

From the quay-io-quarkus-cent terminal ....
```
cd /projects/sunix-demo-quarkus
mvn io.quarkus:quarkus-maven-plugin:0.14.0:create -DprojectGroupId=org.sunix -DprojectArtifactId=sunix-quarkus-demo -DclassName="org.sunix.QuarkusDemoResource" -Dpath="/hello"
cd /projects/che-quarkus-demo
mvn io.quarkus:quarkus-maven-plugin:0.14.0:create -DprojectGroupId=com.example -DprojectArtifactId=hello-quarkus -DclassName="com.example.QuarkusDemoResource" -Dpath="/hello"
```

You can try to run from the terminal
Expand All @@ -117,10 +117,10 @@ It will compile the project and start quarkus:dev

Back to the theia-ide container terminal to push everything
```
cd /projects/sunix-demo-quarkus
cd /projects/che-quarkus-demo
git remote add sunix https://github.com/sunix/che-quarkus-demo
git checkout master
git add sunix-quarkus-demo/
git add hello-quarkus/
git add restart_mvn_quarkus_dev.sh
git commit -s -m "quarkus java project skeleton"
git push sunix master
Expand Down Expand Up @@ -252,7 +252,7 @@ commands:
- type: exec
command: pkill java; mvn compile quarkus:dev
component: quarkus-builder
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo
workdir: /projects/che-quarkus-demo/hello-quarkus
```

Let's add a new command to perform `mvn package` and `mvn package -Pnative` (for native compilation optimized with GraalVM) and the command to kill the quarkus devmode:
Expand All @@ -270,14 +270,14 @@ commands:
- type: exec
command: mvn package
component: quarkus-builder
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo
workdir: /projects/che-quarkus-demo/hello-quarkus
- name: package -Pnative
actions:
- type: exec
command: mvn package -Pnative
component: quarkus-builder
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo
workdir: /projects/che-quarkus-demo/hello-quarkus
```

Relaunching a new workspace from it, we should be able to to run the native Quarkus compilation and produce the executable. Basically followed https://quarkus.io/guides/building-native-image-guide.
Expand Down Expand Up @@ -339,7 +339,7 @@ commands:
- type: exec
command: pkill java; mvn compile quarkus:dev
component: quarkus-builder
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo
workdir: /projects/che-quarkus-demo/hello-quarkus
- name: pkill java
actions:
Expand All @@ -352,14 +352,14 @@ commands:
- type: exec
command: mvn package
component: quarkus-builder
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo
workdir: /projects/che-quarkus-demo/hello-quarkus
- name: package -Pnative
actions:
- type: exec
command: mvn package -Pnative
component: quarkus-builder
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo
workdir: /projects/che-quarkus-demo/hello-quarkus
```

Expand All @@ -386,8 +386,8 @@ and create the appropriate command
name: run native
actions:
- type: exec
command: ./sunix-quarkus-demo-1.0-SNAPSHOT-runner -Dquarkus.http.host=0.0.0.0
command: ./hello-quarkus-1.0-SNAPSHOT-runner -Dquarkus.http.host=0.0.0.0
component: quarkus-runner
workdir: /projects/che-quarkus-demo/sunix-quarkus-demo/target
workdir: /projects/che-quarkus-demo/hello-quarkus/target
```
![Quarkus runner che workspace screenshot](screenshot-workspace-quarkus-runner.png "Quarkus runner che workspace screenshot")
2 changes: 1 addition & 1 deletion hello-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sunix</groupId>
<groupId>com.example</groupId>
<artifactId>hello-quarkus</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sunix;
package com.example;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
Expand Down
10 changes: 6 additions & 4 deletions hello-quarkus/src/main/resources/META-INF/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>sunix-quarkus-demo - 1.0-SNAPSHOT</title>
<title>hello-quarkus - 1.0-SNAPSHOT</title>
<style>
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0.5rem;
Expand Down Expand Up @@ -111,8 +111,10 @@ <h2>Why do you see this?</h2>

<p>This page is served by Quarkus. The source is in
<code>src/main/resources/META-INF/resources/index.html</code>.</p>
<p><a href="/hello">/hello</a> endpoint:</p>
<iframe src="/hello" height="200" width="300"></iframe>

<h2>What can I do from here?</h2>
<h2>What can I do from here? </h2>

<p>If not already done, run the application in <em>dev mode</em> using: <code>mvn compile quarkus:dev</code>.
</p>
Expand All @@ -130,8 +132,8 @@ <h2>How do I get rid of this page?</h2>
<div class="right-section">
<h3>Application</h3>
<ul>
<li>GroupId: org.sunix</li>
<li>ArtifactId: sunix-quarkus-demo</li>
<li>GroupId: com.example</li>
<li>ArtifactId: hello-quarkus</li>
<li>Version: 1.0-SNAPSHOT</li>
<li>Quarkus Version: 0.14.0</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sunix;
package com.example;

import io.quarkus.test.junit.SubstrateTest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sunix;
package com.example;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
Expand Down

0 comments on commit 9b24f9f

Please sign in to comment.