forked from openshift-labs/learn-katacoda
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for restructured tomcat-in-the-cloud
- Loading branch information
1 parent
bff880c
commit cc3c286
Showing
8 changed files
with
113 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tomcat-in-the-cloud/deploy-titc-using-cli/1_buildDependencies.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
In order to function properly, _Tomcat-in-the-cloud_ needs a member provider that will essentially discover all running instances of Tomcat in the cloud environment. Currently, we developed a member provider that works for _Kubernetes_ and _OpenShift_ called **CloudMemberProvider**. We plan on extending that list by providing support for more cloud services in the near future. | ||
|
||
_Tomcat-in-the-cloud_ also needs a way to establish connection throughout the cloud network so the HTTP requests can be sent to the right instances of the cluster. To do that, it depends upon another library that we call **CloudStreamProvider**. Stream providers can use a variety of different types of connections. We currently support unsecured and secured (via token) connections. | ||
|
||
The first step is therefore to build these dependencies. **It's important that you follow the building order described bellow** as those dependencies depend on each other. | ||
|
||
## A) Building CloudStreamProvider | ||
*Clone the CloudStreamProvider repository :* | ||
|
||
`git clone https://github.com/maxime-beck/cloudStreamProvider.git`{{execute}} | ||
|
||
*Run the building process using Maven :* | ||
|
||
`mvn -f cloudStreamProvider/pom.xml install`{{execute}} | ||
|
||
## B) Building CloudMemberProvider | ||
*Clone the CloudMemberProvider repository :* | ||
|
||
`git clone https://github.com/maxime-beck/cloudMemberProvider.git`{{execute}} | ||
|
||
*Run the building process using Maven :* | ||
|
||
`mvn -f cloudMemberProvider/pom.xml install`{{execute}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
OpenShift has the concept of "projects". These projects allow you to group components of a system together without interfering or conflicting with other deployments on the system. | ||
|
||
Using projects can make the management of large scale deployments much simpler. Instead of seeing all the applications deployed, you can focus your view depending on what you are trying to achieve. If required, it is still possible to see all deployed components at once. | ||
|
||
## Setting up the environment | ||
*Log into OpenShift :* | ||
|
||
`oc login localhost:8443 --username=admin --password=admin --insecure-skip-tls-verify=true`{{execute}} | ||
|
||
*We'll call this project "tomcat-in-the-cloud" :* | ||
|
||
`oc new-project tomcat-in-the-cloud`{{execute}} | ||
|
||
With the project created, the CLI context switches to the project. It is possible to change projects, or contexts, at any time. | ||
|
||
The command `oc projects`{{execute}} lists all projects and `oc project <project-name>` allows you to switch projects if needed. | ||
|
||
Add the permission so each pod can read the list of other tomcat-in-the-cloud pods : | ||
|
||
`oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)`{{execute}} | ||
|
||
## Deploying the web application | ||
We created a simple rest clusterised counter demo to test how it operates in the cloud environment. | ||
|
||
*Clone the demo from github :* | ||
|
||
`git clone https://github.com/web-servers/tomcat-in-the-cloud.git`{{execute}} | ||
|
||
Then simply build and deploy it using maven | ||
|
||
`mvn -f tomcat-in-the-cloud/pom.xml fabric8:deploy`{{execute}} | ||
|
||
## Monitor the execution | ||
### *Using the command line* | ||
*Check the pods :* | ||
|
||
`oc get pods`{{execute}} | ||
|
||
*Check the host (route) to access the application :* | ||
|
||
`oc describe routes`{{execute}} | ||
|
||
> The attribute *Requested Host* provides the URL to access your application. | ||
*Scale the application to 3 pods :* | ||
|
||
`oc scale dc tomcat-in-the-cloud --replicas=3`{{execute}} | ||
|
||
### *Using the graphical user interface (GUI)* | ||
*Access the GUI :* | ||
- Select the **Dashboard** view at the top of the screen, you'll get redirected to the OpenShift GUI | ||
- Login with your username/password (**admin/admin** in this scenario) | ||
- Select the project named "tomcat-in-the-cloud" | ||
|
||
*Check the pods :* | ||
- Go to **Applications > Pods** to list them | ||
- Select them to display their detailed information (Status, Used volumes, Containers, etc.) | ||
|
||
*Check the route the access the application :* | ||
- Go to **Applications > Routes** to get a list of the routes related to your applications | ||
- Click on your application's **Hostname** to display it | ||
|
||
*Scale the application to 3 pods :* | ||
- Go to **Applications > Deployments** | ||
- Select the deployment configuration you'd like to edit and select the **latest** deployment | ||
- In the **Details** section, use the arrows to increase or decrease the number of running pods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
In this scenario, you will learn how to deploy Tomcat in the cloud in OpenShift | ||
_Tomcat-in-the-cloud_ is the current name of the project that seeks to port Tomcat clustering into cloud services such as Kubernetes, OpenShift, AWS and Azure. | ||
|
||
In this scenario, you will learn how to build, deploy and monitor it in OpenShift. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
~/.launch.sh | ||
|
||
# Install jdk | ||
yum install java-1.8.0-openjdk-devel.x86_64 -y | ||
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk | ||
|
||
# Installing maven | ||
wget http://www.pirbot.com/mirrors/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz | ||
tar xvf apache-maven-3.5.0-bin.tar.gz | ||
mv apache-maven-3.5.0 /usr/local/apache-maven | ||
# Installing Ant | ||
yum install ant -y | ||
|
||
# Installing Maven | ||
wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz | ||
tar xvf apache-maven-3.5.2-bin.tar.gz | ||
mv apache-maven-3.5.2 /usr/local/apache-maven | ||
export M2_HOME=/usr/local/apache-maven | ||
export M2=$M2_HOME/bin | ||
export M2=$M2_HOME/bin | ||
export PATH=$M2:$PATH |