Repository: stratos
Updated Branches:
  refs/heads/master 2065d7a16 -> a882d5096


adding nested-group-v2 sample


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

Branch: refs/heads/master
Commit: a882d50962ffe20c70e4cd0f9fa0fcc19fb265f1
Parents: 2065d7a
Author: reka <[email protected]>
Authored: Thu Apr 23 13:57:54 2015 +0530
Committer: reka <[email protected]>
Committed: Thu Apr 23 13:57:54 2015 +0530

----------------------------------------------------------------------
 samples/applications/nested-group-v2/README.md  |  30 ++++++
 .../nested-group-v2/artifacts/application.json  |  97 +++++++++++++++++++
 .../nested-group-v2/nested-group-app.png        | Bin 0 -> 22765 bytes
 .../nested-group-v2/scripts/common/deploy.sh    |  66 +++++++++++++
 .../nested-group-v2/scripts/common/undeploy.sh  |  29 ++++++
 .../nested-group-v2/scripts/ec2/deploy.sh       |   9 ++
 .../nested-group-v2/scripts/ec2/undeploy.sh     |   7 ++
 .../scripts/kubernetes/deploy.sh                |  15 +++
 .../scripts/kubernetes/undeploy.sh              |  13 +++
 .../nested-group-v2/scripts/mock/deploy.sh      |   9 ++
 .../nested-group-v2/scripts/mock/undeploy.sh    |   7 ++
 .../nested-group-v2/scripts/openstack/deploy.sh |   9 ++
 .../scripts/openstack/undeploy.sh               |   7 ++
 13 files changed, 298 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/README.md
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/README.md 
b/samples/applications/nested-group-v2/README.md
new file mode 100644
index 0000000..3bf8240
--- /dev/null
+++ b/samples/applications/nested-group-v2/README.md
@@ -0,0 +1,30 @@
+nested-group
+============
+
+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
+
+
+Description
+----------
+
+This sample is to test the nested grouping with more than one group in one 
level where each groups have their own cartridges. Eg:
+
+             group6
+               |
+       -----------------
+       |               |
+    group7       group-tom2
+       |               |
+   --------        ---------
+   |      |        |        |
+tomcat  tomcat1  tomcat2  tomcat3
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/artifacts/application.json 
b/samples/applications/nested-group-v2/artifacts/application.json
new file mode 100644
index 0000000..bfa7732
--- /dev/null
+++ b/samples/applications/nested-group-v2/artifacts/application.json
@@ -0,0 +1,97 @@
+{
+    "applicationId": "nested-group-app",
+    "alias": "my-nested-group-app",
+    "components": {
+        "groups": [
+            {
+                "name": "group6",
+                "alias": "my-group6",
+                "groupMinInstances": 1,
+                "groupMaxInstances": 1,
+                "deploymentPolicy":"deployment-policy-2",
+                "groups": [
+                    {
+                        "name": "group7",
+                        "alias": "my-group7",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat-group7",
+                                    "autoscalingPolicy": 
"autoscaling-policy-1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            },
+                            {
+                                "type": "tomcat1",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat1-group7",
+                                    "autoscalingPolicy": 
"autoscaling-policy-1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            }
+                        ],
+                        "groups": []
+                    },
+                    {
+                        "name": "group-tom2",
+                        "alias": "my-group-tmo2",
+                        "groupMinInstances": 1,
+                        "groupMaxInstances": 1,
+                        "cartridges": [
+                            {
+                                "type": "tomcat2",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat2-group",
+                                    "autoscalingPolicy": 
"autoscaling-policy-1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            },
+                            {
+                                "type": "tomcat3",
+                                "cartridgeMin": 1,
+                                "cartridgeMax": 2,
+                                "subscribableInfo": {
+                                    "alias": "my-tomcat3-group",
+                                    "autoscalingPolicy": 
"autoscaling-policy-1",
+                                    "artifactRepository":{
+                                        "privateRepo":false,
+                                        
"repoUrl":"https://github.com/imesh/stratos-tomcat1-applications.git";,
+                                        "repoUsername":"",
+                                        "repoPassword":""
+                                    }
+                                }
+                            }
+                        ],
+                        "groups": []
+                        }
+                ]
+            }
+        ]
+
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/nested-group-app.png
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/nested-group-app.png 
b/samples/applications/nested-group-v2/nested-group-app.png
new file mode 100644
index 0000000..e6a0f37
Binary files /dev/null and 
b/samples/applications/nested-group-v2/nested-group-app.png differ

http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/common/deploy.sh 
b/samples/applications/nested-group-v2/scripts/common/deploy.sh
new file mode 100755
index 0000000..37f3b55
--- /dev/null
+++ b/samples/applications/nested-group-v2/scripts/common/deploy.sh
@@ -0,0 +1,66 @@
+#!/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`
+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`
+application_policies_path=`cd 
"${script_path}/../../../../application-policies"; pwd`
+
+set -e
+
+if [[ -z "${iaas}" ]]; then
+    echo "Usage: deploy.sh [iaas]"
+    exit
+fi
+
+echo ${autoscaling_policies_path}/autoscaling-policy-1.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}:${host_port}/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d 
"@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/networkPartitions
+
+echo "Adding deployment policies..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${deployment_policies_path}/deployment-policy-2.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 
"@${cartridges_path}/tomcat.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat1 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_path}/tomcat1.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_path}/tomcat2.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges
+
+echo "Adding tomcat2 cartridge..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_path}/tomcat3.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges
+
+
+echo "Adding group6c group..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${cartridges_groups_path}/group6c7.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridgeGroups
+
+sleep 1
+
+echo "Adding application policy..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${application_policies_path}/application-policy-1.json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/applicationPolicies
+
+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" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/applications/nested-group-app/deploy/application-policy-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/common/undeploy.sh 
b/samples/applications/nested-group-v2/scripts/common/undeploy.sh
new file mode 100644
index 0000000..038933e
--- /dev/null
+++ b/samples/applications/nested-group-v2/scripts/common/undeploy.sh
@@ -0,0 +1,29 @@
+#!/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/nested-group-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/nested-group-app
+
+echo "Removing groups..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridgeGroups/group6
+
+echo "Removing cartridges..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges/tomcat
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges/tomcat1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/cartridges/tomcat2
+
+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
+
+echo "Removing application policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin 
https://${host_ip}:${host_port}/api/applicationPolicies/application-policy-1
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/scripts/ec2/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/ec2/deploy.sh 
b/samples/applications/nested-group-v2/scripts/ec2/deploy.sh
new file mode 100755
index 0000000..1370667
--- /dev/null
+++ b/samples/applications/nested-group-v2/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/a882d509/samples/applications/nested-group-v2/scripts/ec2/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/ec2/undeploy.sh 
b/samples/applications/nested-group-v2/scripts/ec2/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested-group-v2/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/a882d509/samples/applications/nested-group-v2/scripts/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/kubernetes/deploy.sh 
b/samples/applications/nested-group-v2/scripts/kubernetes/deploy.sh
new file mode 100755
index 0000000..32eff3c
--- /dev/null
+++ b/samples/applications/nested-group-v2/scripts/kubernetes/deploy.sh
@@ -0,0 +1,15 @@
+#!/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`
+iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d 
"@${iaas_artifacts_path}/kubernetes-cluster.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/a882d509/samples/applications/nested-group-v2/scripts/kubernetes/undeploy.sh
----------------------------------------------------------------------
diff --git 
a/samples/applications/nested-group-v2/scripts/kubernetes/undeploy.sh 
b/samples/applications/nested-group-v2/scripts/kubernetes/undeploy.sh
new file mode 100644
index 0000000..0054670
--- /dev/null
+++ b/samples/applications/nested-group-v2/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-1

http://git-wip-us.apache.org/repos/asf/stratos/blob/a882d509/samples/applications/nested-group-v2/scripts/mock/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/mock/deploy.sh 
b/samples/applications/nested-group-v2/scripts/mock/deploy.sh
new file mode 100755
index 0000000..93f8517
--- /dev/null
+++ b/samples/applications/nested-group-v2/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/a882d509/samples/applications/nested-group-v2/scripts/mock/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/mock/undeploy.sh 
b/samples/applications/nested-group-v2/scripts/mock/undeploy.sh
new file mode 100755
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested-group-v2/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/a882d509/samples/applications/nested-group-v2/scripts/openstack/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/openstack/deploy.sh 
b/samples/applications/nested-group-v2/scripts/openstack/deploy.sh
new file mode 100755
index 0000000..4c39959
--- /dev/null
+++ b/samples/applications/nested-group-v2/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/a882d509/samples/applications/nested-group-v2/scripts/openstack/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/nested-group-v2/scripts/openstack/undeploy.sh 
b/samples/applications/nested-group-v2/scripts/openstack/undeploy.sh
new file mode 100644
index 0000000..17d8c71
--- /dev/null
+++ b/samples/applications/nested-group-v2/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

Reply via email to