You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/03/01 19:35:48 UTC

[27/50] [abbrv] stratos git commit: Adding tomcat-sso sample application written by udara

Adding tomcat-sso sample application written by udara


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8b9f5fb3
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8b9f5fb3
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8b9f5fb3

Branch: refs/heads/docker-grouping-merge
Commit: 8b9f5fb37ace7280e9781996b60b216eb8f0d2b8
Parents: a854a9c
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Mar 1 01:48:45 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sun Mar 1 01:48:56 2015 +0530

----------------------------------------------------------------------
 .../conf/configurator/JndiConfigurator.java     |  0
 samples/applications/tomcat-sso/README.md       | 18 ++++++
 .../artifacts/application-policy.json           |  8 +++
 .../tomcat-sso/artifacts/application.json       | 38 ++++++++++++
 .../tomcat-sso/scripts/common/deploy.sh         | 49 +++++++++++++++
 .../tomcat-sso/scripts/common/undeploy.sh       | 21 +++++++
 .../tomcat-sso/scripts/ec2/deploy.sh            |  9 +++
 .../tomcat-sso/scripts/ec2/undeploy.sh          |  7 +++
 .../tomcat-sso/scripts/kubernetes/deploy.sh     | 16 +++++
 .../tomcat-sso/scripts/kubernetes/undeploy.sh   | 13 ++++
 .../tomcat-sso/scripts/mock/deploy.sh           |  9 +++
 .../tomcat-sso/scripts/mock/undeploy.sh         |  7 +++
 .../tomcat-sso/scripts/openstack/deploy.sh      |  9 +++
 .../tomcat-sso/scripts/openstack/undeploy.sh    |  7 +++
 samples/cartridges/kubernetes/tomcat-sso.json   | 30 +++++++++
 samples/cartridges/kubernetes/wso2-is.json      | 27 +++++++++
 .../kubernetes-cluster-ec2.json                 | 64 ++++++++++++++++++++
 17 files changed, 332 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/JndiConfigurator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/JndiConfigurator.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/JndiConfigurator.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/README.md b/samples/applications/tomcat-sso/README.md
new file mode 100644
index 0000000..2faa840
--- /dev/null
+++ b/samples/applications/tomcat-sso/README.md
@@ -0,0 +1,18 @@
+Tomcat Application
+==================
+Tomcat application provides an Apache Tomcat 7 cluster. It has no cartridge groups or any dependencies.
+
+Application folder structure
+----------------------------
+```
+artifacts/<iaas>/ IaaS specific artifacts
+scripts/common/ Common scripts for all iaases
+scripts/<iaas> IaaS specific scripts
+```
+
+How to run
+----------
+```
+cd scripts/<iaas>/
+./deploy.sh
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/artifacts/application-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/artifacts/application-policy.json b/samples/applications/tomcat-sso/artifacts/application-policy.json
new file mode 100644
index 0000000..9d2c6a1
--- /dev/null
+++ b/samples/applications/tomcat-sso/artifacts/application-policy.json
@@ -0,0 +1,8 @@
+{
+   "networkPartition":[
+      {
+         "id":"network-partition-1",
+         "activeByDefault":"true"
+      }
+   ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/artifacts/application.json b/samples/applications/tomcat-sso/artifacts/application.json
new file mode 100644
index 0000000..e4928c8
--- /dev/null
+++ b/samples/applications/tomcat-sso/artifacts/application.json
@@ -0,0 +1,38 @@
+{
+    "applicationId": "tomcat-sso",
+    "alias": "tomcat-sso",
+    "components": {
+
+        "cartridges": [
+            {
+                "type": "tomcat",
+                "cartridgeMin": 1,
+                "cartridgeMax": 1,
+                "subscribableInfo": {
+                    "alias": "mytomcat",
+                    "autoscalingPolicy": "autoscaling-policy-1",
+                    "deploymentPolicy": "deployment-policy-1",
+                    "artifactRepository":{
+                        "privateRepo":false,
+                        "repoUrl":"https://github.com/chamilad/travelocity-sample",
+                        "repoUsername":"",
+                        "repoPassword":""
+                    }
+                }
+            },
+            {
+                "type": "wso2is",
+                "cartridgeMin": 1,
+                "cartridgeMax": 1,
+                "subscribableInfo": {
+                    "alias": "mywso2is",
+                    "autoscalingPolicy": "autoscaling-policy-1",
+                    "deploymentPolicy": "deployment-policy-1"
+                }
+            }
+        ],
+        "dependencies": {
+            "terminationBehaviour": "terminate-none"
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/common/deploy.sh b/samples/applications/tomcat-sso/scripts/common/deploy.sh
new file mode 100755
index 0000000..65d8f4d
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/common/deploy.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+iaas=$1
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+
+artifacts_path=`cd "${script_path}/../../artifacts"; pwd`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+iaas_cartridges_path=`cd "${script_path}/../../../../cartridges/${iaas}"; pwd`
+cartridges_groups_path=`cd "${script_path}/../../../../cartridges-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../network-partitions/${iaas}"; pwd`
+deployment_policies_path=`cd "${script_path}/../../../../deployment-policies"; pwd`
+
+set -e
+
+if [[ -z "${iaas}" ]]; then
+    echo "Usage: deploy.sh [iaas]"
+    exit
+fi
+
+echo ${artifacts_path}/autoscaling-policy.json
+echo "Adding autoscale policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
+
+echo "Adding network partitions..."
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
+
+echo "Adding deployment policy..."
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+
+echo "Adding tomcat cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${iaas_cartridges_path}/tomcat-sso.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding wso2-is cartridge..."
+curl -X POST -H "Content-Type: application/json" -d "@${iaas_cartridges_path}/wso2-is.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges
+
+sleep 1
+
+echo "Creating application..."
+curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications
+
+sleep 1
+
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/application-policy.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/tomcat/deploy

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/common/undeploy.sh b/samples/applications/tomcat-sso/scripts/common/undeploy.sh
new file mode 100644
index 0000000..9bff2b0
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/common/undeploy.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+set -e
+
+echo "Undeploying application..."
+curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-cartridge-app/undeploy
+
+sleep 10
+
+echo "Deleting application..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/applications/single-cartridge-app
+
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/tomcat-sso
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/wso2-is
+
+echo "Removing autoscale policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/ec2/deploy.sh b/samples/applications/tomcat-sso/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/ec2/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="ec2"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/ec2/undeploy.sh b/samples/applications/tomcat-sso/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/ec2/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/kubernetes/deploy.sh b/samples/applications/tomcat-sso/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..753af7e
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/kubernetes/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+iaas="kubernetes"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+kubernetes_clusters_path=`cd "${script_path}/../../../../kubernetes-clusters"; pwd`
+
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d "@${kubernetes_clusters_path}/kubernetes-cluster-ec2.json" -k -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters
+
+bash ${common_folder}/deploy.sh ${iaas}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/kubernetes/undeploy.sh b/samples/applications/tomcat-sso/scripts/kubernetes/undeploy.sh
new file mode 100755
index 0000000..c450ea0
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/kubernetes/undeploy.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+host_ip="localhost"
+host_port=9443
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh
+
+echo "Removing kubernetes cluster..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/kubernetesClusters/kubernetes-cluster-ec2

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/mock/deploy.sh b/samples/applications/tomcat-sso/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/mock/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+iaas="mock"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/mock/undeploy.sh b/samples/applications/tomcat-sso/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/mock/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/openstack/deploy.sh b/samples/applications/tomcat-sso/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/openstack/deploy.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+iaas="openstack"
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/deploy.sh ${iaas}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/applications/tomcat-sso/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/tomcat-sso/scripts/openstack/undeploy.sh b/samples/applications/tomcat-sso/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/tomcat-sso/scripts/openstack/undeploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+prgdir=`dirname "$0"`
+script_path=`cd "$prgdir"; pwd`
+common_folder=`cd "${script_path}/../common"; pwd`
+
+bash ${common_folder}/undeploy.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/cartridges/kubernetes/tomcat-sso.json
----------------------------------------------------------------------
diff --git a/samples/cartridges/kubernetes/tomcat-sso.json b/samples/cartridges/kubernetes/tomcat-sso.json
new file mode 100755
index 0000000..d7e9f30
--- /dev/null
+++ b/samples/cartridges/kubernetes/tomcat-sso.json
@@ -0,0 +1,30 @@
+{
+    "type": "tomcat-sso",
+    "provider": "apache",
+    "host": "tomcat.stratos.org",
+    "category": "data",
+    "displayName": "Tomcat 7",
+    "description": "Tomcat 7 Cartridge",
+    "version": "7",
+    "multiTenant": "false",
+    "portMapping": [
+        {
+            "protocol": "http",
+            "port": "8080",
+            "proxyPort": "8280"
+        }
+    ],
+    "deployment":{
+           "baseDir":"/opt/tomcat/webapps"
+    },
+    "iaasProvider":[
+        {
+            "type":"kubernetes",
+            "imageId":"chamilad/tomcat:4.1.0-beta",
+            "networkInterfaces":[
+            ],
+            "property":[
+            ]
+        }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/cartridges/kubernetes/wso2-is.json
----------------------------------------------------------------------
diff --git a/samples/cartridges/kubernetes/wso2-is.json b/samples/cartridges/kubernetes/wso2-is.json
new file mode 100644
index 0000000..b2a746e
--- /dev/null
+++ b/samples/cartridges/kubernetes/wso2-is.json
@@ -0,0 +1,27 @@
+{
+    "type": "wso2is",
+    "provider": "data",
+    "host": "wso2is.stratos.org",
+    "category": "data",
+    "displayName": "WSO2 IS 5.0.0",
+    "description": "WSO2 IS 5.0.0 Cartridge",
+    "version": "7",
+    "multiTenant": "false",
+    "portMapping": [
+        {
+            "protocol": "http",
+            "port": "9443",
+            "proxyPort": "8280"
+        }
+    ],
+    "iaasProvider":[
+        {
+            "type":"kubernetes",
+            "imageId":"chamilad/wso2is:4.1.0-beta",
+            "networkInterfaces":[
+            ],
+            "property":[
+            ]
+        }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b9f5fb3/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
----------------------------------------------------------------------
diff --git a/samples/kubernetes-clusters/kubernetes-cluster-ec2.json b/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
new file mode 100644
index 0000000..94cb4bf
--- /dev/null
+++ b/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
@@ -0,0 +1,64 @@
+{
+    "clusterId": "kubernetes-cluster-ec2",
+    "description": "Kubernetes Cluster EC2",
+    "kubernetesMaster": {
+        "hostId": "KubHostMaster1",
+        "hostname": "master.dev.kubernetes.example.org",
+        "privateIPAddress": "10.175.144.104",
+        "publicIPAddress": "54.151.228.48",
+        "property": [
+        ]
+    },
+    "portRange": {
+        "upper": "5000",
+        "lower": "4500"
+    },
+    "kubernetesHosts": [
+        {
+            "hostId": "KubHostSlave1",
+            "hostname": "slave1.dev.kubernetes.example.org",
+            "privateIPAddress": "10.151.10.16",
+            "publicIPAddress": "54.179.64.66",
+            "property": [
+            ]
+        },
+        {
+            "hostId": "KubHostSlave2",
+            "hostname": "slave2.dev.kubernetes.example.org",
+            "privateIPAddress": "10.150.148.75",
+            "publicIPAddress": "54.151.241.37",
+            "property": [
+            ]
+        },
+        {
+            "hostId": "KubHostSlave3",
+            "hostname": "slave2.dev.kubernetes.example.org",
+            "privateIPAddress": "10.148.100.77",
+            "publicIPAddress": "54.179.225.120",
+            "property": [
+            ]
+        }
+    ],
+    "property": [
+        {
+            "name": "payload_parameter.MB_IP",
+            "value": "54.179.197.243"
+        },
+        {
+            "name": "payload_parameter.MB_PORT",
+            "value": "1883"
+        },
+        {
+            "name": "payload_parameter.CEP_IP",
+            "value": "54.179.197.243"
+        },
+        {
+            "name": "payload_parameter.CEP_PORT",
+            "value": "7711"
+        },
+        {
+            "name": "payload_parameter.LOG_LEVEL",
+            "value": "DEBUG"
+        }
+    ]
+}