Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #84 from kabanero-io/83-jantley-091merge
Browse files Browse the repository at this point in the history
merge post-0.9 changes from master to release-0.9 branch
  • Loading branch information
alohr51 authored Jul 7, 2020
2 parents 49752df + 4205626 commit cad18b8
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 68 deletions.
10 changes: 5 additions & 5 deletions publish/app-logging-ocp-4.2/app-logging-ocp-4.2.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
permalink: /guides/app-logging-ocp-4-2/
layout: guide-markdown
title: Application Logging on Red Hat OpenShift Container Platform (RHOCP) 4.3 with Elasticsearch, Fluentd, and Kibana
title: Application Logging on Red Hat OpenShift Container Platform (RHOCP) 4.4 with Elasticsearch, Fluentd, and Kibana
duration: 30 minutes
releasedate: 2020-04-09
description: Learn how to do application logging on RHOCP 4.2 or RHOCP 4.3 with Elasticsearch, Fluentd, and Kibana.
description: Learn how to do application logging on RHOCP 4.2/RHOCP 4.3/RHOCP 4.4 with Elasticsearch, Fluentd, and Kibana.
tags: ['logging', 'Elasticsearch', 'Fluentd', 'Kibana']
guide-category: manage
---
Expand Down Expand Up @@ -32,7 +32,7 @@ guide-category: manage
//
-->

**The following guide has been tested with Red Hat OpenShift Container Platform (RHOCP) 4.2/Kabanero 0.3.0 and RHOCP 4.3/Kabanero 0.6.0.**
**The following guide has been tested with Red Hat OpenShift Container Platform (RHOCP) 4.2/Kabanero 0.3.0, RHOCP 4.3/Kabanero 0.6.0, and RHOCP 4.4/Kabanero 0.8.0.**

Pod processes running in Kubernetes frequently produce logs. To effectively manage this log data and ensure no loss of log data occurs when a pod terminates, a log aggregation tool should be deployed on the Kubernetes cluster. Log aggregation tools help users persist, search, and visualize the log data that is gathered from the pods across the cluster. Log aggregation tools in the market today include: EFK, LogDNA, Splunk, Datadog, IBM Operations Analytics, etc. When considering log aggregation tools, enterprises will make choices that are inclusive of their journey to cloud, both new cloud native applications running in Kubernetes and their existing traditional IT choices.

Expand All @@ -46,7 +46,7 @@ One choice for application logging with log aggregation, based on open source, i

## Install cluster logging

To install the cluster logging component, follow the OpenShift guide [Deploying cluster logging](https://docs.openshift.com/container-platform/4.3/logging/cluster-logging-deploying.html)
To install the cluster logging component, follow the OpenShift guide [Deploying cluster logging](https://docs.openshift.com/container-platform/4.4/logging/cluster-logging-deploying.html). Ensure you set up valid storage for Elasticsearch via Persistent Volumes. When the example Cluster Logging instance YAML from the guide is deployed, the Elasticsearch pods that are created will automatically search for Persistent Volumes to bind to; if there are none available for binding, the Elasticsearch pods will be stuck in a pending state. Using in-memory storage is also possible by removing the `storage` definition from the Cluster Logging instance YAML, but this is not suitable for production.

After the installation completes without any error, you can see the following pods that are running in the *openshift-logging* namespace. The exact number of pods running for each of the EFK components can vary depending on the configuration specified in the ClusterLogging Custom Resource (CR).

Expand Down Expand Up @@ -122,7 +122,7 @@ The **project.\*** index contains only a set of default fields at the start, whi

To refresh the index, click the **Management** option from the Kibana menu.

Click **Index Pattern**, and find the **project.pass:[*]** index in Index Pattern. Then, click the refresh fields button. After Kibana is updated with all the available fields in the **project.pass:[*]** index, import any preconfigured dashboards to view the application's logs.
Click **Index Pattern**, and find the **project.\*** index in Index Pattern. Then, click the refresh fields button. After Kibana is updated with all the available fields in the **project.\*** index, import any preconfigured dashboards to view the application's logs.

![Index refresh button on Kibana](/img/guide/app-logging-ocp-refresh-index.png)

Expand Down
183 changes: 183 additions & 0 deletions publish/codeready-workspaces/codeready-workspaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
---
permalink: /guide/codeready-workspaces/
layout: guide-markdown
title: Getting Started with CodeReady Workspaces
duration: 30 minutes
description: Use CodeReady Workspaces to develop cloud-native applications from an OpenShift cluster.
tags: ['codeready workspaces', 'openshift', 'codewind', 'microservice']
guide-category: basic
---

## Objectives
* Install CodeReady Workspaces and Codewind
* Develop a simple microservice that uses Eclipse Codewind on CodeReady Workspaces

## Overview
Use Eclipse Codewind to develop microservice applications from application stacks in an integrated developer environment (IDE). CodeReady Workspaces provides a containerized IDE for cloud native application development on an OpenShift cluster.

## Developing with CodeReady Workspaces
CodeReady Workspaces uses Kubernetes and containers to provide a preconfigured environment. Use CodeReady Workspaces to create, build, and test your code in OpenShift containers but feel like you are working on an IDE on your local computer.

### Prerequisite
Before you can use Codewind with CodeReady Workspaces, you must have an OpenShift cluster available. To install OpenShift clusters, see [CodeReady Containers](https://code-ready.github.io/crc/).

CodeReady Workspaces require at least two 5Gi ReadWriteOnce (RWO) persistent volumes on the cluster to install and a 5Gi RWO volume for each created workspace.

Each Codewind workspace also requires at least on 5Gi ReadWriteMany (RWX) persistent volume.

### Installing CodeReady Workspaces
To install CodeReady Workspaces, set `Spec.codeReadyWorkspaces.enable: true` in the Kabanero custom resource (Kabanero CR) instance and apply it.

To edit the Kabanero CR from the command line, run `oc edit kabanero -n kabanero`.

The following sample shows a Kabanero CR instance configuration:

```yaml
apiVersion: kabanero.io/v1alpha2
kind: Kabanero
metadata:
name: kabanero
spec:
version: "0.6.0"
codeReadyWorkspaces:
enable: true
operator:
customResourceInstance:
tlsSupport: true
selfSignedCert: true
stacks:
repositories:
- name: central
https:
url: https://github.com/kabanero-io/collections/releases/download/0.6.0/kabanero-index.yaml
```
### Configuring CodeReady Workspaces
The Kabanero CR instance provides extra fields for you to configure your installation of CodeReady Workspaces.
* If you want to install CodeReady Workspaces with TLS Support, set `Spec.codeReadyWorkspaces.operator.customResourceInstance.tlsSupport` to `true`.
**Note:** If your OpenShift cluster's router is set up with self-signed certificates, `Spec.codeReadyWorkspaces.operator.instance.selfSignedCert` must also be set to `true`.
* If you want to use your OpenShift accounts with CodeReady Workspaces, set up permanent users (accounts other than kube:admin) and then set `Spec.codeReadyWorkspaces.operator.customResourceInstance.openShiftOAuth` to `true`.
* To view the full list of configurable fields, see [Kabanero Custom Resource](https://www.ibm.com/support/knowledgecenter/SSCSJL_4.1.x/docs/ref/general/configuration/kabanero-cr-config.html).

### Setting up Codewind
Because of its dependency on `buildah`, Codewind needs to run as root and privileged. To enable Codewind, run the following commands from your command line:
* `oc adm policy add-scc-to-user anyuid system:serviceaccounts:<namespace where you installed CodeReady Workspaces>:che-workspace`
* `oc adm policy add-scc-to-user privileged system:serviceaccounts:<namespace where you installed CodeReady Workspaces>:che-workspace`

CodeReady Workspaces starts Codewind and installs the Codewind plug-ins. This process might take a couple of minutes for all of the necessary components to be pulled and started.

### Creating the Codewind workspace
After you set up Codewind, log in to your CodeReady Workspaces account and create a Codewind workspace from the Codewind devfile:

1. Log in to CodeReady Workspaces.
2. Go to **Workspaces** then click **Add Workspace**.
3. Click **Import Devfile**.
4. From **Source**, click **YAML**.
5. Go to the link, [codewind-che-plugin/0.13.0/devfile.yaml](https://raw.githubusercontent.com/eclipse/codewind-che-plugin/0.13.0/devfiles/0.13.0/devfile.yaml), then copy and paste the contents into the YAML text box in your Codewind workspace.
6. Click **Create & Open**.

### Configuring Codewind to use application stacks
Configure Codewind to use Appsody templates so you can focus exclusively on your code. Complete the following steps to select the Appsody templates:

1. Select **Codewind**.
2. Right-click **Projects**.
3. Select **Template Source Manager**.
4. Enable **Appsody Stacks - incubator** and **Default templates**.

After you configured Codewind to use Appsody templates, continue to develop your microservice within Codewind.

### Creating an Appsody project
Throughout the application lifestyle, Appsody helps you develop containerized applications and maximize containers curated for your usage.

1. Under the Explorer pane, select **Codewind**.
2. Expand **Codewind** by clicking the drop-down arrow.
3. Hover over the **Projects** entry underneath Codewind in the Explorer pane, and press the **+** icon to create a project.
* **Note:** Make sure that Docker is running. Otherwise, you get an error.
4. Choose the **Appsody Open Liberty default template (Appsody Stacks - incubator)**.
5. Name your project **appsody-calculator**.
* If you don't see Appsody templates, find and select **Template Source Manager** and enable **Appsody Stacks - incubator**.
* The templates are refreshed, and the Appsody templates are available.
6. Press **Enter**.
* To monitor your project's progress, right-click your project, and select **Show all logs**. Then, an **Output** tab is displayed where you see your project's build logs.

Your project is complete when you see that your application status is running and your build status is successful.

### Accessing the application endpoint in a browser
1. Return to your project under the **Explorer** pane.
2. Select the Open App icon next to your project's name, or right-click your project and select **Open App**.

Your application is now opened in a browser, showing the welcome to your Appsody microservice page.

### Adding a REST service to your application
1. Go to your project's workspace under the **Explorer** pane.
2. Go to `src>main>java>dev>appsody>starter`.
3. Right-click **starter** and select **New File**.
4. Create a file, name it `Calculator.java`, and press **Enter**. This file is your JAX-RS resource.
5. Before you input any code, make sure that the file is empty.
6. Populate the file with the following code and then **save** the file:

```java
package dev.appsody.starter;
import javax.ws.rs.core.Application;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.PathParam;
@Path("/calculator")
public class Calculator extends Application {
@GET
@Path("/aboutme")
@Produces(MediaType.TEXT_PLAIN)
public String aboutme() {
return "You can add (+), subtract (-), and multiply (*) with this simple calculator.";
}
@GET
@Path("/{op}/{a}/{b}")
@Produces(MediaType.TEXT_PLAIN)
public Response calculate(@PathParam("op") String op, @PathParam("a") String a, @PathParam("b") String b) {
int numA = Integer.parseInt(a);
int numB = Integer.parseInt(b);
switch (op) {
case "+":
return Response.ok(a + "+" + b + "=" + (Integer.toString((numA + numB)))).build();
case "-":
return Response.ok(a + "-" + b + "=" + (Integer.toString((numA - numB)))).build();
case "*":
return Response.ok(a + "*" + b + "=" + (Integer.toString((numA * numB)))).build();
default:
return Response.ok("Invalid operation. Please Try again").build();
}
}
}
```

Any changes that you make to your code are automatically built and redeployed by Codewind, and you can view them in your browser.

### Working with the example calculator microservice
You now can work with the example calculator microservice.

1. Use the port number that you saw when you first opened the application.
2. Make sure to remove the `< >` symbol in the URL.
3. `http://127.0.0.1:<port>/starter/calculator/aboutme`
4. You see the following response:

```
You can add (+), subtract (-), and multiply (*) with this simple calculator.
```

You can also try a few of the sample calculator functions:

* `http://127.0.0.1:<port>/starter/calculator/{op}/{a}/{b}`, where you can input one of the available operations `(+, _, *)`, and an integer a, and an integer b.
* So for `http://127.0.0.1:<port>/starter/calculator/+/10/3` you see: `10+3=13`.

## What you have learned
Now that you have completed this guide, you have learned to:

1. Install CodeReady Workspaces and Codewind
2. Develop your own microservice that uses Codewind on CodeReady Workspaces

## Next Steps
For more guides on developing cloud native microservice applications, see [IBM Knowledge Center's Getting Started](https://www.ibm.com/support/knowledgecenter/SSCSJL_4.1.x/guides/guides-gs.html).
8 changes: 4 additions & 4 deletions publish/curating-pipelines/curating-pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,17 @@ metadata:
name: kabanero
namespace: kabanero
spec:
version: "0.7.0"
version: "0.9.1"
stacks:
repositories:
- name: central
https:
url: https://github.com/kabanero-io/collections/releases/download/v0.7.0/kabanero-index.yaml
url: https://github.com/kabanero-io/collections/releases/download/v0.9.0/kabanero-index.yaml
pipelines:
- id: default
sha256: 14d59b7ebae113c18fb815c2ccfd8a846c5fbf91d926ae92e0017ca5caf67c95
sha256: deb5162495e1fe60ab52632f0879f9c9b95e943066590574865138791cbe948f
https:
url: https://github.com/kabanero-io/kabanero-pipelines/releases/download/0.7.0/default-kabanero-pipelines.tar.gz
url: https://github.com/kabanero-io/kabanero-pipelines/releases/download/0.9.1/default-kabanero-pipelines.tar.gz
```
As an alternative, you can specify the pipelines archive under individual stack sections. This configuration associates the pipelines in the archive with these application stacks.
Loading

0 comments on commit cad18b8

Please sign in to comment.