Skip to content

Commit

Permalink
Merge pull request #87 from wso2/6.2.x
Browse files Browse the repository at this point in the history
Merge 6.2.x branch to master branch
  • Loading branch information
msmshariq authored Jun 21, 2018
2 parents f34d8c2 + b88c7f2 commit 9a9966c
Show file tree
Hide file tree
Showing 51 changed files with 8,973 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ This repository contains Kubernetes resources required for,
* [A clustered deployment of WSO2 Enterprise Integrator's Business Process Server (BPS) profile](scalable-bps)

* [A clustered deployment of WSO2 Enterprise Integrator's Message Broker profile](scalable-mb)

* [A clustered deployment of WSO2 Enterprise Integrator's Integrator profile with Integrator Analytics support](integrator-analytics)

* [Clustered deployments of WSO2 Enterprise Integrator's Integrator and Broker profile with Integrator Analytics support](integrator-broker-analytics)

215 changes: 215 additions & 0 deletions integrator-analytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# Kubernetes Resources for deployment of Integrator profile of WSO2 Enterprise Integrator with Analytics

Core Kubernetes resources for a clustered deployment of Integrator profile of WSO2 Enterprise Integrator with Integrator Analytics support.

![A clustered deployment WSO2 Enterprise Integator's Integrator profile with Integrator Analytics support](integrator-analytics.png)

## Prerequisites

* In order to use these Kubernetes resources, you will need an active [Free Trial Subscription](https://wso2.com/free-trial-subscription)
from WSO2 since the referring Docker images hosted at docker.wso2.com contains the latest updates and fixes for WSO2 Enterprise Integrator.
You can sign up for a Free Trial Subscription [here](https://wso2.com/free-trial-subscription).<br><br>

* Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), [Docker](https://www.docker.com/get-docker)
(version 17.09.0 or above) and [Kubernetes client](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
in order to run the steps provided<br>in the following quick start guide.<br><br>

* An already setup [Kubernetes cluster](https://kubernetes.io/docs/setup/pick-right-solution/)<br><br>

## Quick Start Guide

>In the context of this document, `KUBERNETES_HOME` will refer to a local copy of the [`wso2/kubernetes-ei`](https://github.com/wso2/kubernetes-ei/)
Git repository.<br>
##### 1. Checkout Kubernetes Resources for WSO2 Enterprise Integrator Git repository:

```
git clone https://github.com/wso2/kubernetes-ei.git
```

##### 2. Create a namespace named `wso2` and a service account named `wso2svc-account`, within the namespace `wso2`.

```
kubectl create namespace wso2
kubectl create serviceaccount wso2svc-account -n wso2
```

Then, switch the context to new `wso2` namespace from `default` namespace.

```
kubectl config set-context $(kubectl config current-context) --namespace=wso2
```

##### 3. Create a Kubernetes Secret for pulling the required Docker images from [`WSO2 Docker Registry`](https://docker.wso2.com):

Create a Kubernetes Secret named `wso2creds` in the cluster to authenticate with the WSO2 Docker Registry, to pull the required images.

```
kubectl create secret docker-registry wso2creds --docker-server=docker.wso2.com --docker-username=<username> --docker-password=<password> --docker-email=<email>
```

`username`: Username of your Free Trial Subscription<br>
`password`: Password of your Free Trial Subscription<br>
`email`: Username of your Free Trial Subscription

Please see [Kubernetes official documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that-holds-your-authorization-token)
for further details.

##### 4. Setup and configure external product database(s):

Setup the external product databases. Please refer to WSO2's official documentation [1](https://docs.wso2.com/display/EI620/Clustering+the+ESB+Profile#ClusteringtheESBProfile-Creatingthedatabases)
and [2](https://docs.wso2.com/display/EI620/Minimum+High+Availability+Deployment) on creating the required databases for the deployment.

Provide appropriate connection URLs, corresponding to the created external databases and the relevant driver class names for the data sources defined in
the following files:

* `KUBERNETES_HOME/integrator-analytics/confs/ei-analytics-1/datasources/master-datasources.xml`
* `KUBERNETES_HOME/integrator-analytics/confs/ei-analytics-1/datasources/analytics-datasources.xml`
* `KUBERNETES_HOME/integrator-analytics/confs/ei-analytics-2/datasources/master-datasources.xml`
* `KUBERNETES_HOME/integrator-analytics/confs/ei-analytics-2/datasources/analytics-datasources.xml`
* `KUBERNETES_HOME/integrator-analytics/confs/integrator/datasources/master-datasources.xml`

Please refer WSO2's [official documentation](https://docs.wso2.com/display/ADMIN44x/Configuring+master-datasources.xml) on configuring data sources.

**Note**:

* For **evaluation purposes**, you can use Kubernetes resources provided in the directory<br>
`KUBERNETES_HOME/integrator-analytics/test/rdbms/mysql` for deploying the product databases, using MySQL in Kubernetes. However, this approach of product database deployment is
**not recommended** for a production setup.

* For using these Kubernetes resources,

first create a Kubernetes ConfigMap for passing database script(s) to the deployment.

```
kubectl create configmap mysql-dbscripts --from-file=<KUBERNETES_HOME>/integrator-analytics/test/confs/rdbms/mysql/dbscripts/
```
Then, create a Kubernetes service (accessible only within the Kubernetes cluster) and followed by the MySQL Kubernetes deployment, as follows:
```
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/test/rdbms/mysql/mysql-service.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/test/rdbms/mysql/mysql-deployment.yaml
```
##### 5. Create a Kubernetes role and a role binding necessary for the Kubernetes API requests made from Kubernetes membership scheme.
```
kubectl create --username=admin --password=<cluster-admin-password> -f <KUBERNETES_HOME>/rbac/rbac.yaml
```
##### 6. Setup a Network File System (NFS) to be used as the persistent volume for artifact sharing across Integrator and Analytics instances.
Update the NFS server IP (`NFS_SERVER_IP`) and export path (`NFS_LOCATION_PATH`) of persistent volume resources,
* `integrator-with-analytics-shared-deployment-pv`
* `integrator-with-analytics-shared-tenants-pv`
* `integrator-with-analytics-ei-analytics-data-pv-1`
* `integrator-with-analytics-ei-analytics-data-pv-2`
in `<KUBERNETES_HOME>/integrator-analytics/volumes/persistent-volumes.yaml` file.
Create a user named `wso2carbon` with user id `802` and a group named `wso2` with group id `802` in the NFS node.
Add `wso2carbon` user to the group `wso2`.
Then, provide ownership of the exported folder `NFS_LOCATION_PATH` (used for artifact sharing) to `wso2carbon` user and `wso2` group.
And provide read-write-executable permissions to owning `wso2carbon` user, for the folder `NFS_LOCATION_PATH`.
Then, deploy the persistent volume resource and volume claim as follows:
```
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/integrator/integrator-volume-claims.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/analytics/integrator-analytics-volume-claims.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/volumes/persistent-volumes.yaml
```
##### 7. Create Kubernetes ConfigMaps for passing WSO2 product configurations into the Kubernetes cluster:
```
kubectl create configmap integrator-conf --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/integrator/conf
kubectl create configmap integrator-conf-axis2 --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/integrator/conf/axis2/
kubectl create configmap integrator-conf-datasources --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/integrator/conf/datasources/
kubectl create configmap integrator-conf-event-publishers --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/integrator/repository/deployment/server/eventpublishers/

kubectl create configmap ei-analytics-1-conf --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-1/conf
kubectl create configmap ei-analytics-1-conf-analytics --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-1/conf/analytics
kubectl create configmap ei-analytics-1-conf-spark-analytics --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-1/conf/analytics/spark
kubectl create configmap ei-analytics-1-conf-axis2 --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-1/conf/axis2
kubectl create configmap ei-analytics-1-conf-datasources --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-1/conf/datasources
kubectl create configmap ei-analytics-1-deployment-portal --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-1/repository/deployment/server/jaggeryapps/portal/configs

kubectl create configmap ei-analytics-2-conf --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-2/conf
kubectl create configmap ei-analytics-2-conf-analytics --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-2/conf/analytics
kubectl create configmap ei-analytics-2-conf-spark-analytics --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-2/conf/analytics/spark
kubectl create configmap ei-analytics-2-conf-axis2 --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-2/conf/axis2
kubectl create configmap ei-analytics-2-conf-datasources --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-2/conf/datasources
kubectl create configmap ei-analytics-2-deployment-portal --from-file=<KUBERNETES_HOME>/integrator-analytics/confs/ei-analytics-2/repository/deployment/server/jaggeryapps/portal/configs
```
##### 8. Create Kubernetes Services and Deployments for WSO2 Enterprise Integrator and Analytics:
```
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/analytics/integrator-analytics-1-deployment.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/analytics/integrator-analytics-1-service.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/analytics/integrator-analytics-2-deployment.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/analytics/integrator-analytics-2-service.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/analytics/integrator-analytics-service.yaml

kubectl create -f <KUBERNETES_HOME>/integrator-analytics/integrator/integrator-service.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/integrator/integrator-gateway-service.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/integrator/integrator-deployment.yaml
```
##### 9. Deploy Kubernetes Ingress resource:
The WSO2 Enterprise Integrator Kubernetes Ingress resource uses the NGINX Ingress Controller.
In order to enable the NGINX Ingress controller in the desired cloud or on-premise environment,
please refer the official documentation, [NGINX Ingress Controller Installation Guide](https://kubernetes.github.io/ingress-nginx/deploy/).
Finally, deploy the WSO2 Enterprise Integrator Kubernetes Ingress resources as follows:
```
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/ingresses/integrator-analytics-ingress.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/ingresses/integrator-gateway-ingress.yaml
kubectl create -f <KUBERNETES_HOME>/integrator-analytics/ingresses/integrator-ingress.yaml
```
##### 10. Access Management Consoles:
Default deployment will expose `wso2ei-integrator`, `wso2ei-integrator-gateway` and `wso2ei-analytics` hosts.
To access the console in the environment,
1. Obtain the external IP (`EXTERNAL-IP`) of the Ingress resources by listing down the Kubernetes Ingresses (using `kubectl get ing`).
e.g.
```
NAME HOSTS ADDRESS PORTS AGE
integrator-with-analytics-ei-analytics-ingress wso2ei-analytics <EXTERNAL-IP> 80, 443 2m
wso2ei-integrator-gateway-tls-ingress wso2ei-integrator-gateway <EXTERNAL-IP> 80, 443 2m
wso2ei-integrator-ingress wso2ei-integrator <EXTERNAL-IP> 80, 443 2m
```
2. Add the above host as an entry in /etc/hosts file as follows:
```
<EXTERNAL-IP> wso2ei-analytics
<EXTERNAL-IP> wso2ei-integrator-gateway
<EXTERNAL-IP> wso2ei-integrator
```
3. Try navigating to `https://wso2ei-integrator/carbon` and `https://wso2ei-analytics/carbon` from your favorite browser.
##### 11. Scale up using `kubectl scale`:
Default deployment runs a single replica (or pod) of WSO2 Enterprise Integrator's Integrator profile. To scale this deployment into any `<n>` number of
container replicas, upon your requirement, simply run following Kubernetes client command on the terminal.
```
kubectl scale --replicas=<n> -f <KUBERNETES_HOME>/integrator-analytics/integrator/integrator-deployment.yaml
```
For example, If `<n>` is 2, you are here scaling up this deployment from 1 to 2 container replicas.
155 changes: 155 additions & 0 deletions integrator-analytics/analytics/integrator-analytics-1-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: integrator-with-analytics-ei-analytics-1-deployment
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
deployment: integrator-with-analytics-ei-analytics
node: integrator-with-analytics-ei-analytics-1
spec:
containers:
- name: integrator-with-analytics-ei-analytics-1
image: docker.wso2.com/wso2ei-analytics:6.2.0
resources:
limits:
memory: "4Gi"
requests:
memory: "4Gi"
livenessProbe:
exec:
command:
- /bin/bash
- -c
- nc -z localhost 7712
initialDelaySeconds: 250
periodSeconds: 10
readinessProbe:
exec:
command:
- /bin/bash
- -c
- nc -z localhost 7712
initialDelaySeconds: 250
periodSeconds: 10
imagePullPolicy: Always
ports:
-
containerPort: 9764
protocol: "TCP"
-
containerPort: 9444
protocol: "TCP"
-
containerPort: 7612
protocol: "TCP"
-
containerPort: 7712
protocol: "TCP"
-
containerPort: 11225
protocol: "TCP"
-
containerPort: 10006
protocol: "TCP"
-
containerPort: 11001
protocol: "TCP"
-
containerPort: 11002
protocol: "TCP"
-
containerPort: 11003
protocol: "TCP"
-
containerPort: 11501
protocol: "TCP"
-
containerPort: 8083
protocol: "TCP"
-
containerPort: 4041
protocol: "TCP"
-
containerPort: 10007
protocol: TCP
-
containerPort: 12501
protocol: TCP
-
containerPort: 13001
protocol: TCP
-
containerPort: 13501
protocol: TCP
-
containerPort: 14501
protocol: TCP
-
containerPort: 7078
protocol: TCP
-
containerPort: 6067
protocol: TCP
volumeMounts:
- name: ei-analytics-1-conf
mountPath: /home/wso2carbon/kubernetes-volumes/analytics/conf
- name: ei-analytics-1-conf-analytics
mountPath: /home/wso2carbon/kubernetes-volumes/analytics/conf-analytics
- name: ei-analytics-1-conf-spark-analytics
mountPath: /home/wso2carbon/kubernetes-volumes/analytics/conf-spark-analytics
- name: ei-analytics-1-conf-axis2
mountPath: /home/wso2carbon/kubernetes-volumes/analytics/conf-axis2
- name: ei-analytics-1-conf-datasources
mountPath: /home/wso2carbon/kubernetes-volumes/analytics/conf-datasources
- name: ei-analytics-1-deployment-portal
mountPath: /home/wso2carbon/kubernetes-volumes/analytics/conf-portal
- name: data-persistent-disk
mountPath: /home/wso2carbon/wso2ei-6.2.0/wso2/analytics/repository/data
serviceAccountName: "wso2svc-account"
imagePullSecrets:
- name: wso2creds
volumes:
- name: ei-analytics-1-conf
configMap:
name: ei-analytics-1-conf
- name: ei-analytics-1-conf-analytics
configMap:
name: ei-analytics-1-conf-analytics
- name: ei-analytics-1-conf-spark-analytics
configMap:
name: ei-analytics-1-conf-spark-analytics
- name: ei-analytics-1-conf-axis2
configMap:
name: ei-analytics-1-conf-axis2
- name: ei-analytics-1-conf-datasources
configMap:
name: ei-analytics-1-conf-datasources
- name: ei-analytics-1-deployment-portal
configMap:
name: ei-analytics-1-deployment-portal
- name: data-persistent-disk
persistentVolumeClaim:
claimName: ei-analytics-1-data-volume-claim
Loading

0 comments on commit 9a9966c

Please sign in to comment.