diff --git a/cli_reference/developer_cli_odo/creating-an-application-with-a-database.adoc b/cli_reference/developer_cli_odo/creating-an-application-with-a-database.adoc index fef14710cc..9abbf019be 100644 --- a/cli_reference/developer_cli_odo/creating-an-application-with-a-database.adoc +++ b/cli_reference/developer_cli_odo/creating-an-application-with-a-database.adoc @@ -13,6 +13,7 @@ This example describes how to deploy and connect a database to a front-end appli * `oc` client is installed. * You have a running cluster. Developers can use link:https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/[CodeReady Containers (CRC)] to deploy a local cluster quickly. * The Service Catalog is installed and enabled on your cluster. ++ [NOTE] ==== Service Catalog is deprecated on {product-title} 4 and later. diff --git a/cli_reference/developer_cli_odo/odo-release-notes.adoc b/cli_reference/developer_cli_odo/odo-release-notes.adoc index fc1817bbc7..542c11b638 100644 --- a/cli_reference/developer_cli_odo/odo-release-notes.adoc +++ b/cli_reference/developer_cli_odo/odo-release-notes.adoc @@ -8,10 +8,11 @@ toc::[] [id="odo-notable-improvements_{context}"] == Notable changes and improvements in `{odo-title}` -* The `--devfile` flag is added to `odo create`. Run `odo create --devfile ` to specify your devfile location. This flag is only available in the Experimental Mode. See xref:odo-technology-preview_odo-release-notes[Technology Preview features] to learn how to enable it. +* The `--devfile` flag is added to `odo create`. Run `odo create --devfile ` to specify your devfile location. This flag is only available in the Experimental Mode. See xref:odo-technology-preview_odo-release-notes[Technology Preview features] to learn how to enable it. * Dynamic registry support. Now you can configure your own registries with the following commands: + +[source,terminal] ---- # Add a registry to the registry list odo registry add @@ -34,20 +35,20 @@ odo create --registry * The `--starter` flag is added to `odo create`. Run `odo create nodejs --starter ` to download the source code of a project specified in the devfile. If no project name is specified, `odo` downloads the first one. -* The `--context` flag is added to `odo push`. With `--context`, you can trigger `odo push` from outside the source code directory. Run `odo push --devfile --context ` to specify the directory of your component. +* The `--context` flag is added to `odo push`. With `--context`, you can trigger `odo push` from outside the source code directory. Run `odo push --devfile --context ` to specify the directory of your component. * Performance improvement for `odo catalog list components` when using the devfiles. * The `--now` flag is added for `odo url delete` when using the devfiles. -* `odo url delete --now` now works with the devfiles. +* `odo url delete --now` now works with the devfiles. * The `--debug` flag now works with the devfiles. * Added machine-readable output for listing Operator-backed services. Run `odo catalog list services -o json` to display information about Operators and services in JSON format. * Added machine-readable output for debugging. Run `odo debug info -o json` to display the debugging information in JSON format. -* Added machine-readable output for `odo push`. Run `odo push -o json` to display event notifications in JSON format. +* Added machine-readable output for `odo push`. Run `odo push -o json` to display event notifications in JSON format. [id="odo-getting-support_{context}"] @@ -87,6 +88,7 @@ Provide as many details in the issue description as possible. + Workaround: specify your .NET project file by running: + +[source,terminal] ---- $ odo config set --env DOTNET_STARTUP_PROJECT= ---- @@ -94,7 +96,7 @@ $ odo config set --env DOTNET_STARTUP_PROJECT= [id="odo-technology-preview_{context}"] == Technology Preview features `{odo-title}` -* `odo debug` is a feature that allows users to attach a local debugger to a component running in the Pod. +* `odo debug` is a feature that allows users to attach a local debugger to a component running in the Pod. To learn more, see xref:../../cli_reference/developer_cli_odo/debugging-applications-in-odo.html#debugging-an-application_debugging-applications-in-odo[Debugging applications in odo]. :FeatureName: odo debug diff --git a/cli_reference/developer_cli_odo/understanding-odo.adoc b/cli_reference/developer_cli_odo/understanding-odo.adoc index 9b097d3ba5..308d83efa0 100644 --- a/cli_reference/developer_cli_odo/understanding-odo.adoc +++ b/cli_reference/developer_cli_odo/understanding-odo.adoc @@ -92,14 +92,21 @@ To list the available components and associated container images for your cluste . Log in to the cluster with `{odo-title}`: + +[source,terminal] ---- $ odo login -u developer -p developer ---- . List the available `{odo-title}` supported and unsupported components and corresponding container images: + ----------------------------------------------------- +[source,terminal] +---- $ odo catalog list components +---- ++ +.Example output +[source,terminal] +---- Odo Supported OpenShift Components: NAME PROJECT TAGS java openshift 8,latest @@ -109,6 +116,6 @@ Odo Unsupported OpenShift Components: NAME PROJECT TAGS dotnet openshift 1.0,1.1,2.1,2.2,latest fuse7-eap-openshift openshift 1.3 ----------------------------------------------------- +---- + The `TAGS` column represents the available image versions, for example, `10` represents the `rhoar-nodejs/nodejs-10` container image. diff --git a/cli_reference/developer_cli_odo/using-sample-applications.adoc b/cli_reference/developer_cli_odo/using-sample-applications.adoc index 420851a0e2..5f9cfb5242 100644 --- a/cli_reference/developer_cli_odo/using-sample-applications.adoc +++ b/cli_reference/developer_cli_odo/using-sample-applications.adoc @@ -7,6 +7,7 @@ toc::[] `{odo-title}` offers partial compatibility with any language or runtime listed within the OpenShift catalog of component types. For example: +[source,terminal] ---- NAME PROJECT TAGS dotnet openshift 2.0,latest diff --git a/modules/developer-cli-odo-adding-a-custom-builder-to-specify-a-build-image.adoc b/modules/developer-cli-odo-adding-a-custom-builder-to-specify-a-build-image.adoc index 2cdad06ea2..0ac215ef0c 100644 --- a/modules/developer-cli-odo-adding-a-custom-builder-to-specify-a-build-image.adoc +++ b/modules/developer-cli-odo-adding-a-custom-builder-to-specify-a-build-image.adoc @@ -5,7 +5,7 @@ [id="adding-a-custom-builder-to-specify-a-build-image_{context}"] = Adding a custom builder to specify a build image -With {product-title}, you can add a custom image to bridge the gap between the creation of custom images. +With {product-title}, you can add a custom image to bridge the gap between the creation of custom images. The following example demonstrates the successful import and use of the `redhat-openjdk-18` image: @@ -16,6 +16,7 @@ The following example demonstrates the successful import and use of the `redhat- . Import the image into {product-title}: + +[source,terminal] ---- $ oc import-image openjdk18 \ --from=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift \ @@ -23,17 +24,14 @@ $ oc import-image openjdk18 \ ---- . Tag the image to make it accessible to {odo-title}: + +[source,terminal] ---- $ oc annotate istag/openjdk18:latest tags=builder ---- . Deploy the image with {odo-title}: + +[source,terminal] ---- $ odo create openjdk18 --git \ https://github.com/openshift-evangelists/Wild-West-Backend ---- - - - - - diff --git a/modules/developer-cli-odo-adding-storage-to-the-application-components.adoc b/modules/developer-cli-odo-adding-storage-to-the-application-components.adoc index 85fce7e964..2b468c7bff 100644 --- a/modules/developer-cli-odo-adding-storage-to-the-application-components.adoc +++ b/modules/developer-cli-odo-adding-storage-to-the-application-components.adoc @@ -11,6 +11,7 @@ Persistent storage keeps data available between restarts of {odo-title}. You can * Add storage to your components: + +[source,terminal] ---- $ odo storage create nodestorage --path=/opt/app-root/src/storage/ --size=1Gi ---- diff --git a/modules/developer-cli-odo-basic-odo-cli-commands.adoc b/modules/developer-cli-odo-basic-odo-cli-commands.adoc index c63fe32394..ef81546fa4 100644 --- a/modules/developer-cli-odo-basic-odo-cli-commands.adoc +++ b/modules/developer-cli-odo-basic-odo-cli-commands.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * cli_reference/developer_cli_odo/odo-cli-reference.adoc +// * cli_reference/developer_cli_odo/odo-cli-reference.adoc [id="basic-odo-cli-commands_{context}"] = Basic {odo-title} CLI commands @@ -11,6 +11,7 @@ Perform application operations related to your {product-title} project. .Example using app +[source,terminal] ---- # Delete the application odo app delete myapp @@ -20,7 +21,7 @@ Perform application operations related to your {product-title} project. # List all applications in the current project odo app list - + # List all applications in the specified project odo app list --project myproject ---- @@ -32,6 +33,7 @@ Perform catalog-related operations. .Example using catalog +[source,terminal] ---- # Get the supported components odo catalog list components @@ -51,10 +53,11 @@ Perform catalog-related operations. == component -Manage components of an application. +Manage components of an application. .Example using component +[source,terminal] ---- # Create a new component odo component create @@ -65,10 +68,11 @@ odo component create --now == config -Modify `odo` specific settings within the `config` file. +Modify `odo` specific settings within the `config` file. .Example using config +[source,terminal] ---- # For viewing the current local configuration @@ -84,7 +88,7 @@ Modify `odo` specific settings within the `config` file. odo config set MinCPU 0.5 odo config set MaxCPU 2 odo config set CPU 1 - + # Set an environment variable in the local configuration odo config set --env KAFKA_HOST=kafka --env KAFKA_PORT=6639 @@ -101,7 +105,7 @@ Modify `odo` specific settings within the `config` file. odo config unset MinCPU odo config unset MaxCPU odo config unset CPU - + # Unset an env variable in the local config odo config unset --env KAFKA_HOST --env KAFKA_PORT ---- @@ -132,10 +136,10 @@ Modify `odo` specific settings within the `config` file. |Type |The type of component |Url |The URL to access the component |======= - + == create -Create a configuration describing a component to be deployed on {product-title}. If a component name is not provided, it is autogenerated. +Create a configuration describing a component to be deployed on {product-title}. If a component name is not provided, it is autogenerated. By default, builder images are used from the current namespace. To explicitly supply a namespace, use: `odo create namespace/name:version`. If a version is not specified, the version defaults to `latest`. @@ -143,47 +147,48 @@ Use `odo catalog list` to see a full list of component types that can be deploye .Example using create +[source,terminal] ---- # Create new Node.js component with the source in current directory. odo create nodejs - + # Create new Node.js component and push it to the cluster immediately. odo create nodejs --now - + # A specific image version may also be specified odo create nodejs:latest - + # Create new Node.js component named 'frontend' with the source in './frontend' directory odo create nodejs frontend --context ./frontend - + # Create a new Node.js component of version 6 from the 'openshift' namespace odo create openshift/nodejs:6 --context /nodejs-ex - + # Create new Wildfly component with binary named sample.war in './downloads' directory odo create wildfly wildfly --binary ./downloads/sample.war - + # Create new Node.js component with source from remote git repository odo create nodejs --git https://github.com/openshift/nodejs-ex.git - + # Create new Node.js git component while specifying a branch, tag or commit ref odo create nodejs --git https://github.com/openshift/nodejs-ex.git --ref master - + # Create new Node.js git component while specifying a tag odo create nodejs --git https://github.com/openshift/nodejs-ex.git --ref v1.0.1 - + # Create new Node.js component with the source in current directory and ports 8080-tcp,8100-tcp and 9100-udp exposed odo create nodejs --port 8080,8100/tcp,9100/udp - + # Create new Node.js component with the source in current directory and env variables key=value and key1=value1 exposed odo create nodejs --env key=value,key1=value1 - + # Create a new Python component with the source in a Git repository odo create python --git https://github.com/openshift/django-ex.git - + # Passing memory limits odo create nodejs --memory 150Mi odo create nodejs --min-memory 150Mi --max-memory 300 Mi - + # Passing cpu limits odo create nodejs --cpu 2 odo create nodejs --min-cpu 200m --max-cpu 2 @@ -193,6 +198,9 @@ Use `odo catalog list` to see a full list of component types that can be deploye Debug a component. +.Example using debug + +[source,terminal] ---- # Displaying information about the state of debugging odo debug info @@ -210,6 +218,7 @@ Delete an existing component. .Example using delete +[source,terminal] ---- # Delete component named 'frontend'. odo delete frontend @@ -223,6 +232,7 @@ Describe the given component. .Example using describe +[source,terminal] ---- # Describe nodejs component odo describe nodejs @@ -235,19 +245,20 @@ Link a component to a service or component. .Example using link +[source,terminal] ---- # Link the current component to the 'my-postgresql' service odo link my-postgresql - + # Link component 'nodejs' to the 'my-postgresql' service odo link my-postgresql --component nodejs - + # Link current component to the 'backend' component (backend must have a single exposed port) odo link backend - + # Link component 'nodejs' to the 'backend' component odo link backend --component nodejs - + # Link current component to port 8080 of the 'backend' component (backend must have port 8080 exposed) odo link backend --port 8080 ---- @@ -263,13 +274,14 @@ Pushed:: A component is pushed to the cluster. Not Pushed:: A component is not pushed to the cluster. Unknown:: `{odo-title}` is disconnected from the cluster. -.Example using the list command +.Example using list +[source,terminal] ---- # List all components in the application odo list - - # List all the components in a given path + + # List all the components in a given path odo list --path ---- @@ -279,6 +291,7 @@ Retrieve the log for the given component. .Example using log +[source,terminal] ---- # Get the logs for the nodejs component odo log nodejs @@ -292,16 +305,17 @@ Log in to the cluster. .Example using login +[source,terminal] ---- # Log in interactively odo login - + # Log in to the given server with the given certificate authority file odo login localhost:8443 --certificate-authority=/path/to/cert.crt - + # Log in to the given server with the given credentials (basic auth) odo login localhost:8443 --username=myuser --password=mypass - + # Log in to the given server with the given credentials (token) odo login localhost:8443 --token=xxxxxxxxxxxxxxxxxxxxxxx ---- @@ -313,6 +327,7 @@ Log out of the current {product-title} session. .Example using logout +[source,terminal] ---- # Log out odo logout @@ -324,16 +339,17 @@ Log out of the current {product-title} session. Modify `odo` specific configuration settings within the global preference file. .Example using preference +[source,terminal] ---- # For viewing the current preferences odo preference view - + # Set a preference value in the global preference odo preference set UpdateNotification false odo preference set NamePrefix "app" odo preference set Timeout 20 - + # Enable experimental mode odo preference set experimental true @@ -341,11 +357,11 @@ Modify `odo` specific configuration settings within the global preference file. odo preference unset UpdateNotification odo preference unset NamePrefix odo preference unset Timeout - + # Disable experimental mode odo preference set experimental false ---- - + [NOTE] ==== By default, the path to the global preference file is `~/.odo/preferece.yaml` and it is stored in the environment variable `GLOBALODOCONFIG`. You can set up a custom path by setting the value of the environment variable to a new preference path, for example `GLOBALODOCONFIG="new_path/preference.yaml"` @@ -364,6 +380,7 @@ Perform project operations. .Example using project +[source,terminal] ---- # Set the active project odo project set @@ -387,17 +404,18 @@ Push source code to a component. .Example using push +[source,terminal] ---- # Push source code to the current component odo push - + # Push data to the current component from the original source. odo push - + # Push source code in ~/mycode to component called my-component odo push my-component --context ~/mycode - - # Push source code and display event notifications in JSON format. + + # Push source code and display event notifications in JSON format. odo push -o json ---- @@ -405,7 +423,8 @@ Push source code to a component. Create and modify custom registries. -.Example using the registry command +.Example using registry +[source,terminal] ---- # Add a registry to the registry list odo registry add @@ -432,6 +451,7 @@ Perform service catalog operations. .Example using service +[source,terminal] ---- # Create new postgresql service from service catalog using dev plan and name my-postgresql-db. odo service create dh-postgresql-apb my-postgresql-db --plan dev -p postgresql_user=luke -p postgresql_password=secret @@ -450,20 +470,21 @@ Perform storage operations. .Example using storage +[source,terminal] ---- # Create storage of size 1Gb to a component odo storage create mystorage --path=/opt/app-root/src/storage/ --size=1Gi # Delete storage mystorage from the currently active component odo storage delete mystorage - + # Delete storage mystorage from component 'mongodb' odo storage delete mystorage --component mongodb - + # List all storage attached or mounted to the current component and # all unattached or unmounted storage in the current application odo storage list - + # Set the `-o json` flag to get a JSON formatted output odo storage list -o json ---- @@ -476,19 +497,20 @@ For this command to be successful, the service or component must have been linke .Example using unlink +[source,terminal] ---- # Unlink the 'my-postgresql' service from the current component odo unlink my-postgresql - + # Unlink the 'my-postgresql' service from the 'nodejs' component odo unlink my-postgresql --component nodejs - + # Unlink the 'backend' component from the current component (backend must have a single exposed port) odo unlink backend - + # Unlink the 'backend' service from the 'nodejs' component odo unlink backend --component nodejs - + # Unlink the backend's 8080 port from the current component odo unlink backend --port 8080 ---- @@ -499,39 +521,41 @@ Update the source code path of a component .Example using update +[source,terminal] ---- # Change the source code path of a currently active component to local (use the current directory as a source) odo update --local - + # Change the source code path of the frontend component to local with source in ./frontend directory odo update frontend --local ./frontend - + # Change the source code path of a currently active component to git odo update --git https://github.com/openshift/nodejs-ex.git - + # Change the source code path of the component named node-ex to git odo update node-ex --git https://github.com/openshift/nodejs-ex.git - + # Change the source code path of the component named wildfly to a binary named sample.war in ./downloads directory odo update wildfly --binary ./downloads/sample.war ---- == url -Expose a component to the outside world. +Expose a component to the outside world. .Example using url +[source,terminal] ---- # Create a URL for the current component with a specific port odo url create --port 8080 - + # Create a URL with a specific name and port odo url create example --port 8080 - + # Create a URL with a specific name by automatic detection of port (only for components which expose only one service port) odo url create example - + # Create a URL with a specific name and port for component frontend odo url create example --port 8080 --component frontend @@ -541,9 +565,9 @@ Expose a component to the outside world. # List the available URLs odo url list - # Create a URL in the configuration and apply the changes to the cluster + # Create a URL in the configuration and apply the changes to the cluster odo url create --now - + # Create an HTTPS URL odo url create --secure ---- @@ -556,10 +580,11 @@ Utilities for terminal commands and modifying odo configurations. .Example using utils +[source,terminal] ---- # Bash terminal PS1 support source <(odo utils terminal bash) - + # Zsh terminal PS1 support source <(odo utils terminal zsh) @@ -573,6 +598,7 @@ Print the client version information. .Example using version +[source,terminal] ---- # Print the client version of odo odo version @@ -584,10 +610,11 @@ Print the client version information. .Example using watch +[source,terminal] ---- # Watch for changes in directory for current component odo watch - + # Watch for changes in directory for component called frontend odo watch frontend ---- diff --git a/modules/developer-cli-odo-configuring-debugging-parameters.adoc b/modules/developer-cli-odo-configuring-debugging-parameters.adoc index 1bcb6918ce..9fb2e8581d 100644 --- a/modules/developer-cli-odo-configuring-debugging-parameters.adoc +++ b/modules/developer-cli-odo-configuring-debugging-parameters.adoc @@ -12,6 +12,7 @@ You can specify a remote port with `odo config` command and a local port with th * To set a remote port on which the debugging agent should run, run: + +[source,terminal] ---- $ odo config set DebugPort 9292 ---- @@ -23,6 +24,7 @@ You must redeploy your component for this value to be reflected on the component * To set a local port to port forward, run: + +[source,terminal] ---- $ odo debug port-forward --local-port 9292 ---- @@ -30,4 +32,4 @@ $ odo debug port-forward --local-port 9292 [NOTE] ==== The local port value does not persist. You must provide it every time you need to change the port. -==== \ No newline at end of file +==== diff --git a/modules/developer-cli-odo-connecting-the-database.adoc b/modules/developer-cli-odo-connecting-the-database.adoc index 26114066fd..facc30355e 100644 --- a/modules/developer-cli-odo-connecting-the-database.adoc +++ b/modules/developer-cli-odo-connecting-the-database.adoc @@ -8,8 +8,14 @@ . Link the database to the front-end service: + +[source,terminal] ---- $ odo link mongodb-persistent +---- ++ +.Example output +[source,terminal] +---- ✓ Service mongodb-persistent has been successfully linked from the component nodejs-nodejs-ex-mhbb Following environment variables were added to nodejs-nodejs-ex-mhbb component: @@ -21,29 +27,55 @@ Following environment variables were added to nodejs-nodejs-ex-mhbb component: ---- . See the environment variables of the application and the database in the Pod: + +.. Get the Pod name: + +[source,terminal] ---- $ oc get pods +---- ++ +.Example output +[source,terminal] +---- NAME READY STATUS RESTARTS AGE mongodb-1-gsznc 1/1 Running 0 28m nodejs-nodejs-ex-mhbb-app-4-vkn9l 1/1 Running 0 1m +---- +.. Connect to the Pod: ++ +[source,terminal] +---- $ oc rsh nodejs-nodejs-ex-mhbb-app-4-vkn9l +---- + +.. Check the environment variables: ++ +[source,terminal] +---- sh-4.2$ env +---- ++ +.Example output +[source,terminal] +---- uri=mongodb://172.30.126.3:27017 password=dHIOpYneSkX3rTLn database_name=sampledb username=user43U admin_password=NCn41tqmx7RIqmfv -sh-4.2$ ---- . Open the URL in the browser and notice the database configuration in the bottom right: + +[source,terminal] ---- $ odo url list ---- + +.Example output +[source,terminal] ---- Request information Page view count: 24 diff --git a/modules/developer-cli-odo-connecting-your-application-to-multiple-services-using-openshift-service-catalog.adoc b/modules/developer-cli-odo-connecting-your-application-to-multiple-services-using-openshift-service-catalog.adoc index 8702379b22..46e8f1c184 100644 --- a/modules/developer-cli-odo-connecting-your-application-to-multiple-services-using-openshift-service-catalog.adoc +++ b/modules/developer-cli-odo-connecting-your-application-to-multiple-services-using-openshift-service-catalog.adoc @@ -6,7 +6,7 @@ = Connecting your application to multiple services using OpenShift Service Catalog -The OpenShift service catalog is an implementation of the Open Service Broker API (OSB API) for Kubernetes. You can use it to connect applications deployed in {product-title} to a variety of services. +The OpenShift service catalog is an implementation of the Open Service Broker API (OSB API) for Kubernetes. You can use it to connect applications deployed in {product-title} to a variety of services. .Prerequisites @@ -17,12 +17,14 @@ The OpenShift service catalog is an implementation of the Open Service Broker AP * To list the services: + +[source,terminal] ---- $ odo catalog list services ---- * To use service catalog-related operations: + +[source,terminal] ---- $ odo service ----- \ No newline at end of file +---- diff --git a/modules/developer-cli-odo-creating-a-project-in-odo.adoc b/modules/developer-cli-odo-creating-a-project-in-odo.adoc index 65e5eccc80..0619293d1c 100644 --- a/modules/developer-cli-odo-creating-a-project-in-odo.adoc +++ b/modules/developer-cli-odo-creating-a-project-in-odo.adoc @@ -7,20 +7,27 @@ [id="creating-a-project_{context}"] = Creating a project -Create a project to keep your source code, tests, and libraries organized in a separate single unit. +Create a project to keep your source code, tests, and libraries organized in a separate single unit. .Procedure . Log in to an {product-title} cluster: + +[source,terminal] ---- $ odo login -u developer -p developer ---- . Create a project: + +[source,terminal] ---- $ odo project create myproject +---- ++ +.Example output +[source,terminal] +---- ✓ Project 'myproject' is ready for use ✓ New project created and now using project : myproject ---- diff --git a/modules/developer-cli-odo-creating-a-service-from-an-operator.adoc b/modules/developer-cli-odo-creating-a-service-from-an-operator.adoc index 19ce7189c6..1e9e310ddd 100644 --- a/modules/developer-cli-odo-creating-a-service-from-an-operator.adoc +++ b/modules/developer-cli-odo-creating-a-service-from-an-operator.adoc @@ -10,12 +10,14 @@ If an Operator has valid values defined in its `metadata` to start the requested . Print the YAML of the service as a file on your local drive: + +[source,terminal] ---- $ oc get csv/etcdoperator.v0.9.4 -o yaml ---- . Verify that the values of the service are valid: + +[source,terminal] ---- apiVersion: etcd.database.coreos.com/v1beta2 kind: EtcdCluster @@ -28,12 +30,14 @@ spec: . Start an `EtcdCluster` service from the `etcdoperator.v0.9.4` Operator: + +[source,terminal] ---- $ odo service create etcdoperator.v0.9.4 --crd EtcdCluster ---- . Verify that a service has started: + +[source,terminal] ---- $ oc get EtcdCluster ---- diff --git a/modules/developer-cli-odo-creating-and-deploying-a-nodejs-application-with-odo.adoc b/modules/developer-cli-odo-creating-and-deploying-a-nodejs-application-with-odo.adoc index 87e6e36eee..c767513389 100644 --- a/modules/developer-cli-odo-creating-and-deploying-a-nodejs-application-with-odo.adoc +++ b/modules/developer-cli-odo-creating-and-deploying-a-nodejs-application-with-odo.adoc @@ -10,22 +10,24 @@ ifeval::["{context}" == "creating-a-multicomponent-application-with-odo"] endif::[] [id="creating-a-nodejs-application-with-odo_{context}"] -= Creating a Node.js application with {odo-title} += Creating a Node.js application with {odo-title} To create a Node.js component, download the Node.js application and push the source code to your cluster with `{odo-title}`. -.Procedure +.Procedure ifdef::single[] . Create a directory for your components: + +[source,terminal] ---- $ mkdir my_components $$ cd my_components ---- . Download the example Node.js application: + +[source,terminal] ---- $ git clone https://github.com/openshift/nodejs-ex ---- @@ -35,6 +37,7 @@ ifdef::multi[] . Download the example front-end application: + +[source,terminal] ---- $ git clone https://github.com/openshift-evangelists/Wild-West-Frontend frontend ---- @@ -44,12 +47,14 @@ endif::multi[] . Change the current directory to the directory with your application: + +[source,terminal] ---- $ cd ----- +---- . Add a component of the type Node.js to your application: + +[source,terminal] ---- $ odo create nodejs ---- @@ -58,6 +63,7 @@ NOTE: By default, the latest image is used. You can also explicitly specify an i . Push the initial source code to the component: + +[source,terminal] ---- $ odo push ---- @@ -66,24 +72,28 @@ Your component is now deployed to {product-title}. . Create a URL and add an entry in the local configuration file as follows: + +[source,terminal] ---- $ odo url create --port 8080 ---- + . Push the changes. This creates a URL on the cluster. + +[source,terminal] ---- $ odo push ---- + . List the URLs to check the desired URL for the component. + +[source,terminal] ---- $ odo url list ---- + . View your deployed application using the generated URL. + +[source,terminal] ---- $ curl ---- diff --git a/modules/developer-cli-odo-creating-services-from-yaml-files.adoc b/modules/developer-cli-odo-creating-services-from-yaml-files.adoc index 67d216bb8a..7c618dee3e 100644 --- a/modules/developer-cli-odo-creating-services-from-yaml-files.adoc +++ b/modules/developer-cli-odo-creating-services-from-yaml-files.adoc @@ -8,16 +8,18 @@ If the YAML definition of the service or Custom Resource (CR) has invalid or placeholder data, you can use the `--dry-run` flag to get the YAML definition, specify the correct values, and start the service using the corrected YAML definition. Printing and modifying the YAML used to start a service -`{odo-title}` provides the feature to print the YAML definition of the service or CR provided by the Operator before starting a service. +`{odo-title}` provides the feature to print the YAML definition of the service or CR provided by the Operator before starting a service. . To display the YAML of the service, run: + +[source,terminal] ---- $ odo service create --crd --dry-run ---- + For example, to print YAML definition of `EtcdCluster` provided by the `etcdoperator.v0.9.4` Operator, run: + +[source,terminal] ---- $ odo service create etcdoperator.v0.9.4 --crd EtcdCluster --dry-run ---- @@ -26,12 +28,13 @@ The YAML is saved as the `etcd.yaml` file. . Modify the `etcd.yaml` file: + +[source,yaml] ---- apiVersion: etcd.database.coreos.com/v1beta2 kind: EtcdCluster metadata: name: my-etcd-cluster // <1> -spec: +spec: size: 1 // <2> version: 3.2.13 ---- @@ -41,12 +44,14 @@ spec: . Start a service from the YAML file: + +[source,terminal] ---- $ odo service create --from-file etcd.yaml ---- . Verify that the `EtcdCluster` service has started with one Pod instead of the pre-configured three Pods: + +[source,terminal] ---- $ oc get pods | grep my-etcd-cluster ---- diff --git a/modules/developer-cli-odo-debugging-an-application.adoc b/modules/developer-cli-odo-debugging-an-application.adoc index 3ec08cacb6..2c6c495982 100644 --- a/modules/developer-cli-odo-debugging-an-application.adoc +++ b/modules/developer-cli-odo-debugging-an-application.adoc @@ -6,14 +6,15 @@ = Debugging an application -You can debug your application on in `odo` with the `odo debug` command. +You can debug your application on in `odo` with the `odo debug` command. .Procedure . After an application is deployed, start the port forwarding for your component to debug the application: + +[source,terminal] ---- $ odo debug port-forward ---- -. Attach the debugger bundled in your IDE to the component. Instructions vary depending on your IDE. \ No newline at end of file +. Attach the debugger bundled in your IDE to the component. Instructions vary depending on your IDE. diff --git a/modules/developer-cli-odo-deleting-an-application.adoc b/modules/developer-cli-odo-deleting-an-application.adoc index 32244b7aad..aaab183ec2 100644 --- a/modules/developer-cli-odo-deleting-an-application.adoc +++ b/modules/developer-cli-odo-deleting-an-application.adoc @@ -16,8 +16,14 @@ Deleting an application will delete all components associated with the applicati . List the applications in the current project: + +[source,terminal] ---- $ odo app list +---- ++ +.Example output +[source,terminal] +---- The project '' has the following applications: NAME app @@ -25,16 +31,28 @@ $ odo app list . List the components associated with the applications. These components will be deleted with the application: + +[source,terminal] ---- $ odo component list +---- ++ +.Example output +[source,terminal] +---- APP NAME TYPE SOURCE STATE app nodejs-nodejs-ex-elyf nodejs file://./ Pushed ---- . Delete the application: + +[source,terminal] ---- $ odo app delete +---- ++ +.Example output +[source,terminal] +---- ? Are you sure you want to delete the application: from project: ---- -. Confirm the deletion with `Y`. You can suppress the confirmation prompt using the `-f` flag. \ No newline at end of file +. Confirm the deletion with `Y`. You can suppress the confirmation prompt using the `-f` flag. diff --git a/modules/developer-cli-odo-deploying-a-database-in-interactive-mode.adoc b/modules/developer-cli-odo-deploying-a-database-in-interactive-mode.adoc index 7fd3563a2e..aac3325dd8 100644 --- a/modules/developer-cli-odo-deploying-a-database-in-interactive-mode.adoc +++ b/modules/developer-cli-odo-deploying-a-database-in-interactive-mode.adoc @@ -11,8 +11,14 @@ * Run the interactive mode and answer the prompts: + +[source,terminal] ---- $ odo service create +---- ++ +.Example output +[source,terminal] +---- ? Which kind of service do you wish to create database ? Which database service class should we use mongodb-persistent ? Enter a value for string property DATABASE_SERVICE_NAME (Database Service Name): mongodb diff --git a/modules/developer-cli-odo-deploying-a-database-manually.adoc b/modules/developer-cli-odo-deploying-a-database-manually.adoc index 44c0002da3..1291b7cd5a 100644 --- a/modules/developer-cli-odo-deploying-a-database-manually.adoc +++ b/modules/developer-cli-odo-deploying-a-database-manually.adoc @@ -7,8 +7,14 @@ . List the available services: + +[source,terminal] ---- $ odo catalog list services +---- ++ +.Example output +[source,terminal] +---- NAME PLANS django-psql-persistent default jenkins-ephemeral default @@ -23,8 +29,14 @@ rails-pgsql-persistent default . Choose the `mongodb-persistent` type of service and see the required parameters: + +[source,terminal] ---- $ odo catalog describe service mongodb-persistent +---- ++ +.Example output +[source,terminal] +---- *********************** | ***************************************************** Name | default ----------------- | ----------------- @@ -51,6 +63,7 @@ $ odo catalog describe service mongodb-persistent . Pass the required parameters as flags and wait for the deployment of the database: + +[source,terminal] ---- $ odo service create mongodb-persistent --plan default --wait -p DATABASE_SERVICE_NAME=mongodb -p MEMORY_LIMIT=512Mi -p MONGODB_DATABASE=sampledb -p VOLUME_CAPACITY=1Gi ---- diff --git a/modules/developer-cli-odo-deploying-a-java-application-using-a-devfile.adoc b/modules/developer-cli-odo-deploying-a-java-application-using-a-devfile.adoc index 82a540af11..e93eb89d97 100644 --- a/modules/developer-cli-odo-deploying-a-java-application-using-a-devfile.adoc +++ b/modules/developer-cli-odo-deploying-a-java-application-using-a-devfile.adoc @@ -11,105 +11,117 @@ In this section, you will learn how to deploy a sample Java project that uses Ma . Create a directory to store the source code of your component: + +[source,terminal] ---- - $ mkdir +$ mkdir ---- . Create a component configuration of Spring Boot component type named `myspring` and download its sample project: + +[source,terminal] ---- - $ odo create java-spring-boot myspring --downloadSource +$ odo create java-spring-boot myspring --downloadSource ---- + The previous command produces the following output: + +[source,terminal] ---- - Experimental mode is enabled, use at your own risk +Experimental mode is enabled, use at your own risk - Validation - ✓ Checking devfile compatibility [195728ns] - ✓ Creating a devfile component from registry: DefaultDevfileRegistry [170275ns] - ✓ Validating devfile component [281940ns] +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 ---- + The `odo create` command downloads the associated `devfile.yaml` file from the recorded devfile registries. . List the contents of the directory to confirm that the devfile and the sample Java application were downloaded: + +[source,terminal] ---- - $ ls +$ ls ---- + The previous command produces the following output: + +[source,terminal] ---- - README.md devfile.yaml pom.xml src +README.md devfile.yaml pom.xml src ---- . Create a URL to access the deployed component: + +[source,terminal] ---- - $ odo url create --host apps-crc.testing +$ odo url create --host apps-crc.testing ---- + The previous command produces the following output: + +[source,terminal] ---- - ✓ URL myspring-8080.apps-crc.testing created for component: myspring +✓ URL myspring-8080.apps-crc.testing created for component: myspring - To apply the URL configuration changes, please use odo push +To apply the URL configuration changes, please use odo push ---- + NOTE: You must use your cluster host domain name when creating the URL. . Push the component to the cluster: + +[source,terminal] ---- - $ odo push +$ odo push ---- + The previous command produces the following output: + +[source,terminal] ---- - Validation - ✓ Validating the devfile [81808ns] +Validation + ✓ Validating the devfile [81808ns] - Creating Kubernetes resources for component myspring - ✓ Waiting for component to start [5s] +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 +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] +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] +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] - Pushing devfile component myspring - ✓ Changes successfully pushed to component +Pushing devfile component myspring + ✓ Changes successfully pushed to component ---- . List the URLs of the component to verify that the component was pushed successfully: + +[source,terminal] ---- - $ odo url list +$ odo url list ---- + The previous command produces the following output: + +[source,terminal] ---- - Found the following URLs for component myspring - NAME URL PORT SECURE - myspring-8080 http://myspring-8080.apps-crc.testing 8080 false +Found the following URLs for component myspring +NAME URL PORT SECURE +myspring-8080 http://myspring-8080.apps-crc.testing 8080 false ---- . View your deployed application by using the generated URL: + +[source,terminal] ---- - $ curl http://myspring-8080.apps-crc.testing +$ curl http://myspring-8080.apps-crc.testing ---- diff --git a/modules/developer-cli-odo-deploying-the-back-end-component.adoc b/modules/developer-cli-odo-deploying-the-back-end-component.adoc index 01bfb7508c..e391120345 100644 --- a/modules/developer-cli-odo-deploying-the-back-end-component.adoc +++ b/modules/developer-cli-odo-deploying-the-back-end-component.adoc @@ -12,6 +12,7 @@ To create a Java component, import the Java builder image, download the Java app . Import `openjdk18` into the cluster: + +[source,terminal] ---- $ oc import-image openjdk18 \ --from=registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift --confirm @@ -19,14 +20,21 @@ $ oc import-image openjdk18 \ . Tag the image as `builder` to make it accessible for {odo-title}: + +[source,terminal] ---- $ oc annotate istag/openjdk18:latest tags=builder ---- . Run `odo catalog list components` to see the created image: + +[source,terminal] ---- $ odo catalog list components +---- ++ +.Example output +[source,terminal] +---- Odo Supported OpenShift Components: NAME PROJECT TAGS nodejs openshift 10,8,8-RHOAR,latest @@ -35,28 +43,48 @@ openjdk18 myproject latest . Create a directory for your components: + +[source,terminal] ---- $ mkdir my_components $$ cd my_components ---- . Download the example back-end application: + +[source,terminal] ---- -$ git clone https://github.com/openshift-evangelists/Wild-West-Backend backend +$ git clone https://github.com/openshift-evangelists/Wild-West-Backend backend ---- -. Change directory to the back-end source directory and check that you have the correct files in the directory: +. Change to the back-end source directory: + +[source,terminal] ---- $ cd backend +---- + +. Check that you have the correct files in the directory: ++ +[source,terminal] +---- $ ls +---- ++ +.Example output +[source,terminal] +---- debug.sh pom.xml src ---- . Build the back-end source files with Maven to create a JAR file: + +[source,terminal] ---- $ mvn package +---- ++ +.Example output +[source,terminal] +---- ... [INFO] -------------------------------------- [INFO] BUILD SUCCESS @@ -69,18 +97,30 @@ $ mvn package . Create a component configuration of Java component-type named `backend`: + +[source,terminal] ---- $ odo create openjdk18 backend --binary target/wildwest-1.0.jar +---- ++ +.Example output +[source,terminal] +---- ✓ Validating component [1ms] Please use `odo push` command to create the component with source deployed ----- +---- + Now the configuration file `config.yaml` is in the local directory of the back-end component that contains information about the component for deployment. - + . Check the configuration settings of the back-end component in the `config.yaml` file using: + +[source,terminal] ---- $ odo config view +---- ++ +.Example output +[source,terminal] +---- COMPONENT SETTINGS ------------------------------------------------ PARAMETER CURRENT_VALUE @@ -98,12 +138,18 @@ DebugPort Ignore MinCPU MaxCPU ----- +---- -. Push the component to the {product-title} cluster. +. Push the component to the {product-title} cluster. + +[source,terminal] ---- $ odo push +---- ++ +.Example output +[source,terminal] +---- Validation ✓ Checking component [6ms] @@ -116,7 +162,7 @@ Pushing to component backend of type binary ✓ Waiting for component to start [48s] ✓ Syncing files to the component [811ms] ✓ Building component [3s] ----- +---- + Using `odo push`, {product-title} creates a container to host the back-end component, deploys the container into a Pod running on the {product-title} cluster, and starts the `backend` component. @@ -124,15 +170,27 @@ Using `odo push`, {product-title} creates a container to host the back-end compo * The status of the action in {odo-title}: + +[source,terminal] +---- +$ odo log -f +---- ++ +.Example output +[source,terminal] ---- -odo log -f 2019-09-30 20:14:19.738 INFO 444 --- [ main] c.o.wildwest.WildWestApplication : Starting WildWestApplication v1.0 onbackend-app-1-9tnhc with PID 444 (/deployments/wildwest-1.0.jar started by jboss in /deployments) ---- * The status of the back-end component: + +[source,terminal] ---- $ odo list +---- ++ +.Example output +[source,terminal] +---- APP NAME TYPE SOURCE STATE app backend openjdk18 file://target/wildwest-1.0.jar Pushed ---- diff --git a/modules/developer-cli-odo-deploying-the-front-end-component.adoc b/modules/developer-cli-odo-deploying-the-front-end-component.adoc index 3f9beb1ada..b1716c74d7 100644 --- a/modules/developer-cli-odo-deploying-the-front-end-component.adoc +++ b/modules/developer-cli-odo-deploying-the-front-end-component.adoc @@ -20,22 +20,30 @@ To create and deploy a front-end component, download the Node.js application and . Download the example front-end application: + +[source,terminal] ---- $ git clone https://github.com/openshift/nodejs-ex ---- . Change the current directory to the front-end directory: + +[source,terminal] ---- $ cd ----- +---- . List the contents of the directory to see that the front end is a Node.js application. + +[source,terminal] ---- $ ls +---- ++ +.Example output +[source,terminal] +---- assets bin index.html kwww-frontend.iml package.json package-lock.json playfield.png README.md server.js ----- +---- + [NOTE] ==== @@ -44,8 +52,14 @@ The front-end component is written in an interpreted language (Node.js); it does . Create a component configuration of Node.js component-type named `frontend`: + +[source,terminal] ---- $ odo create nodejs frontend +---- ++ +.Example output +[source,terminal] +---- ✓ Validating component [5ms] Please use `odo push` command to create the component with source deployed ---- @@ -53,15 +67,27 @@ Please use `odo push` command to create the component with source deployed ifdef::database[] . Create a URL to access the frontend interface. + +[source,terminal] ---- $ odo url create myurl +---- ++ +.Example output +[source,terminal] +---- ✓ URL myurl created for component: nodejs-nodejs-ex-pmdp ---- . Push the component to the {product-title} cluster. + +[source,terminal] ---- $ odo push +---- ++ +.Example output +[source,terminal] +---- Validation ✓ Checking component [7ms] @@ -82,10 +108,16 @@ Validation endif::database[] ifdef::multi[] -. Push the component to a running container. +. Push the component to a running container. + +[source,terminal] ---- $ odo push +---- ++ +.Example output +[source,terminal] +---- Validation ✓ Checking component [8ms] diff --git a/modules/developer-cli-odo-exposing-the-components-to-the-public.adoc b/modules/developer-cli-odo-exposing-the-components-to-the-public.adoc index 6d82846216..54c61143a4 100644 --- a/modules/developer-cli-odo-exposing-the-components-to-the-public.adoc +++ b/modules/developer-cli-odo-exposing-the-components-to-the-public.adoc @@ -8,20 +8,38 @@ .Procedure -. Create an external URL for the application: +. Navigate to the `frontend` directory: + +[source,terminal] ---- $ cd frontend +---- + +. Create an external URL for the application: ++ +[source,terminal] +---- $ odo url create frontend --port 8080 +---- ++ +.Example output +[source,terminal] +---- ✓ URL frontend created for component: frontend To create URL on the OpenShift cluster, use `odo push` ----- +---- . Apply the changes: + +[source,terminal] ---- $ odo push +---- ++ +.Example output +[source,terminal] +---- Validation ✓ Checking component [21ms] @@ -35,7 +53,7 @@ Applying URL changes Pushing to component frontend of type local ✓ Checking file changes for pushing [1ms] ✓ No file changes detected, skipping build. Use the '-f' flag to force the build. ----- +---- . Open the URL in a browser to view the application. @@ -47,8 +65,13 @@ If an application requires permissions to the active Service Account to access t To resolve this error, add permissions for the Service Account role: +[source,terminal] ---- $ oc policy add-role-to-group view system:serviceaccounts -n +---- + +[source,terminal] +---- $ oc policy add-role-to-group edit system:serviceaccounts -n ---- diff --git a/modules/developer-cli-odo-installing-odo-on-linux.adoc b/modules/developer-cli-odo-installing-odo-on-linux.adoc index 1a916d12b3..0cf3e69325 100644 --- a/modules/developer-cli-odo-installing-odo-on-linux.adoc +++ b/modules/developer-cli-odo-installing-odo-on-linux.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * cli_reference/developer_cli_odo/installing-odo.adoc +// * cli_reference/developer_cli_odo/installing-odo.adoc [id="installing-odo-on-linux"] @@ -8,14 +8,36 @@ == Binary installation +.Procedure + +. Obtain the binary: ++ +[source,terminal] ---- # curl -L https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-linux-amd64 -o /usr/local/bin/odo +---- + +. Change the permissions on the file: ++ +[source,terminal] +---- # chmod +x /usr/local/bin/odo ---- == Tarball installation +.Procedure + +. Obtain the tarball: ++ +[source,terminal] ---- # sh -c 'curl -L https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-linux-amd64.tar.gz | gzip -d > /usr/local/bin/odo' +---- + +. Change the permissions on the file: ++ +[source,terminal] +---- # chmod +x /usr/local/bin/odo ----- \ No newline at end of file +---- diff --git a/modules/developer-cli-odo-installing-odo-on-macos.adoc b/modules/developer-cli-odo-installing-odo-on-macos.adoc index bffdcbf7eb..066f067e7d 100644 --- a/modules/developer-cli-odo-installing-odo-on-macos.adoc +++ b/modules/developer-cli-odo-installing-odo-on-macos.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * cli_reference/developer_cli_odo/installing-odo.adoc +// * cli_reference/developer_cli_odo/installing-odo.adoc [id="installing-odo-on-macos"] @@ -8,14 +8,36 @@ == Binary installation +.Procedure + +. Obtain the binary: ++ +[source,terminal] ---- # curl -L https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-darwin-amd64 -o /usr/local/bin/odo +---- + +. Change the permissions on the file: ++ +[source,terminal] +---- # chmod +x /usr/local/bin/odo ---- == Tarball installation +.Procedure + +. Obtain the tarball: ++ +[source,terminal] ---- # sh -c 'curl -L https://mirror.openshift.com/pub/openshift-v4/clients/odo/latest/odo-darwin-amd64.tar.gz | gzip -d > /usr/local/bin/odo' +---- + +. Change the permissions on the file: ++ +[source,terminal] +---- # chmod +x /usr/local/bin/odo ----- \ No newline at end of file +---- diff --git a/modules/developer-cli-odo-linking-both-components.adoc b/modules/developer-cli-odo-linking-both-components.adoc index 34d999a26e..849c35b995 100644 --- a/modules/developer-cli-odo-linking-both-components.adoc +++ b/modules/developer-cli-odo-linking-both-components.adoc @@ -11,8 +11,14 @@ Components running on the cluster need to be connected in order to interact. {pr . List all the components that are running on the cluster: + +[source,terminal] ---- $ odo list +---- ++ +.Example output +[source,terminal] +---- APP NAME TYPE SOURCE STATE app backend openjdk18 file://target/wildwest-1.0.jar Pushed app frontend nodejs file://./ Pushed @@ -21,8 +27,14 @@ app frontend nodejs file://./ Pushed . Link the current front-end component to the backend: + +[source,terminal] ---- $ odo link backend --port 8080 +---- ++ +.Example output +[source,terminal] +---- ✓ Component backend has been successfully linked from the component frontend Following environment variables were added to frontend component: @@ -30,4 +42,4 @@ Following environment variables were added to frontend component: - COMPONENT_BACKEND_PORT ---- + -The configuration information of the back-end component is added to the front-end component and the front-end component restarts. \ No newline at end of file +The configuration information of the back-end component is added to the front-end component and the front-end component restarts. diff --git a/modules/developer-cli-odo-listing-available-devfile-components.adoc b/modules/developer-cli-odo-listing-available-devfile-components.adoc index 94ed960810..83de39fa21 100644 --- a/modules/developer-cli-odo-listing-available-devfile-components.adoc +++ b/modules/developer-cli-odo-listing-available-devfile-components.adoc @@ -5,18 +5,20 @@ [id="listing-available-devfile-components_{context}"] = Listing available devfile components -With `{odo-title}`, you can display all the components that are available for you on the cluster. Components that are available depend on the configuration of your cluster. +With `{odo-title}`, you can display all the components that are available for you on the cluster. Components that are available depend on the configuration of your cluster. .Procedure . To list available devfile components on your cluster, run: + +[source,terminal] ---- $ odo catalog list components was ---- + The output lists the available `{odo-title}` components: + +[source,terminal] ---- Odo OpenShift Components: NAME PROJECT TAGS SUPPORTED diff --git a/modules/developer-cli-odo-listing-available-services-from-the-operators-installed-on-the-cluster.adoc b/modules/developer-cli-odo-listing-available-services-from-the-operators-installed-on-the-cluster.adoc index 906f2b08f2..07b5c2f446 100644 --- a/modules/developer-cli-odo-listing-available-services-from-the-operators-installed-on-the-cluster.adoc +++ b/modules/developer-cli-odo-listing-available-services-from-the-operators-installed-on-the-cluster.adoc @@ -6,10 +6,11 @@ = Listing available services from the Operators installed on the cluster -With `{odo-title}`, you can display the list of the Operators installed on your cluster, and the services they provide. +With `{odo-title}`, you can display the list of the Operators installed on your cluster, and the services they provide. * To list the Operators installed in current project, run: + +[source,terminal] ---- $ odo catalog list services ---- @@ -17,7 +18,8 @@ $ odo catalog list services The command lists Operators and the CRDs. The output of the command shows the Operators installed on your cluster. For example: + ----- +[source,terminal] +---- Operators available in the cluster NAME CRDs etcdoperator.v0.9.4 EtcdCluster, EtcdBackup, EtcdRestore diff --git a/modules/developer-cli-odo-mirroring-a-supported-builder-image.adoc b/modules/developer-cli-odo-mirroring-a-supported-builder-image.adoc index f1badb755e..66aaa6f76e 100644 --- a/modules/developer-cli-odo-mirroring-a-supported-builder-image.adoc +++ b/modules/developer-cli-odo-mirroring-a-supported-builder-image.adoc @@ -12,8 +12,14 @@ To use npm packages for Node.js dependencies and Maven packages for Java depende . Verify that the required images tag is not imported: + +[source,terminal] ---- $ oc describe is nodejs -n openshift +---- ++ +.Example output +[source,terminal] +---- Name: nodejs Namespace: openshift [...] @@ -45,12 +51,14 @@ Namespace: openshift . Mirror the supported image tag to the private registry: + +[source,terminal] ---- $ oc image mirror registry.access.redhat.com/rhscl/nodejs-10-rhel7: /rhscl/nodejs-10-rhel7: ---- . Import the image: + +[source,terminal] ---- $ oc tag :/rhscl/nodejs-10-rhel7: nodejs-10-rhel7:latest --scheduled ---- @@ -59,8 +67,14 @@ You must periodically re-import the image. The `--scheduled` flag enables automa . Verify that the images with the given tag have been imported: + +[source,terminal] ---- $ oc describe is nodejs -n openshift +---- ++ +.Example output +[source,terminal] +---- Name: nodejs [...] 10-SCL (latest) diff --git a/modules/developer-cli-odo-modifying-the-running-application.adoc b/modules/developer-cli-odo-modifying-the-running-application.adoc index 03c612409f..896636dabc 100644 --- a/modules/developer-cli-odo-modifying-the-running-application.adoc +++ b/modules/developer-cli-odo-modifying-the-running-application.adoc @@ -10,14 +10,16 @@ . Change the local directory to the front-end directory: + +[source,terminal] ---- $ cd ~/frontend ---- . Monitor the changes on the file system using: + +[source,terminal] ---- -$ odo watch +$ odo watch ---- . Edit the `index.html` file to change the displayed name for the game. @@ -29,6 +31,7 @@ A slight delay is possible before {odo-title} recognizes the change. + {odo-title} pushes the changes to the front-end component and prints its status to the terminal: + +[source,terminal] ---- File /root/frontend/index.html changed File changed diff --git a/modules/developer-cli-odo-modifying-your-application-code.adoc b/modules/developer-cli-odo-modifying-your-application-code.adoc index de8d3fb5fc..ddef73601a 100644 --- a/modules/developer-cli-odo-modifying-your-application-code.adoc +++ b/modules/developer-cli-odo-modifying-your-application-code.adoc @@ -11,7 +11,8 @@ You can modify your application code and have the changes applied to your applic . Update your component: + +[source,terminal] ---- $ odo push ---- -. Refresh your application in the browser to see the changes. \ No newline at end of file +. Refresh your application in the browser to see the changes. diff --git a/modules/developer-cli-odo-overwriting-a-mirror-registry.adoc b/modules/developer-cli-odo-overwriting-a-mirror-registry.adoc index d2ef60f470..dab40aa2d5 100644 --- a/modules/developer-cli-odo-overwriting-a-mirror-registry.adoc +++ b/modules/developer-cli-odo-overwriting-a-mirror-registry.adoc @@ -3,7 +3,7 @@ // cli_reference/developer_cli_odo/using_odo_in_a_restricted_environment/creating-and-deploying-a-component-to-the-disconnected-cluster [id="overwriting-the-mirror-registry_{context}"] -= Overwriting the mirror registry += Overwriting the mirror registry To download npm packages for Node.js dependencies and Maven packages for Java dependencies from a private mirror registry, you must create and configure a mirror npm or Maven registry on the cluster. You can then overwrite the mirror registry on an existing component or when you create a new component. @@ -11,13 +11,14 @@ To download npm packages for Node.js dependencies and Maven packages for Java de * To overwrite the mirror registry on an existing component: + +[source,terminal] ---- $ odo config set --env NPM_MIRROR= ---- * To overwrite the mirror registry when creating a component: + +[source,terminal] ---- $ odo component create nodejs --env NPM_MIRROR= ---- - diff --git a/modules/developer-cli-odo-pushing-the-odo-init-image-to-a-mirror-registry.adoc b/modules/developer-cli-odo-pushing-the-odo-init-image-to-a-mirror-registry.adoc index d6957e87ac..8b7ea360b3 100644 --- a/modules/developer-cli-odo-pushing-the-odo-init-image-to-a-mirror-registry.adoc +++ b/modules/developer-cli-odo-pushing-the-odo-init-image-to-a-mirror-registry.adoc @@ -15,30 +15,35 @@ Depending on your operating system, you can push the `odo` init image to a clust . Use `base64` to encode the root certification authority (CA) content of your mirror registry: + +[source,terminal] ---- $ echo | base64 -d > disconnect-ca.crt ---- . Copy the encoded root CA certificate to the appropriate location: + +[source,terminal] ---- $ sudo cp ./disconnect-ca.crt /etc/pki/ca-trust/source/anchors/.crt ---- . Trust a CA in your client platform and log into the {product-title} mirror registry: + +[source,terminal] ---- $ sudo update-ca-trust enable && sudo systemctl daemon-reload && sudo systemctl restart / docker && docker login :5000 -u -p ---- . Mirror the `odo` init image: + +[source,terminal] ---- $ oc image mirror registry.access.redhat.com/openshiftdo/odo-init-image-rhel7: :5000/openshiftdo/odo-init-image-rhel7: ---- . Override the default `odo` init image path by setting the `ODO_BOOTSTRAPPER_IMAGE` environment variable: + +[source,terminal] ---- $ export ODO_BOOTSTRAPPER_IMAGE=:5000/openshiftdo/odo-init-image-rhel7: ---- @@ -52,6 +57,7 @@ $ export ODO_BOOTSTRAPPER_IMAGE=:5000/openshiftdo/odo-init-imag . Use `base64` to encode the root certification authority (CA) content of your mirror registry: + +[source,terminal] ---- $ echo | base64 -d > disconnect-ca.crt ---- @@ -62,18 +68,21 @@ $ echo | base64 -d > disconnect-ca.crt + .. Run the following command: + +[source,terminal] ---- $ docker login :5000 -u -p ---- . Mirror the `odo` init image: + +[source,terminal] ---- $ oc image mirror registry.access.redhat.com/openshiftdo/odo-init-image-rhel7: :5000/openshiftdo/odo-init-image-rhel7: ---- . Override the default `odo` init image path by setting the `ODO_BOOTSTRAPPER_IMAGE` environment variable: + +[source,terminal] ---- $ export ODO_BOOTSTRAPPER_IMAGE=:5000/openshiftdo/odo-init-image-rhel7: ---- @@ -86,12 +95,14 @@ $ export ODO_BOOTSTRAPPER_IMAGE=:5000/openshiftdo/odo-init-imag . Use `base64` to encode the root certification authority (CA) content of your mirror registry: + +[source,terminal] ---- PS C:\> echo | base64 -d > disconnect-ca.crt ---- . As an administrator, copy the encoded root CA certificate to the appropriate location by executing the following command: + +[source,terminal] ---- PS C:\WINDOWS\system32> certutil -addstore -f "ROOT" disconnect-ca.crt ---- @@ -102,18 +113,21 @@ PS C:\WINDOWS\system32> certutil -addstore -f "ROOT" disconnect-ca.crt + .. Run the following command: + +[source,terminal] ---- PS C:\WINDOWS\system32> docker login :5000 -u -p ---- . Mirror the `odo` init image: + +[source,terminal] ---- PS C:\> oc image mirror registry.access.redhat.com/openshiftdo/odo-init-image-rhel7: :5000/openshiftdo/odo-init-image-rhel7: ---- . Override the default `odo` init image path by setting the `ODO_BOOTSTRAPPER_IMAGE` environment variable: + +[source,terminal] ---- PS C:\> $env:ODO_BOOTSTRAPPER_IMAGE=":5000/openshiftdo/odo-init-image-rhel7:" ---- diff --git a/modules/developer-cli-odo-pushing-the-odo-init-image-to-an-internal-registry-directly.adoc b/modules/developer-cli-odo-pushing-the-odo-init-image-to-an-internal-registry-directly.adoc index 1594691f83..7f3dd04ead 100644 --- a/modules/developer-cli-odo-pushing-the-odo-init-image-to-an-internal-registry-directly.adoc +++ b/modules/developer-cli-odo-pushing-the-odo-init-image-to-an-internal-registry-directly.adoc @@ -15,14 +15,21 @@ If your cluster allows images to be pushed to the internal registry directly, pu . Enable the default route: + +[source,terminal] ---- $ oc patch configs.imageregistry.operator.openshift.io cluster -p '{"spec":{"defaultRoute":true}}' --type='merge' -n openshift-image-registry ---- . Get a wildcard route CA: + +[source,terminal] ---- $ oc get secret router-certs-default -n openshift-ingress -o yaml +---- ++ +.Example output +[source,terminal] +---- apiVersion: v1 data: tls.crt: ************************** @@ -35,18 +42,21 @@ type: kubernetes.io/tls . Use `base64` to encode the root certification authority (CA) content of your mirror registry: + +[source,terminal] ---- $ echo | base64 -d > ca.crt ---- . Trust a CA in your client platform: + +[source,terminal] ---- $ sudo cp ca.crt /etc/pki/ca-trust/source/anchors/externalroute.crt && sudo update-ca-trust enable && sudo systemctl daemon-reload && sudo systemctl restart docker ---- . Log into the internal registry: + +[source,terminal] ---- $ oc get route -n openshift-image-registry NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD @@ -57,6 +67,7 @@ $ docker login -u kubeadmin -p $(oc whoami -t) . Push the `odo` init image: + +[source,terminal] ---- $ docker pull registry.access.redhat.com/openshiftdo/odo-init-image-rhel7: @@ -67,6 +78,7 @@ $ docker push /openshiftdo/odo-init-image-rhel7: . Override the default `odo` init image path by setting the `ODO_BOOTSTRAPPER_IMAGE` environment variable: + +[source,terminal] ---- $ export ODO_BOOTSTRAPPER_IMAGE=/openshiftdo/odo-init-image-rhel7:1.0.1 ---- @@ -80,14 +92,21 @@ $ export ODO_BOOTSTRAPPER_IMAGE=/openshiftdo/odo-init-image-rhel7 . Enable the default route: + +[source,terminal] ---- $ oc patch configs.imageregistry.operator.openshift.io cluster -p '{"spec":{"defaultRoute":true}}' --type='merge' -n openshift-image-registry ---- . Get a wildcard route CA: + +[source,terminal] ---- $ oc get secret router-certs-default -n openshift-ingress -o yaml +---- ++ +.Example output +[source,terminal] +---- apiVersion: v1 data: tls.crt: ************************** @@ -100,18 +119,21 @@ type: kubernetes.io/tls . Use `base64` to encode the root certification authority (CA) content of your mirror registry: + +[source,terminal] ---- $ echo | base64 -d > ca.crt ---- . Trust a CA in your client platform: + +[source,terminal] ---- $ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca.crt ---- . Log into the internal registry: + +[source,terminal] ---- $ oc get route -n openshift-image-registry NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD @@ -122,6 +144,7 @@ $ docker login -u kubeadmin -p $(oc whoami -t) . Push the `odo` init image: + +[source,terminal] ---- $ docker pull registry.access.redhat.com/openshiftdo/odo-init-image-rhel7: @@ -132,6 +155,7 @@ $ docker push /openshiftdo/odo-init-image-rhel7: . Override the default `odo` init image path by setting the `ODO_BOOTSTRAPPER_IMAGE` environment variable: + +[source,terminal] ---- $ export ODO_BOOTSTRAPPER_IMAGE=/openshiftdo/odo-init-image-rhel7:1.0.1 ---- @@ -145,14 +169,21 @@ $ export ODO_BOOTSTRAPPER_IMAGE=/openshiftdo/odo-init-image-rhel7 . Enable the default route: + +[source,terminal] ---- PS C:\> oc patch configs.imageregistry.operator.openshift.io cluster -p '{"spec":{"defaultRoute":true}}' --type='merge' -n openshift-image-registry ---- . Get a wildcard route CA: + +[source,terminal] ---- PS C:\> oc get secret router-certs-default -n openshift-ingress -o yaml +---- ++ +.Example output +[source,terminal] +---- apiVersion: v1 data: tls.crt: ************************** @@ -165,18 +196,21 @@ type: kubernetes.io/tls . Use `base64` to encode the root certification authority (CA) content of your mirror registry: + +[source,terminal] ---- PS C:\> echo | base64 -d > ca.crt ---- . As an administrator, trust a CA in your client platform by executing the following command: + +[source,terminal] ---- PS C:\WINDOWS\system32> certutil -addstore -f "ROOT" ca.crt ---- . Log into the internal registry: + +[source,terminal] ---- PS C:\> oc get route -n openshift-image-registry NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD @@ -187,6 +221,7 @@ PS C:\> docker login -u kubeadmin -p $(oc whoami -t) . Push the `odo` init image: + +[source,terminal] ---- PS C:\> docker pull registry.access.redhat.com/openshiftdo/odo-init-image-rhel7: @@ -197,6 +232,7 @@ PS C:\> docker push /openshiftdo/odo-init-image-rhel7: . Override the default `odo` init image path by setting the `ODO_BOOTSTRAPPER_IMAGE` environment variable: + +[source,terminal] ---- PS C:\> $env:ODO_BOOTSTRAPPER_IMAGE="/openshiftdo/odo-init-image-rhel7:" ---- diff --git a/modules/developer-cli-odo-sample-applications.adoc b/modules/developer-cli-odo-sample-applications.adoc index 7f9d3b5351..d3febf54af 100644 --- a/modules/developer-cli-odo-sample-applications.adoc +++ b/modules/developer-cli-odo-sample-applications.adoc @@ -10,6 +10,7 @@ This example helps build and serve static content using httpd on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/sclorg/httpd-container/blob/master/2.4/root/usr/share/container-scripts/httpd/README.md[Apache HTTP Server container image repository]. +[source,terminal] ---- $ odo create httpd --git https://github.com/openshift/httpd-ex.git ---- @@ -18,6 +19,7 @@ $ odo create httpd --git https://github.com/openshift/httpd-ex.git This example helps build and run fat JAR Java applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/fabric8io-images/s2i/blob/master/README.md[Java S2I Builder image]. +[source,terminal] ---- $ odo create java --git https://github.com/spring-projects/spring-petclinic.git ---- @@ -26,6 +28,7 @@ $ odo create java --git https://github.com/spring-projects/spring-petclinic.git Build and run Node.js applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/sclorg/s2i-nodejs-container/blob/master/8/README.md[Node.js 8 container image]. +[source,terminal] ---- $ odo create nodejs --git https://github.com/openshift/nodejs-ex.git ---- @@ -34,6 +37,7 @@ $ odo create nodejs --git https://github.com/openshift/nodejs-ex.git This example helps build and run Perl applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/sclorg/s2i-perl-container/blob/master/5.26/README.md[Perl 5.26 container image]. +[source,terminal] ---- $ odo create perl --git https://github.com/openshift/dancer-ex.git ---- @@ -42,6 +46,7 @@ $ odo create perl --git https://github.com/openshift/dancer-ex.git This example helps build and run PHP applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/sclorg/s2i-php-container/blob/master/7.1/README.md[PHP 7.1 Docker image]. +[source,terminal] ---- $ odo create php --git https://github.com/openshift/cakephp-ex.git ---- @@ -50,6 +55,7 @@ $ odo create php --git https://github.com/openshift/cakephp-ex.git This example helps build and run Python applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/sclorg/s2i-python-container/blob/master/3.6/README.md[Python 3.6 container image]. +[source,terminal] ---- $ odo create python --git https://github.com/openshift/django-ex.git ---- @@ -58,6 +64,7 @@ $ odo create python --git https://github.com/openshift/django-ex.git This example helps build and run Ruby applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see link:https://github.com/sclorg/s2i-ruby-container/blob/master/2.5/README.md[Ruby 2.5 container image]. +[source,terminal] ---- $ odo create ruby --git https://github.com/openshift/ruby-ex.git ---- @@ -66,6 +73,7 @@ $ odo create ruby --git https://github.com/openshift/ruby-ex.git This example helps build and run WildFly applications on CentOS 7. For more information about using this builder image, including {product-title} considerations, see the link:https://github.com/wildfly/wildfly-s2i/blob/master/README.md[Wildfly - CentOS Docker images for OpenShift]. +[source,terminal] ---- $ odo create wildfly --git https://github.com/openshift/openshift-jee-sample.git ---- @@ -76,6 +84,7 @@ $ odo create wildfly --git https://github.com/openshift/openshift-jee-sample.git Java can be used to deploy a binary artifact as follows: +[source,terminal] ---- $ git clone https://github.com/spring-projects/spring-petclinic.git $ cd spring-petclinic @@ -88,6 +97,7 @@ $ odo push WildFly can be used to deploy a binary application as follows: +[source,terminal] ---- $ git clone https://github.com/openshiftdemos/os-sample-java-web.git $ cd os-sample-java-web diff --git a/modules/developer-cli-odo-setting-and-unsetting-environment-variables.adoc b/modules/developer-cli-odo-setting-and-unsetting-environment-variables.adoc index 89924f1971..99c867d593 100644 --- a/modules/developer-cli-odo-setting-and-unsetting-environment-variables.adoc +++ b/modules/developer-cli-odo-setting-and-unsetting-environment-variables.adoc @@ -10,18 +10,21 @@ * To set an environment variable in a component: + +[source,terminal] ---- $ odo config set --env = ---- * To unset an environment variable in a component: + +[source,terminal] ---- $ odo config unset --env ---- * To list all environment variables in a component: + +[source,terminal] ---- $ odo config view ---- diff --git a/modules/developer-cli-odo-using-command-completion.adoc b/modules/developer-cli-odo-using-command-completion.adoc index 18beb16745..c19cea9815 100644 --- a/modules/developer-cli-odo-using-command-completion.adoc +++ b/modules/developer-cli-odo-using-command-completion.adoc @@ -1,6 +1,6 @@ // Module included in the following assemblies: // -// * cli_reference/developer_cli_odo/configuring-the-odo-cli.adoc +// * cli_reference/developer_cli_odo/configuring-the-odo-cli.adoc [id="using-command-completion_{context}"] = Using command completion @@ -17,6 +17,7 @@ Currently command completion is only supported for bash, zsh, and fish shells. * To install command completion automatically: . Run: + +[source,terminal] ---- $ odo --complete ---- @@ -28,6 +29,7 @@ $ odo --complete * To disable completion: . Run: + +[source,terminal] ---- $ odo --uncomplete ---- @@ -37,4 +39,4 @@ $ odo --uncomplete [NOTE] ==== Re-enable command completion if you either rename the {odo-title} executable or move it to a different directory. -==== \ No newline at end of file +====