Skip to content
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

Update samples for deploying a devfile in deploying-a-devfile-using-odo.adoc #3163

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 137 additions & 55 deletions docs/public/deploying-a-devfile-using-odo.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ In our example, we will be using `java-spring-boot` to deploy a sample https://s

In this example we will be deploying an https://github.com/odo-devfiles/springboot-ex[example Spring Boot® component] that uses https://maven.apache.org/install.html[Maven] and Java 8 JDK.

. Download the example Spring Boot® component
. Download the example Spring Boot® component.
+
[source,sh]
----
$ git clone https://github.com/odo-devfiles/springboot-ex
----
Alternatively, you can pass in `--downloadSource` to `odo create` to have odo download a sample project.

. Change the current directory to the component directory:
+
Expand All @@ -107,14 +108,6 @@ In this example we will be deploying an https://github.com/odo-devfiles/springbo
$ cd <directory-name>
----

. List the contents of the directory to confirm that the front end is indeed a Java application:
+
[source,sh]
----
$ ls
chart Dockerfile Dockerfile-build Dockerfile-tools Jenkinsfile pom.xml README.md src
----

. Create a component configuration using the `java-spring-boot` component-type named `myspring`:
+
[source,sh]
Expand All @@ -123,10 +116,19 @@ In this example we will be deploying an https://github.com/odo-devfiles/springbo
Experimental mode is enabled, use at your own risk

Validation
✓ Checking devfile compatibility [71105ns]
✓ Validating devfile component [153481ns]
✓ Checking devfile compatibility [195728ns]
✓ Creating a devfile component from registry: DefaultDevfileRegistry [170275ns]
✓ Validating devfile component [281940ns]

Please use odo push command to create the component with source deployed
----

Please use odo push command to create the component with source deployed
. List the contents of the directory to see the devfile and sample Java application source code:
+
[source,sh]
----
$ ls
README.md devfile.yaml pom.xml src
----

. Create a URL in order to access the deployed component:
Expand All @@ -145,18 +147,27 @@ NOTE: You must use your cluster host domain name when creating your URL.
+
[source,sh]
----
$ odo push
• Push devfile component myspring ...
✓ Waiting for component to start [30s]
$ odo push

Validation
✓ Validating the devfile [81808ns]

Creating Kubernetes resources for component myspring
✓ Waiting for component to start [5s]

Applying URL changes
✓ URL myspring-8080: http://myspring-8080.apps-crc.testing created

Syncing to component myspring
✓ Checking files for pushing [2ms]
✓ Syncing files to the component [1s]

Executing devfile commands for component myspring
✓ Executing devbuild command "/artifacts/bin/build-container-full.sh" [1m]
✓ Executing devrun command "/artifacts/bin/start-server.sh" [2s]

Applying URL changes
✓ URL myspring-8080: http://myspring-8080.apps-crc.testing created
✓ Checking files for pushing [752719ns]
✓ Syncing files to the component [887ms]
✓ Executing devbuild command "/artifacts/bin/build-container-full.sh" [23s]
✓ Executing devrun command "/artifacts/bin/start-server.sh" [2s]
✓ Push devfile component myspring [57s]
✓ Changes successfully pushed to component
Pushing devfile component myspring
✓ Changes successfully pushed to component
----

. List the URLs of the component:
Expand All @@ -176,6 +187,16 @@ NOTE: You must use your cluster host domain name when creating your URL.
$ curl http://myspring-8080.apps-crc.testing
----

. To delete your deployed application:
+
[source,sh]
----
$ odo delete
? Are you sure you want to delete the devfile component: myspring? Yes
✓ Deleting devfile component myspring [152ms]
✓ Successfully deleted component
----

== Deploying a Node.js® component to an OpenShift cluster

In this example we will be deploying an https://github.com/odo-devfiles/nodejs-ex[example Node.js® component] that uses https://www.npmjs.com/[NPM].
Expand Down Expand Up @@ -210,8 +231,9 @@ In this example we will be deploying an https://github.com/odo-devfiles/nodejs-e
Experimental mode is enabled, use at your own risk

Validation
✓ Checking devfile compatibility [106956ns]
✓ Validating devfile component [250318ns]
✓ Checking devfile compatibility [111738ns]
✓ Creating a devfile component from registry: DefaultDevfileRegistry [89567ns]
✓ Validating devfile component [186982ns]

Please use odo push command to create the component with source deployed
----
Expand All @@ -232,18 +254,27 @@ NOTE: You must use your cluster host domain name when creating your URL.
+
[source,sh]
----
$ odo push
• Push devfile component mynodejs ...
✓ Waiting for component to start [27s]
$ odo push

Validation
✓ Validating the devfile [89380ns]

Applying URL changes
✓ URL mynodejs-3000: http://mynodejs-3000.apps-crc.testing created
✓ Checking files for pushing [1ms]
✓ Syncing files to the component [839ms]
✓ Executing devbuild command "npm install" [3s]
✓ Executing devrun command "nodemon app.js" [2s]
✓ Push devfile component mynodejs [33s]
✓ Changes successfully pushed to component
Creating Kubernetes resources for component mynodejs
✓ Waiting for component to start [3s]

Applying URL changes
✓ URL mynodejs-3000: http://mynodejs-3000.apps-crc.testing created

Syncing to component mynodejs
✓ Checking files for pushing [2ms]
✓ Syncing files to the component [1s]

Executing devfile commands for component mynodejs
✓ Executing devbuild command "npm install" [3s]
✓ Executing devrun command "nodemon app.js" [2s]

Pushing devfile component mynodejs
✓ Changes successfully pushed to component
----

. List the URLs of the component:
Expand All @@ -263,6 +294,16 @@ NOTE: You must use your cluster host domain name when creating your URL.
$ curl http://mynodejs-8080.apps-crc.testing
----

. To delete your deployed application:
+
[source,sh]
----
$ odo delete
? Are you sure you want to delete the devfile component: mynodejs? Yes
✓ Deleting devfile component mynodejs [139ms]
✓ Successfully deleted component
----

== Deploying a Java Spring Boot® component locally to Docker

In this example, we will be deploying the same Java Spring Boot® component we did earlier, but to a locally running Docker instance.
Expand All @@ -278,26 +319,42 @@ In this example, we will be deploying the same Java Spring Boot® component we d
----
+

. Download the example Spring Boot® component.
+
[source,sh]
----
$ git clone https://github.com/odo-devfiles/springboot-ex
----
Alternatively, you can pass in `--downloadSource` to `odo create` to have odo download a sample project.

. Change the current directory to the component directory:
+
[source,sh]
----
$ cd <directory-name>
----

. Create a component configuration using the `java-spring-boot` component-type named `mydockerspringboot`:
+
[source,sh]
----
$ odo create java-spring-boot mydockerspringboot
Experimental mode is enabled, use at your own risk
$ odo create java-spring-boot mydockerspringboot
Experimental mode is enabled, use at your own risk

Validation
✓ Checking devfile compatibility [26759ns]
✓ Validating devfile component [75889ns]
Validation
✓ Checking devfile compatibility [195728ns]
✓ Creating a devfile component from registry: DefaultDevfileRegistry [170275ns]
✓ Validating devfile component [281940ns]

Please use odo push command to create the component with source deployed
Please use odo push command to create the component with source deployed
----

. Create a URL in order to access the deployed component:
+
[source,sh]
----
$ odo url create --port 8080
✓ URL local-mydockerspringboot-8080 created for component: mydockerspringboot with exposed port: 37833
✓ URL java-spring-boot-8080 created for component: java-spring-boot with exposed port: 59382

To apply the URL configuration changes, please use odo push
----
Expand All @@ -309,18 +366,26 @@ In order to access the docker application, exposed ports are required and automa
[source,sh]
----
$ odo push
• Push devfile component mydockerspringboot ...
✓ Pulling image maysunfaisal/springbootbuild [601ms]

Applying URL configuration
✓ URL 127.0.0.1:37833 created
✓ Starting container for maysunfaisal/springbootbuild [550ms]
✓ Pulling image maysunfaisal/springbootruntime [581ms]

Applying URL configuration
✓ URL 127.0.0.1:37833 created
✓ Starting container for maysunfaisal/springbootruntime [505ms]
✓ Push devfile component mydockerspringboot [2s]

Validation
✓ Validating the devfile [52685ns]

Creating Docker resources for component java-spring-boot
✓ Pulling image maysunfaisal/springbootbuild [879ms]
✓ Starting container for maysunfaisal/springbootbuild [397ms]
✓ Pulling image maysunfaisal/springbootruntime [1s]
✓ URL 127.0.0.1:59382 created
✓ Starting container for maysunfaisal/springbootruntime [380ms]

Syncing to component java-spring-boot
✓ Checking files for pushing [2ms]
✓ Syncing files to the component [231ms]

Executing devfile commands for component java-spring-boot
✓ Executing devbuild command "/artifacts/bin/build-container-full.sh" [1m]
✓ Executing devrun command "/artifacts/bin/start-server.sh" [1s]

Pushing devfile component java-spring-boot
✓ Changes successfully pushed to component
----
+
Expand All @@ -329,3 +394,20 @@ When odo deploys a devfile component, it pulls the images for each `dockercontai
Each docker container that is deployed is labeled with the name of the odo component.
+
Docker volumes are created for the project source, and any other volumes defined in the devfile and mounted to the necessary containers.

. View your deployed application using the generated URL:
+
[source,sh]
----
$ curl http://127.0.0.1:59382
----

. To delete your deployed application:
+
[source,sh]
----
$ odo delete
? Are you sure you want to delete the devfile component: java-spring-boot? Yes
✓ Deleting devfile component java-spring-boot [139ms]
✓ Successfully deleted component
----